omicverse.utils.get_gene_annotation¶
- omicverse.utils.get_gene_annotation(adata, var_by=None, gtf=None, gtf_by=None, by_func=None)[source]¶
Annotate
adata.varby merging with gene-level GTF attributes.- Parameters:
adata (Input dataset.)
var_by (Specify a column in
adata.varused to merge with GTF attributes,) – otherwiseadata.var_namesis used by default.gtf (Path to the GTF file.)
gtf_by (Specify a field in the GTF attributes used to merge with
adata.var,) – e.g. “gene_id”, “gene_name”.by_func (Specify an element-wise function used to transform merging fields,) – e.g. removing suffix in gene IDs.
- Return type:
Note
The genomic locations are converted to 0-based as specified in bed format rather than 1-based as specified in GTF format.