popv.hub.HubMetadata#

class popv.hub.HubMetadata(popv_version, anndata_version, scikit_learn_version, setup_dict, prediction_keys, method_kwargs, methods, cellxgene_url=None, organism=None)[source]#

Encapsulates the required metadata for popV hub models.

Parameters:
  • popv_version (str) – The version of popV that the model was trained with.

  • anndata_version (str) – The version of anndata used during model training.

  • scikit_learn_version (str) – The version of scikit-learn used during model training.

  • setup_dict (dict) – The setup dictionary used to preprocess the data.

  • prediction_keys (list[str]) – The keys used to store the predictions in the AnnData object.

  • methods – The methods used to predict celltypes

  • method_kwargs (dict) – The keyword arguments used in the methods.

  • cellxgene_url (str | None (default: None)) – Link to the data in the CELLxGENE portal (viewer).

  • organism (str | None (default: None)) – The organism of the data.

Attributes table#

Methods table#

from_anndata(adata, anndata_version, ...)

Create a HubMetadata object from an AnnData file.

save(save_path[, overwrite])

Save the metadata to a JSON file.

Attributes#

HubMetadata.cellxgene_url: str | None = None#
HubMetadata.organism: str | None = None#
HubMetadata.popv_version: str#
HubMetadata.anndata_version: str#
HubMetadata.scikit_learn_version: str#
HubMetadata.setup_dict: dict#
HubMetadata.prediction_keys: list[str]#
HubMetadata.method_kwargs: dict#
HubMetadata.methods: list[str]#

Methods#

classmethod HubMetadata.from_anndata(adata, anndata_version, scikit_learn_version, popv_version, organism, **kwargs)[source]#

Create a HubMetadata object from an AnnData file.

Parameters:
  • adata (AnnData) – The AnnData object used to train the model.

  • anndata_version (str) – The version of anndata used during model training.

  • scikit_learn_version (str) – The version of scikit-learn used during model training.

  • popv_version (str) – The version of popV that the model was trained with.

  • organism (str) – The organism of the data.

  • kwargs – Additional keyword arguments to pass to the HubMetadata initializer.

HubMetadata.save(save_path, overwrite=False)[source]#

Save the metadata to a JSON file.

Parameters:
  • save_path (str) – The path to which to save the metadata as a JSON file.

  • overwrite (bool (default: False)) – Whether to overwrite the file if it already exists.

Return type:

None