mp_diff_clade-methods: Differential internal and tip nodes (clades) analysis for...

mp_diff_cladeR Documentation

Differential internal and tip nodes (clades) analysis for MPSE or tbl_mpse object

Description

Differential internal and tip nodes (clades) analysis for MPSE or tbl_mpse object

Usage

mp_diff_clade(
  .data,
  .abundance,
  .group,
  .sec.group = NULL,
  action = "add",
  force = FALSE,
  relative = TRUE,
  first.test.method = "kruskal.test",
  first.test.alpha = 0.05,
  p.adjust = "fdr",
  filter.p = "fdr",
  strict = TRUE,
  fc.method = "generalizedFC",
  second.test.method = "wilcox.test",
  second.test.alpha = 0.05,
  cl.min = 5,
  cl.test = TRUE,
  subcl.min = 3,
  subcl.test = TRUE,
  ml.method = "lda",
  normalization = 1e+06,
  ldascore = 2,
  bootnums = 30,
  sample.prop.boot = 0.7,
  ci = 0.95,
  seed = 123,
  type = "species",
  ...
)

## S4 method for signature 'MPSE'
mp_diff_clade(
  .data,
  .abundance,
  .group,
  .sec.group = NULL,
  action = "add",
  force = FALSE,
  relative = TRUE,
  first.test.method = "kruskal.test",
  first.test.alpha = 0.05,
  p.adjust = "fdr",
  filter.p = "fdr",
  strict = TRUE,
  fc.method = "generalizedFC",
  second.test.method = "wilcox.test",
  second.test.alpha = 0.05,
  cl.min = 5,
  cl.test = TRUE,
  subcl.min = 3,
  subcl.test = TRUE,
  ml.method = "lda",
  normalization = 1e+06,
  ldascore = 2,
  bootnums = 30,
  sample.prop.boot = 0.7,
  ci = 0.95,
  seed = 123,
  type = "species",
  ...
)

## S4 method for signature 'tbl_mpse'
mp_diff_clade(
  .data,
  .abundance,
  .group,
  .sec.group = NULL,
  action = "add",
  force = FALSE,
  relative = TRUE,
  first.test.method = "kruskal.test",
  first.test.alpha = 0.05,
  p.adjust = "fdr",
  filter.p = "fdr",
  strict = TRUE,
  fc.method = "generalizedFC",
  second.test.method = "wilcox.test",
  second.test.alpha = 0.05,
  cl.min = 5,
  cl.test = TRUE,
  subcl.min = 3,
  subcl.test = TRUE,
  ml.method = "lda",
  normalization = 1e+06,
  ldascore = 2,
  bootnums = 30,
  sample.prop.boot = 0.7,
  ci = 0.95,
  seed = 123,
  type = "species",
  ...
)

## S4 method for signature 'grouped_df_mpse'
mp_diff_clade(
  .data,
  .abundance,
  .group,
  .sec.group = NULL,
  action = "add",
  force = FALSE,
  relative = TRUE,
  first.test.method = "kruskal.test",
  first.test.alpha = 0.05,
  p.adjust = "fdr",
  filter.p = "fdr",
  strict = TRUE,
  fc.method = "generalizedFC",
  second.test.method = "wilcox.test",
  second.test.alpha = 0.05,
  cl.min = 5,
  cl.test = TRUE,
  subcl.min = 3,
  subcl.test = TRUE,
  ml.method = "lda",
  normalization = 1e+06,
  ldascore = 2,
  bootnums = 30,
  sample.prop.boot = 0.7,
  ci = 0.95,
  seed = 123,
  type = "species",
  ...
)

Arguments

.data

MPSE or tbl_mpse object

.abundance

the name of abundance to be calculated

.group

the group name of the samples to be calculated.

.sec.group

the second group name of the samples to be calculated.

action

character, "add" joins the new information to the taxatree (if it exists) and otutree (if it exists) or rowData and return MPSE object,"only" return a non-redundant tibble with the result of different analysis. "get" return 'diffAnalysisClass' object.

force

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

relative

logical whether calculate the relative abundance, default is TRUE.

first.test.method

the method for first test, option is "kruskal.test", "oneway.test", "lm", "glm", or "glm.nb", "kruskal_test", "oneway_test" of "coin" package. default is "kruskal.test".

first.test.alpha

numeric the alpha value for the first test, default is 0.05.

p.adjust

character the correction method, default is "fdr", see also p.adjust function default is fdr.

filter.p

character the method to filter pvalue, default is fdr, meanings the features that fdr <= .first.test.alpha will be kept, if it is set to pvalue, meanings the features that pvalue <= .first.test.alpha will be kept.

strict

logical whether to performed in one-against-one when .sec.group is provided, default is TRUE (strict).

fc.method

character the method to check which group has more abundance for the significantly different features, default is "generalizedFC", options are generalizedFC, compare_median, compare_mean.

second.test.method

the method for one-against-one (the second test), default is "wilcox.test" other option is one of 'wilcox_test' of 'coin'; 'glm'; 'glm.nb' of 'MASS'.

second.test.alpha

numeric the alpha value for the second test, default is 0.05.

cl.min

integer the minimum number of samples per group for performing test, default is 5.

cl.test

logical whether to perform test (second test) between the groups (the number of sample of the .group should be also larger that cl.min), default is TRUE.

subcl.min

integer the minimum number of samples in each second groups for performing test, default is 3.

subcl.test

logical whether to perform test for between the second groups (the .sec.group should be provided and the number sample of each .sec.group should be larger than subcl.min, and strict is TRUE), default is TRUE.

ml.method

the method for calculating the effect size of features, option is 'lda' or 'rf'. default is 'lda'.

normalization

integer set a big number if to get more meaningful values for the LDA score, or you can set NULL for no normalization, default is 1000000.

ldascore

numeric the threshold on the absolute value of the logarithmic LDA score, default is 2.

bootnums

integer, set the number of bootstrap iteration for lda or rf, default is 30.

sample.prop.boot

numeric range from 0 to 1, the proportion of samples for calculating the effect size of features, default is 0.7.

ci

numeric, the confidence interval of effect size (LDA or MDA), default is 0.95.

seed

a random seed to make the analysis reproducible, default is 123.

type

character type="species" meaning the abundance matrix is from the species abundance, other option is "others", default is "species".

...

additional parameters

Value

update object according to the action argument.

Author(s)

Shuangbin Xu

Examples

## Not run: 
  suppressPackageStartupMessages(library(curatedMetagenomicData))
  xx <- curatedMetagenomicData('ZellerG_2014.relative_abundance', dryrun=F)
  xx[[1]] %>% as.mpse -> mpse
  mpse.agg.clade <- mpse %>%
    mp_aggregate_clade(
      .abundance = Abundance,
      force = TRUE,
      relative = FALSE,
      action = 'add' # other option is 'get' or 'only'.
    )
  mpse.agg.clade %>% mp_diff_clade(
      .abundance = Abundance,
      force = TRUE,
      relative = FALSE,
      .group = disease,
      fc.method = "compare_mean"
    ) %>%
  mp_extract_otutree() %>%
  dplyr::filter(!is.na(Sign_disease), keep.td = FALSE)

## End(Not run)

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