pertpy.metadata.Compound#

class pertpy.metadata.Compound[source]#

Utilities to fetch metadata for compounds.

Methods table#

annotate_compounds(adata[, query_id, ...])

Fetch compound annotation from pubchempy.

lookup()

Generate LookUp object for CompoundMetaData.

Methods#

annotate_compounds#

Compound.annotate_compounds(adata, query_id='perturbation', query_id_type='name', verbosity=5, copy=False)[source]#

Fetch compound annotation from pubchempy.

Parameters:
  • adata (AnnData) – The data object to annotate.

  • query_id (str) – The column of .obs with compound identifiers. Defaults to ‘perturbation’.

  • query_id_type (Literal['name', 'cid']) – The type of compound identifiers, ‘name’ or ‘cid’. Defaults to ‘name’.

  • verbosity (int | str) – The number of unmatched identifiers to print, can be either non-negative values or “all”. Defaults to 5.

  • copy (bool) – Determines whether a copy of the adata is returned. Defaults to False.

Return type:

AnnData

Returns:

Returns an AnnData object with compound annotation.

lookup#

Compound.lookup()[source]#

Generate LookUp object for CompoundMetaData.

The LookUp object provides an overview of the metadata to annotate. Each annotate_{metadata} function has a corresponding lookup function in the LookUp object, where users can search the reference_id in the metadata and compare with the query_id in their own data.

Return type:

LookUp

Returns:

Returns a LookUp object specific for compound annotation.