filter_gene_list

besca.pp.filter_gene_list(adata, filepath, use_raw=True, use_genes='SYMBOL')[source]

Function to remove all genes specified in a gene list read from file.

This function removes all genes in the dataset from a given list of genes (for example mito genes or ribosomal genes). Note that the input file consists of two columns (ENSEMBL gene id and gene symbol).

Parameters:
  • adata (AnnData) – AnnData object

  • filepath (str) – File path as string point to gene list

  • use_raw (bool | default = True) – Boolian indicator if the function should return the filtered raw object or not.

  • use_genes (SYMBOL or ENSEMBL | default = SYMBOL) – String defining whether ENSEMBL id’s or gene symbols are used in the adata.var_names (defines which column of input gene list is read)

Returns:

Returns the filtered AnnData object.

Return type:

AnnData

Example

>>> import besca as bc
>>> import os
>>> adata = bc.datasets.simulated_pbmc3k_raw()
>>> # TO COMPLETE reference_mito_file = 'path2file.tsv'
>>> # adata = bc.pp.filter_gene_list(adata, file_path=reference_mito_file, use_genes='SYMBOL')
>>> # adata.n_vars