aggregateByTaxonomy: Aggregates a MRexperiment object or counts matrix to a...

Description Usage Arguments Value Examples

View source: R/aggregateByTaxonomy.R

Description

Using the featureData information in the MRexperiment, calling aggregateByTaxonomy on a MRexperiment and a particular featureData column (i.e. 'genus') will aggregate counts to the desired level using the aggfun function (default colSums). Possible aggfun alternatives include colMeans and colMedians.

Usage

 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
aggregateByTaxonomy(
  obj,
  lvl,
  alternate = FALSE,
  norm = FALSE,
  log = FALSE,
  aggfun = colSums,
  sl = 1000,
  featureOrder = NULL,
  returnFullHierarchy = TRUE,
  out = "MRexperiment"
)

aggTax(
  obj,
  lvl,
  alternate = FALSE,
  norm = FALSE,
  log = FALSE,
  aggfun = colSums,
  sl = 1000,
  featureOrder = NULL,
  returnFullHierarchy = TRUE,
  out = "MRexperiment"
)

Arguments

obj

A MRexperiment object or count matrix.

lvl

featureData column name from the MRexperiment object or if count matrix object a vector of labels.

alternate

Use the rowname for undefined OTUs instead of aggregating to "no_match".

norm

Whether to aggregate normalized counts or not.

log

Whether or not to log2 transform the counts - if MRexperiment object.

aggfun

Aggregation function.

sl

scaling value, default is 1000.

featureOrder

Hierarchy of levels in taxonomy as fData colnames

returnFullHierarchy

Boolean value to indicate return single column of fData or all columns of hierarchy

out

Either 'MRexperiment' or 'matrix'

Value

An aggregated count matrix.

Examples

1
2
3
4
5
data(mouseData)
aggregateByTaxonomy(mouseData[1:100,],lvl="class",norm=TRUE,aggfun=colSums)
# not run
# aggregateByTaxonomy(mouseData,lvl="class",norm=TRUE,aggfun=colMedians)
# aggTax(mouseData,lvl='phylum',norm=FALSE,aggfun=colSums)

metagenomeSeq documentation built on Nov. 8, 2020, 5:34 p.m.