mt_subset: Normalise and subset the data in 'mmt' objects based on...

Description Usage Arguments Details Value Author(s) Examples

View source: R/mt_subset.R

Description

Subset mt objects based on sample metadata

Usage

1

Arguments

mmt

(required) Data list as loaded with mt_load.

sub_genes

(optional) A string specifying a logical row subset operation on the mtgene dataframe in the mt object parsed to subset.

sub_samples

(optional) A string specifying a logical row subset operation on the mtmeta dataframe in the mt object parsed to subset.

minreads

Minimum number of reads pr. gene. Genes below this value will be removed. (default: 0)

frac0

Fraction of zeros allowed per gene. Genes with a higher fraction of zeros will be removed. (default: 1)

normalise

Normalise the read counts AFTER reads have been removed by the minreads argument but BEFORE any sample/gene subsetting. (default: "none")

  • "quantile": Quantile normalization. See normalize.quantiles for details.

  • "TPM": Normalise read counts to Transcripts Per Milion (TPM).

  • "abundance": Normalise read counts to relative abundance.

  • "libsize": Normalise the read counts to adjust for gene dispersion and total read counts per sample. See estimateSizeFactorsForMatrix for details.

  • "vst": Normalise as "libsize" and perform robust log2-transformation. See vst for details.

  • "log2": Perform log2(x + 1)-transformation.

  • "none": No normalisation.

Details

The function mt_subset operates in three steps:

Subsetting are performed on the mtmeta/mtgene data by subset and the whole object is then adjusted accordingly.

Value

A modifed mt object

Author(s)

Thomas Yssing Michaelsen tym@bio.aau.dk

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
# Get some data.
data("example_mmt")

# Let's subset to contig 1, 7675, and 69676.
mt1 <- mt_subset(example_mmt,sub_genes = "contig %in% c(1,7675,69676)")
mt1

# Let's subset to specific organism.
mt2 <- mt_subset(example_mmt,sub_samples = "Organism == 'Brocadia'")
mt2

# Let's do both and remove genes with less than 10000 reads in total.
mt3 <- mt_subset(example_mmt,
  sub_samples = "Organism == 'Brocadia'",
  sub_genes   = "contig %in% c(1,7675,69676)",
  minreads    = 10000)
mt3

# You can also normalise the data and subset.
mt4 <- mt_subset(example_mmt,
  sub_samples = "Organism == 'Brocadia'",
  sub_genes   = "contig %in% c(1,7675,69676)",
  minreads    = 10000,
  normalise   = "libsize")
mt4 # Note "Normalised:" is now included.

## End(Not run)

TYMichaelsen/mmtravis documentation built on Aug. 5, 2019, 10:48 a.m.