lamindb.core.AnnDataAnnotator¶
- class lamindb.core.AnnDataAnnotator(data, var_index, categoricals=None, using='default', verbosity='hint', organism=None)¶
Bases:
DataFrameAnnotatorAnnotation flow for
AnnData.- Parameters:
data (
AnnData|str|Path) – The AnnData object or an AnnData-like path.var_index (
DeferredAttribute) – The registry field for mapping the.varindex.categoricals (
dict[str,DeferredAttribute] |None, default:None) – A dictionary mapping.obs.columnsto a registry field.using (
str, default:'default') – A reference LaminDB instance.verbosity (
str, default:'hint') – The verbosity level.organism (
str|None, default:None) – The organism name.
Examples
>>> import bionty as bt >>> annotate = ln.Annotate.from_anndata( adata, var_index=bt.Gene.ensembl_gene_id, categoricals={"cell_type_ontology_id": bt.CellType.ontology_id, "donor_id": ln.ULabel.name}, organism="human", )
Attributes
- categoricals dict¶
Return the obs fields to validate against.
- fields dict¶
Return the columns fields to validate against.
- var_index FieldAttr¶
Return the registry field to validate variables index against.
Methods
- add_new_from_var_index(organism=None, **kwargs)¶
Update variable records.
- Parameters:
organism (
str|None, default:None) – The organism name.**kwargs – Additional keyword arguments to pass to the registry model.
- lookup(using=None)¶
Lookup categories.
- Parameters:
using (
str|None, default:None) – The instance where the lookup is performed. if None (default), the lookup is performed on the instance specified in “using” parameter of the validator. if “public”, the lookup is performed on the public reference.- Return type:
- save_artifact(description=None, **kwargs)¶
Save the validated
AnnDataand metadata.- Parameters:
description (
str|None, default:None) – Description of theAnnDataobject.**kwargs – Object level metadata.
- Return type:
- Returns:
A saved artifact record.
- validate(organism=None)¶
Validate categories.
- Parameters:
organism (
str|None, default:None) – The organism name.- Return type:
bool- Returns:
Whether the AnnData object is validated.