filter_genes: Search for genes

View source: R/gene_infos.R

filter_genesR Documentation

Search for genes

Description

Goes through the summary text of genes and returns gene names that match the requirements.

Usage

filter_genes(
  catchphrases,
  test = "any",
  standalone = TRUE,
  case_sensitive = FALSE,
  return_var = "symbol",
  genes_subset = NULL,
  genes_rm = NULL,
  ...
)

Arguments

catchphrases

Character vector of catchphrases to look for.

test

Character value. Determines how the input of catchphrases is used to skim the genes.

  • test = 'any': Genes are kept if at least one of the catchphrases appears in the summary.

  • test = 'all': Genes are kept if all of the catchphrases appear in the summary.

  • test = 'none': Genes are kept if none of the catchphrases appear in the summary

standalone

Logical value. If TRUE, catchphrases must appear as standalone words. If FALSE, they can be part of other words.

case_sensitive

Logical value. If TRUE, the function pays attention to capital- and non-capital letters. E.g. if catchphrases = 'astrocyte' but the text of a gene only features Astrocyte the gene is not included in the output as the text features astrocyte in upper case. Setting case_sensitive to FALSE, the default, makes the function ignore upper and lower cases.

return_var

The variable of the gene_info_df that is returned as a vector. Defaults to symbol.

genes_subset

Character vector or NULL. If character, subsets gene info data.frame accordingly such that the test is only applied to the provided genes.

genes_rm

Character vector or NULL. If character, removes specified genes from gene info data.frame such that the catchphrase test is only applied to genes that are not specified.

...

Logical tests given to dplyr::filter() that can be used to prefilter the data.frame before going through the summary texts.

Details

See documentation for ?gene_info_df to read about how the source data.frame has been generated.

Value

Character vector of gene names.

Examples


 # create a small subset of genes for demonstration purposes

 example_genes <- c("GFAP" , "MAG", "OLIG1", "EGFR")

 print_gene_info(genes = example_genes)

 # different tests

 filter_genes(
  catchphrases = c("astrocytes", "surface"),
  test = "any",
  genes_subset = example_genes
  )

 filter_genes(
  catchphrases = c("astrocytes", "surface"),
  test = "all",
  genes_subset = example_genes
  )


 filter_genes(
  catchphrases = c("astrocytes", "surface"),
  test = "none",
  genes_subset = example_genes
  )

 # standalone TRUE or FALSE

 filter_genes(
  catchphrases = c("glyco"),
  standalone = FALSE,
  genes_subset = example_genes
  )

 filter_genes(
  catchphrases = c("glyco"),
  standalone = TRUE,
  genes_subset = example_genes
  )




kueckelj/confuns documentation built on June 28, 2024, 9:19 a.m.