tacco.preprocessing.filter_reference_genes

filter_reference_genes(adata, annotation_key=None, min_log2foldchange=1.0, min_expression=1e-05, remove_mito=False, n_hvg=None, return_mask=False, return_view=True)[source]

Filter AnnData to include only genes which pass a set of quality and relevance criteria.

Parameters:
  • adata – An AnnData containing profiles in .varm to filter on; to use n_hvg also the bare counts have to be provided in .X.

  • annotation_key – The .varm key where the annotation is stored.

  • min_log2foldchange – Minimum log2-fold change a gene must have in at least one annotation category relative to the mean of the other categories to be kept. Only selects upregulated genes.

  • min_expression – Minimum expression level relative to all expression a gene must have in at least one annotation category to be kept.

  • remove_mito – Whether to remove genes starting with “mt-” and “MT-“.

  • n_hvg – The number of highly variable genes to run on. This expects bare counts in .X. If None, this criterion is switched off.

  • return_mask – Instead of a (view of a) AnnData, return the boolen filter mask.

  • return_view – Instead of a AnnData, return a filtered view into the original adata. If nothing is filtered out, return the original adata.

Returns:

Depending on return_mask and return_view returns a filter mask, a filtered view, or a filtered copy of adata.