cellflow.preprocessing.annotate_compounds¶
- cellflow.preprocessing.annotate_compounds(adata, compound_keys, control_category='control', query_id_type='name', obs_key_prefixes=None, copy=False)[source]¶
Annotates compounds in
adatausing pertpy and PubChem.- Parameters:
adata (
AnnData) – AnAnnDataobject.compound_keys (
str|Sequence[str]) – Key(s) inobscontaining the compound identifiers.control_category (
str) – Category to exclude from the annotation.query_id_type (
Literal['name','cid']) – Type of the compound identifiers. Either'name'or'cid'.obs_key_prefixes (
str|Sequence[str] |None) – Prefix for the keys inobsto store the annotations. IfNone, usescompound_keysas prefixes.copy (
bool) – Return a copy ofadatainstead of updating it in place.
- Return type:
None|AnnData- Returns:
: If
copyisTrue, returns a newAnnDataobject with the compound annotations stored inobs. Otherwise, updatesadatain place.Sets the following fields for each value in
compound_keys:.obs[f"{obs_key_prefix}_pubchem_name"]: Name of the compound..obs[f"{obs_key_prefix}_pubchem_ID"]: PubChem CID of the compound..obs[f"{obs_key_prefix}_smiles"]: SMILES representation of the compound.