Skip to contents

Filter dataframe by list of (protein coding) genes

Usage

filter_genes(
  df,
  genes_filt = Rubrary::get_PC_genes(),
  gene_col = NULL,
  search = FALSE
)

Arguments

df

dataframe; gene names in gene_col or in rownames of dataframe

genes_filt

char vector; (protein coding) genes to include / filter by

gene_col

string; colnames of genes, assumed rownames(df) if NULL

search

logical; TRUE to use Seurat::UpdateSymbolList to match gene symbols better

Value

dataframe with gene rownames filtered to protein coding only

Examples

df = data.frame(
  gene = c("geneA", "geneB", "geneC", "geneD"),
  sampA = c(1, 2, 3, 4),
  sampB = c(2, 3, 4, 5),
  sampC = c(3, 4, 5, 6)
)
df_filt <- Rubrary::filter_genes(df, genes_filt = c("geneB", "geneC"), gene_col = "gene")