em_map_utils.download_emdb

download_emdb.py

Author:

Ardan Patwardhan

Affiliation:

EMBL-EBI, Wellcome Genome Campus, CB10 1SD, UK

Date:

26/08/2025

Description:

Functions for downloading EMDB maps and other data from EMDB sites.

Attributes

Functions

read_emdb_ids_from(filename)

Read EMDB ids from file.

get_emdb_map_name(emdb_id)

Get EMDB map name from EMDB ID.

get_map_download_path(download_dir, emdb_id)

Create full path to where EMDB map will be downloaded.

get_emdb_map_url(emdb_id[, loc])

Get EMDB map URL from EMDB ID and EMDB location.

download_emdb_map(emdb_id, download_dir[, loc, ...])

Download EMDB map from EMDB ID and EMDB location.

main()

Download EMDB map or a list of maps from a EMDB site.

Module Contents

em_map_utils.download_emdb.logger
em_map_utils.download_emdb.emdbid_pattern
em_map_utils.download_emdb.emdb_root
em_map_utils.download_emdb.read_emdb_ids_from(filename)

Read EMDB ids from file.

Each line is expected to have one EMDB ID and no other characters.

Parameters:

filename – Name of file to read.

Returns:

List of EMDB IDs.

em_map_utils.download_emdb.get_emdb_map_name(emdb_id)

Get EMDB map name from EMDB ID.

Maps are named as emd_XXX.map.gz, where XXX is 4 - 6 digits.

Parameters:

emdb_id – EMDB ID string.

Returns:

Map name.

em_map_utils.download_emdb.get_map_download_path(download_dir, emdb_id)

Create full path to where EMDB map will be downloaded.

Parameters:
  • download_dir – Download directory.

  • emdb_id – EMDB ID string.

Returns:

Map download path.

em_map_utils.download_emdb.get_emdb_map_url(emdb_id, loc='EBI')

Get EMDB map URL from EMDB ID and EMDB location.

Parameters:
  • emdb_id – EMDB ID string.

  • loc – One of the 3 sites from the emdb_root dictionary.

Returns:

EMDB map URL.

em_map_utils.download_emdb.download_emdb_map(emdb_id, download_dir, loc='EBI', resume=True, chunk_size=2**16)

Download EMDB map from EMDB ID and EMDB location.

Parameters:
  • emdb_id – EMDB ID of map to be downloaded.

  • download_dir – Directory to download to.

  • loc – EMDB location to download from.

  • resume – If TRUE and the map has been partially downloaded, continue from where it left off.

  • chunk_size – Chunk size of requests used during download.

Returns:

True if the download was successful.

em_map_utils.download_emdb.main()

Download EMDB map or a list of maps from a EMDB site.

If a list of files is provided, then multiprocessing is used to download EMDB maps. :return: