| trans_nullmodel | R Documentation |
trans_nullmodel object for null model related analysis.This class is a wrapper for a series of null model related approaches, including the mantel correlogram analysis of phylogenetic signal, beta nearest taxon index (betaNTI), beta net relatedness index (betaNRI), NTI, NRI and RCbray (Raup–Crick Bray–Curtis) calculations. See <doi:10.1111/j.1600-0587.2010.06548.x; 10.1890/ES10-00117.1; 10.1038/ismej.2013.93; 10.1038/s41598-017-17736-w> for the algorithms and applications.
new()trans_nullmodel$new( dataset = NULL, filter_thres = 0, taxa_number = NULL, group = NULL, select_group = NULL, env_cols = NULL, add_data = NULL, complete_na = FALSE )
datasetthe object of microtable Class.
filter_thresdefault 0; the relative abundance threshold.
taxa_numberdefault NULL; how many taxa the user want to keep, if provided, filter_thres parameter will be forcible invalid.
groupdefault NULL; which column name in sample_table is selected as the group for the following selection.
select_groupdefault NULL; one or more elements in group, used to select samples.
env_colsdefault NULL; number or name vector to select the environmental data in dataset$sample_table.
add_datadefault NULL; provide environmental data table additionally.
complete_nadefault FALSE; whether fill the NA in environmental data based on the method in mice package.
data_comm and data_tree in object.
data(dataset) data(env_data_16S) t1 <- trans_nullmodel$new(dataset, filter_thres = 0.0005, add_data = env_data_16S)
cal_mantel_corr()Calculate mantel correlogram.
trans_nullmodel$cal_mantel_corr( use_env = NULL, break.pts = seq(0, 1, 0.02), cutoff = FALSE, ... )
use_envdefault NULL; numeric or character vector to select env_data; if provide multiple variables or NULL, use PCA (principal component analysis) to reduce dimensionality.
break.ptsdefault seq(0, 1, 0.02); see break.pts parameter in mantel.correlog of vegan package.
cutoffdefault FALSE; see cutoff parameter in mantel.correlog.
...parameters pass to mantel.correlog function in vegan package.
res_mantel_corr in object.
\dontrun{
t1$cal_mantel_corr(use_env = "pH")
}
plot_mantel_corr()Plot mantel correlogram.
trans_nullmodel$plot_mantel_corr(point_shape = 22, point_size = 3)
point_shapedefault 22; the number for selecting point shape type; see ggplot2 manual for the number meaning.
point_sizedefault 3; the point size.
ggplot.
\dontrun{
t1$plot_mantel_corr()
}
cal_betampd()Calculate betaMPD (mean pairwise distance). Same with picante::comdist function, but faster.
trans_nullmodel$cal_betampd(abundance.weighted = TRUE)
abundance.weighteddefault TRUE; whether use abundance-weighted method.
res_betampd in object.
\donttest{
t1$cal_betampd(abundance.weighted = TRUE)
}
cal_betamntd()Calculate betaMNTD (mean nearest taxon distance). Same with picante::comdistnt function, but faster.
trans_nullmodel$cal_betamntd( abundance.weighted = TRUE, exclude.conspecifics = FALSE, use_iCAMP = FALSE, use_iCAMP_force = TRUE, iCAMP_tempdir = NULL, ... )
abundance.weighteddefault TRUE; whether use abundance-weighted method.
exclude.conspecificsdefault FALSE; see exclude.conspecifics parameter in comdistnt function of picante package.
use_iCAMPdefault FALSE; whether use bmntd.big function of iCAMP package to calculate betaMNTD.
This method can store the phylogenetic distance matrix on the disk to lower the memory spending and perform the calculation parallelly.
use_iCAMP_forcedefault FALSE; whether use bmntd.big function of iCAMP package automatically when the feature number is large.
iCAMP_tempdirdefault NULL; the temporary directory used to place the large tree file; If NULL; use the system user tempdir.
...paremeters pass to iCAMP::pdist.big function.
res_betamntd in object.
\donttest{
t1$cal_betamntd(abundance.weighted = TRUE)
}
cal_ses_betampd()Calculate standardized effect size of betaMPD, i.e. beta net relatedness index (betaNRI).
trans_nullmodel$cal_ses_betampd(
runs = 1000,
null.model = c("taxa.labels", "richness", "frequency", "sample.pool", "phylogeny.pool",
"independentswap", "trialswap")[1],
abundance.weighted = TRUE,
iterations = 1000
)runsdefault 1000; simulation runs.
null.modeldefault "taxa.labels"; The available options include "taxa.labels", "richness", "frequency", "sample.pool", "phylogeny.pool",
"independentswap"and "trialswap"; see null.model parameter of ses.mntd function in picante package for the algorithm details.
abundance.weighteddefault TRUE; whether use weighted abundance.
iterationsdefault 1000; iteration number for part null models to perform; see iterations parameter of picante::randomizeMatrix function.
res_ses_betampd in object.
\dontrun{
# only run 50 times for the example; default 1000
t1$cal_ses_betampd(runs = 50, abundance.weighted = TRUE)
}
cal_ses_betamntd()Calculate standardized effect size of betaMNTD, i.e. beta nearest taxon index (betaNTI).
trans_nullmodel$cal_ses_betamntd(
runs = 1000,
null.model = c("taxa.labels", "richness", "frequency", "sample.pool", "phylogeny.pool",
"independentswap", "trialswap")[1],
abundance.weighted = TRUE,
exclude.conspecifics = FALSE,
use_iCAMP = FALSE,
use_iCAMP_force = TRUE,
iCAMP_tempdir = NULL,
nworker = 2,
iterations = 1000
)runsdefault 1000; simulation number of null model.
null.modeldefault "taxa.labels"; The available options include "taxa.labels", "richness", "frequency", "sample.pool", "phylogeny.pool",
"independentswap"and "trialswap"; see null.model parameter of ses.mntd function in picante package for the algorithm details.
abundance.weighteddefault TRUE; whether use abundance-weighted method.
exclude.conspecificsdefault FALSE; see comdistnt in picante package.
use_iCAMPdefault FALSE; whether use bmntd.big function of iCAMP package to calculate betaMNTD. This method can store the phylogenetic distance matrix on the disk to lower the memory spending and perform the calculation parallelly.
use_iCAMP_forcedefault FALSE; whether to make use_iCAMP to be TRUE when the feature number is large.
iCAMP_tempdirdefault NULL; the temporary directory used to place the large tree file; If NULL; use the system user tempdir.
nworkerdefault 2; the CPU thread number.
iterationsdefault 1000; iteration number for part null models to perform; see iterations parameter of picante::randomizeMatrix function.
res_ses_betamntd in object.
\dontrun{
# only run 50 times for the example; default 1000
t1$cal_ses_betamntd(runs = 50, abundance.weighted = TRUE, exclude.conspecifics = FALSE)
}
cal_rcbray()Calculate Bray–Curtis-based Raup–Crick (RCbray) <doi: 10.1890/ES10-00117.1>.
trans_nullmodel$cal_rcbray( runs = 1000, verbose = TRUE, null.model = "independentswap" )
runsdefault 1000; simulation runs.
verbosedefault TRUE; whether show the calculation process message.
null.modeldefault "independentswap"; see more available options in randomizeMatrix function of picante package.
res_rcbray in object.
\dontrun{
# only run 50 times for the example; default 1000
t1$cal_rcbray(runs = 50)
}
cal_process()Infer the ecological processes according to ses.betaMNTD (betaNTI)/ses.betaMPD (betaNRI) and rcbray.
trans_nullmodel$cal_process(use_betamntd = TRUE, group = NULL)
use_betamntddefault TRUE; whether use ses.betaMNTD (betaNTI); if False, use ses.betaMPD (betaNRI).
groupdefault NULL; a column name in sample_table of microtable object. If provided, the analysis will be performed for each group instead of the whole.
res_process in object.
\dontrun{
t1$cal_process(use_betamntd = TRUE)
}
cal_NRI()Calculates Nearest Relative Index (NRI), equivalent to -1 times the standardized effect size of MPD.
trans_nullmodel$cal_NRI( null.model = "taxa.labels", abundance.weighted = FALSE, runs = 999, ... )
null.modeldefault "taxa.labels"; Null model to use; see null.model parameter in ses.mpd function of picante package for available options.
abundance.weighteddefault FALSE; Should mean nearest relative distances for each species be weighted by species abundance?
runsdefault 999; Number of randomizations.
...paremeters pass to ses.mpd function in picante package.
res_NRI in object, equivalent to -1 times ses.mpd.
\donttest{
# only run 50 times for the example; default 999
t1$cal_NRI(null.model = "taxa.labels", abundance.weighted = FALSE, runs = 50)
}
cal_NTI()Calculates Nearest Taxon Index (NTI), equivalent to -1 times the standardized effect size of MNTD.
trans_nullmodel$cal_NTI( null.model = "taxa.labels", abundance.weighted = FALSE, runs = 999, ... )
null.modeldefault "taxa.labels"; Null model to use; see null.model parameter in ses.mntd function of picante package for available options.
abundance.weighteddefault FALSE; Should mean nearest taxon distances for each species be weighted by species abundance?
runsdefault 999; Number of randomizations.
...paremeters pass to ses.mntd function in picante package.
res_NTI in object, equivalent to -1 times ses.mntd.
\donttest{
# only run 50 times for the example; default 999
t1$cal_NTI(null.model = "taxa.labels", abundance.weighted = TRUE, runs = 50)
}
cal_Cscore()Calculates the (normalised) mean number of checkerboard combinations (C-score) using C.score function in bipartite package.
trans_nullmodel$cal_Cscore(by_group = NULL, ...)
by_groupdefault NULL; one column name or number in sample_table; calculate C-score for different groups separately.
...paremeters pass to bipartite::C.score function.
vector.
\dontrun{
t1$cal_Cscore(normalise = FALSE)
t1$cal_Cscore(by_group = "Group", normalise = FALSE)
}
cal_NST()Calculate normalized stochasticity ratio (NST) based on the NST package.
trans_nullmodel$cal_NST(method = "tNST", group, ...)
methoddefault "tNST"; 'tNST' or 'pNST'. See the help document of tNST or pNST function in NST package for more details.
groupa colname of sample_table in microtable object;
the function can select the data from sample_table to generate a one-column (n x 1) matrix and
provide it to the group parameter of tNST or pNST function.
...paremeters pass to NST::tNST or NST::pNST function; see the document of corresponding function for more details.
res_NST stored in the object.
\dontrun{
t1$cal_NST(group = "Group", dist.method = "bray", output.rand = TRUE, SES = TRUE)
}
cal_NST_test()Test the significance of NST difference between each pair of groups.
trans_nullmodel$cal_NST_test(method = "nst.boot", ...)
methoddefault "nst.boot"; "nst.boot" or "nst.panova"; see NST::nst.boot function or NST::nst.panova function for the details.
...paremeters pass to NST::nst.boot when method = "nst.boot" or NST::nst.panova when method = "nst.panova".
list. See the Return part of NST::nst.boot function or NST::nst.panova function in NST package.
\dontrun{
t1$cal_NST_test()
}
cal_NST_convert()Convert NST paired long format table to symmetric matrix form.
trans_nullmodel$cal_NST_convert(column = 10)
columndefault 10; which column is selected for the conversion. See the columns of res_NST$index.pair stored in the object.
symmetric matrix.
\dontrun{
t1$cal_NST_convert(column = 10)
}
clone()The objects of this class are cloneable with this method.
trans_nullmodel$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `trans_nullmodel$new`
## ------------------------------------------------
data(dataset)
data(env_data_16S)
t1 <- trans_nullmodel$new(dataset, filter_thres = 0.0005, add_data = env_data_16S)
## ------------------------------------------------
## Method `trans_nullmodel$cal_mantel_corr`
## ------------------------------------------------
## Not run:
t1$cal_mantel_corr(use_env = "pH")
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$plot_mantel_corr`
## ------------------------------------------------
## Not run:
t1$plot_mantel_corr()
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_betampd`
## ------------------------------------------------
t1$cal_betampd(abundance.weighted = TRUE)
## ------------------------------------------------
## Method `trans_nullmodel$cal_betamntd`
## ------------------------------------------------
t1$cal_betamntd(abundance.weighted = TRUE)
## ------------------------------------------------
## Method `trans_nullmodel$cal_ses_betampd`
## ------------------------------------------------
## Not run:
# only run 50 times for the example; default 1000
t1$cal_ses_betampd(runs = 50, abundance.weighted = TRUE)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_ses_betamntd`
## ------------------------------------------------
## Not run:
# only run 50 times for the example; default 1000
t1$cal_ses_betamntd(runs = 50, abundance.weighted = TRUE, exclude.conspecifics = FALSE)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_rcbray`
## ------------------------------------------------
## Not run:
# only run 50 times for the example; default 1000
t1$cal_rcbray(runs = 50)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_process`
## ------------------------------------------------
## Not run:
t1$cal_process(use_betamntd = TRUE)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_NRI`
## ------------------------------------------------
# only run 50 times for the example; default 999
t1$cal_NRI(null.model = "taxa.labels", abundance.weighted = FALSE, runs = 50)
## ------------------------------------------------
## Method `trans_nullmodel$cal_NTI`
## ------------------------------------------------
# only run 50 times for the example; default 999
t1$cal_NTI(null.model = "taxa.labels", abundance.weighted = TRUE, runs = 50)
## ------------------------------------------------
## Method `trans_nullmodel$cal_Cscore`
## ------------------------------------------------
## Not run:
t1$cal_Cscore(normalise = FALSE)
t1$cal_Cscore(by_group = "Group", normalise = FALSE)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_NST`
## ------------------------------------------------
## Not run:
t1$cal_NST(group = "Group", dist.method = "bray", output.rand = TRUE, SES = TRUE)
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_NST_test`
## ------------------------------------------------
## Not run:
t1$cal_NST_test()
## End(Not run)
## ------------------------------------------------
## Method `trans_nullmodel$cal_NST_convert`
## ------------------------------------------------
## Not run:
t1$cal_NST_convert(column = 10)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.