subset_genes: Exclude some genes given a pattern match

View source: R/expt.R

subset_genesR Documentation

Exclude some genes given a pattern match

Description

Because I am too lazy to remember that expressionsets use matrix subsets for gene and sample. Also those methods lead to shenanigans when I want to know what happened to the data over the course of the subset.

Usage

subset_genes(
  expt,
  column = "txtype",
  method = "remove",
  ids = NULL,
  warning_cutoff = 90,
  meta_column = NULL,
  patterns = c("snRNA", "tRNA", "rRNA"),
  ...
)

Arguments

expt

Expressionset containing expt object.

column

fData column to use for subsetting.

method

Either remove explicit rows, or keep them.

ids

Specific IDs to exclude.

warning_cutoff

Print the sample IDs for anything which has less than this percent left.

meta_column

Save the amount of data lost to this metadata column when not null.

patterns

Character list of patterns to remove/keep

...

Extra arguments are passed to arglist, currently unused.

Value

A smaller expt

See Also

[create_expt()] [Biobase]

Examples

 ## Not run: 
  all_expt <- create_expt(metadata)
  ## This assumes a column in the metadata named 'txtype' containing the
  ## information telling us what type of transcript each gene is.
  no_ribosomes <- exclude_genes_expt(all_expt, column = "txtype",
                                     patterns = c("snRNA", "tRNA", "rRNA"))
  i_hate_these_genes <- exclude_genes_expt(all_expt, ids = c("gene1", "gene2"))
  only_ribosomes <- exclude_genes_expt(all_expt, method = "keep")

## End(Not run)

elsayed-lab/hpgltools documentation built on May 9, 2024, 5:02 a.m.