mp_aggregate_clade-methods: calculate the mean/median (relative) abundance of internal...

mp_aggregate_cladeR Documentation

calculate the mean/median (relative) abundance of internal nodes according to their children tips.

Description

calculate the mean/median (relative) abundance of internal nodes according to their children tips.

Usage

mp_aggregate_clade(
  .data,
  .abundance = NULL,
  force = FALSE,
  relative = TRUE,
  aggregate_fun = c("mean", "median", "geometric.mean"),
  action = "get",
  ...
)

## S4 method for signature 'MPSE'
mp_aggregate_clade(
  .data,
  .abundance = NULL,
  force = FALSE,
  relative = TRUE,
  aggregate_fun = c("mean", "median", "geometric.mean"),
  action = "get",
  ...
)

## S4 method for signature 'tbl_mpse'
mp_aggregate_clade(
  .data,
  .abundance = NULL,
  force = FALSE,
  relative = TRUE,
  aggregate_fun = c("mean", "median", "geometric.mean"),
  action = "get",
  ...
)

## S4 method for signature 'grouped_df_mpse'
mp_aggregate_clade(
  .data,
  .abundance = NULL,
  force = FALSE,
  relative = TRUE,
  aggregate_fun = c("mean", "median", "geometric.mean"),
  action = "get",
  ...
)

Arguments

.data

MPSE object which must contain otutree slot, required

.abundance

the column names of abundance.

force

logical whether calculate the (relative) abundance forcibly when the abundance is not be rarefied, default is FALSE.

relative

logical whether calculate the relative abundance.

aggregate_fun

function the method to calculate the (relative) abundance of internal nodes according to their children tips, default is 'mean', other options are 'median', 'geometric.mean'.

action

character, "add" joins the new information to the otutree slot if it exists (default). In addition, "only" return a non-redundant tibble with the just new information. "get" return a new 'mpse', which the features is the internal nodes.

...

additional parameters, meaningless now.

Value

a object according to 'action' argument.

Examples

## Not run: 
  suppressPackageStartupMessages(library(curatedMetagenomicData))
  xx <- curatedMetagenomicData('ZellerG_2014.relative_abundance', dryrun=F)
  xx[[1]] %>% as.mpse -> mpse
  otu.tree <- mpse %>% 
    mp_aggregate_clade(
      .abundance = Abundance, 
      force = TRUE, 
      relative = FALSE,
      action = 'get' # other option is 'add' or 'only'.
    )
  otu.tree

## End(Not run)

xiangpin/MicrobitaProcess documentation built on April 12, 2024, 9:03 p.m.