Resource management

class protmapper.resources.Feature(type, begin, end, name, id)

Bases: tuple

begin

Alias for field number 1

end

Alias for field number 2

id

Alias for field number 4

name

Alias for field number 3

type

Alias for field number 0

class protmapper.resources.ResourceManager(resource_map)[source]

Bases: object

Class to manage a set of resource files.

Parameters:resource_map (dict) – A dict that maps resource file IDs to a tuple of resource file names and download functions.
download_resource_file(resource_id, cached=True)[source]

Download the resource file corresponding to the given ID.

Parameters:
  • resource_id (str) – The ID of the resource.
  • cached (Optional[bool]) – If True, the download is a pre-processed file from S3, otherwise the download is obtained and processed from the primary source. Default: True
get_create_resource_file(resource_id, cached=True)[source]

Return the path to the resource file, download if it doesn’t exist.

Parameters:
  • resource_id (str) – The ID of the resource.
  • cached (Optional[bool]) – If True, the download is a pre-processed file from S3, otherwise the download is obtained and processed from the primary source. Default: True
Returns:

The path to the resource file.

Return type:

str

get_download_fun(resource_id)[source]

Return the download function for the given resource.

Parameters:resource_id (str) – The ID of the resource.
Returns:The download function for the given resource.
Return type:function
get_resource_file(resource_id)[source]

Return the path to the resource file with the given ID.

Parameters:resource_id (str) – The ID of the resource.
Returns:The path to the resource file.
Return type:str
get_resource_ids()[source]

Return a list of all the resource IDs managed by this manager.

has_resource_file(resource_id)[source]

Return True if the resource file exists for the given ID.

Parameters:resource_id (str) – The ID of the resource.
Returns:True if the resource file exists, false otherwise.
Return type:bool