ensure_from_s3

ensure_from_s3(key, *subkeys, s3_bucket, s3_key, name=None, force=False, **kwargs)[source]

Ensure a file is downloaded.

Parameters:
  • key (str) – The name of the module. No funny characters. The envvar <key>_HOME where key is uppercased is checked first before using the default home directory.

  • subkeys (str) – A sequence of additional strings to join. If none are given, returns the directory for this module.

  • s3_bucket (str) – The S3 bucket name

  • s3_key (Union[str, Sequence[str]]) – The S3 key name

  • name (Optional[str]) – Overrides the name of the file at the end of the S3 key, if given.

  • force (bool) – Should the download be done again, even if the path already exists? Defaults to false.

  • kwargs – Remaining kwargs to forwrad to Module.ensure_from_s3.

Return type:

Path

Returns:

The path of the file that has been downloaded (or already exists)

Example downloading ProtMapper 0.0.21:

>>> version = '0.0.21'
>>> ensure_from_s3('test', version, s3_bucket='bigmech', s3_key=f'protmapper/{version}/refseq_uniprot.csv')