Zenodo

scarches.zenodo.download_model(download_link: str, save_path: str = './', make_dir: bool = False)[source]

Downloads the zip file of the model in the link and saves it in save_path and extracts.

Parameters:
  • link (str) – Direct downloadable link.

  • save_path (str) – Directory path for downloaded file

  • make_dir (bool) – Whether to make the save_path if it does not exist in the system.

Returns:

extract_dir – Full path to the folder of the model.

Return type:

str

scarches.zenodo.upload_model(model: TRVAE | SCVI | SCANVI | TOTALVI | str, deposition_id: str, access_token: str, model_name: str | None = None)[source]

Uploads trained model to Zenodo.

Parameters:
  • model (TRVAE, SCVI, SCANVI, TOTALVI, str) – An instance of one of classes defined in scarches.models module or a path to a saved model.

  • deposition_id (str) – ID of a deposition in your Zenodo account.

  • access_token (str) – Your Zenodo access token.

  • model_name (str) – An optional name of the model to upload

Returns:

download_link – Generated direct download link for the uploaded model in the deposition. Please Note that the link is usable after your published your deposition.

Return type:

str

Deposition helpers

scarches.zenodo.deposition.create_deposition(access_token: str, upload_type: str, title: str, description: str, **kwargs)[source]

Creates a deposition in your Zenodo account.

Parameters:
  • access_token (str) – Your Zenodo access token.

  • upload_type (str) –

  • title (str) –

  • description (str) –

  • kwargs

Returns:

deposition_id – ID of the created deposition.

Return type:

str

scarches.zenodo.deposition.delete_deposition(deposition_id: str, access_token: str)[source]

Deletes the existing deposition with deposition_id in your Zenodo account.

Parameters:
  • deposition_id (str) – ID of a deposition in your Zenodo account.

  • access_token (str) – Your Zenodo Access token.

scarches.zenodo.deposition.get_all_deposition_ids(access_token: str)[source]

Gets list of all of deposition IDs existed in your Zenodo account.

Parameters:

access_token (str) – Your Zenodo access token.

Returns:

deposition_ids – List of deposition IDs.

Return type:

list

scarches.zenodo.deposition.publish_deposition(deposition_id: str, access_token: str)[source]

Publishes the existing deposition with deposition_id in your Zenodo account.

Parameters:
  • deposition_id (str) – ID of a deposition in your Zenodo account.

  • access_token (str) – Your Zenodo access token.

Returns:

download_link – Generated direct download link for the uploaded model in the deposition. Please Note that the link is usable after your published your deposition.

Return type:

str

scarches.zenodo.deposition.update_deposition(deposition_id: str, access_token: str, metadata: dict)[source]

Updates the existing deposition with deposition_id in your Zenodo account.

Parameters:
  • deposition_id (str) – ID of a deposition in your Zenodo account.

  • access_token (str) – Your Zenodo access token.

  • metadata (dict) –

File Helpers

scarches.zenodo.file.download_file(link: str, save_path: str | None = None, make_dir: bool = False)[source]

Downloads the file in the link and saves it in save_path.

Parameters:
  • link (str) – Direct downloadable link.

  • save_path (str) – Path with the name and extension of downloaded file.

  • make_dir (bool) – Whether to make the save_path if it does not exist in the system.

Returns:

  • file_path (str) – Full path with name and extension of downloaded file.

  • http_response (HTTPMessage) – HttpMessage object containing status code and information about the http request.

scarches.zenodo.file.upload_file(file_path: str, deposition_id: str, access_token: str)[source]

Downloads the file in the link and saves it in save_path.

Parameters:
  • file_path (str) – Full path with the name and extension of the file you want to upload.

  • deposition_id (str) – ID of a deposition in your Zenodo account.

  • access_token (str) – Your Zenodo Access token.

Returns:

  • file_path (str) – Full path with name and extension of downloaded file.

  • http_response (HTTPMessage) – HttpMessage object containing status code and information about the http request.