Create trans_nullmodel object for phylogeny- and taxonomy-based null model 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 calculations; See Stegen et al. (2013) <10.1038/ismej.2013.93> and Liu et al. (2017) <doi: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 )
dataset
the object of microtable
Class.
filter_thres
default 0; the relative abundance threshold.
taxa_number
default NULL; how many taxa the user want to keep, if provided, filter_thres parameter will be forcible invalid.
group
default NULL; which group column name in sample_table is selected.
select_group
default NULL; the group name, used following the group to filter samples.
env_cols
default NULL; number or name vector to select the environmental data in dataset$sample_table.
add_data
default NULL; provide environmental data table additionally.
complete_na
default 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_env
default NULL; numeric or character vector to select env_data; if provide multiple variables or NULL, use PCA (principal component analysis) to reduce dimensionality.
break.pts
default seq(0, 1, 0.02); see break.pts parameter in mantel.correlog
of vegan package.
cutoff
default FALSE; see cutoff parameter in mantel.correlog
.
...
parameters pass to mantel.correlog
res_mantel_corr in object.
\donttest{ 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_shape
default 22; the number for selecting point shape type; see ggplot2 manual for the number meaning.
point_size
default 3; the point size.
ggplot.
\donttest{ t1$plot_mantel_corr() }
cal_betampd()
Calculate betaMPD (mean pairwise distance). Same with comdist in picante package, but faster.
trans_nullmodel$cal_betampd(abundance.weighted = TRUE)
abundance.weighted
default 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 comdistnt in picante package, but faster.
trans_nullmodel$cal_betamntd( abundance.weighted = TRUE, exclude.conspecifics = FALSE, use_iCAMP = FALSE, use_iCAMP_force = TRUE, iCAMP_tempdir = NULL, ... )
abundance.weighted
default TRUE; whether use abundance-weighted method.
exclude.conspecifics
default FALSE; see exclude.conspecifics parameter in comdistnt function of picante package.
use_iCAMP
default 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_force
default FALSE; whether use bmntd.big function of iCAMP package automatically when the feature number is large.
iCAMP_tempdir
default 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 )
runs
default 1000; simulation runs.
null.model
default "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.weighted
default TRUE; whether use weighted abundance.
iterations
default 1000; iteration number for part null models to perform; see iterations parameter of picante::randomizeMatrix function.
res_ses_betampd in object.
\donttest{ # 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 )
runs
default 1000; simulation number of null model.
null.model
default "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.weighted
default TRUE; whether use abundance-weighted method.
exclude.conspecifics
default FALSE; see comdistnt in picante package.
use_iCAMP
default 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_force
default FALSE; whether to make use_iCAMP to be TRUE when the feature number is large.
iCAMP_tempdir
default NULL; the temporary directory used to place the large tree file; If NULL; use the system user tempdir.
nworker
default 2; the CPU thread number.
iterations
default 1000; iteration number for part null models to perform; see iterations parameter of picante::randomizeMatrix function.
res_ses_betamntd in object.
\donttest{ # 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).
trans_nullmodel$cal_rcbray( runs = 1000, verbose = TRUE, null.model = "independentswap" )
runs
default 1000; simulation runs.
verbose
default TRUE; whether show the calculation process message.
null.model
default "independentswap"; see more available options in randomizeMatrix function of picante package.
res_rcbray in object.
\donttest{ # run 50 times for the example; default 1000 t1$cal_rcbray(runs = 50) }
cal_process()
Infer the ecological processes according to ses.betaMNTD ses.betaMPD and rcbray.
trans_nullmodel$cal_process(use_betamntd = TRUE)
use_betamntd
default TRUE; whether use ses.betaMNTD; if false, use ses.betaMPD.
res_rcbray in object.
\donttest{ 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.model
default "taxa.labels"; Null model to use; see null.model parameter in ses.mpd function of picante package for available options.
abundance.weighted
default FALSE; Should mean nearest relative distances for each species be weighted by species abundance?
runs
default 999; Number of randomizations.
...
paremeters pass to ses.mpd function in picante package.
res_NRI in object, equivalent to -1 times ses.mpd.
\donttest{ t1$cal_NRI() }
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.model
default "taxa.labels"; Null model to use; see null.model parameter in ses.mntd function of picante package for available options.
abundance.weighted
default FALSE; Should mean nearest taxon distances for each species be weighted by species abundance?
runs
default 999; Number of randomizations.
...
paremeters pass to ses.mntd function in picante package.
res_NTI in object, equivalent to -1 times ses.mntd.
\donttest{ t1$cal_NTI(null.model = "taxa.labels", abundance.weighted = TRUE) }
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_group
default NULL; one column name or number in sample_table; calculate C-score for different groups separately.
...
paremeters pass to C.score function in bipartite package.
results directly.
\donttest{ t1$cal_Cscore() }
cal_tNST()
Calculate normalized stochasticity ratio (NST) based on the tNST function of NST package.
trans_nullmodel$cal_tNST(group, ...)
group
a colname of sample_table; 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 function.
...
paremeters pass to tNST function of NST package; see the documents of tNST function for more details.
.
\donttest{ t1$cal_tNST(group = "Group", dist.method = "bray", output.rand = TRUE, SES = TRUE) }
cal_tNST_test()
Test the significance of NST difference between each pair of groups.
trans_nullmodel$cal_tNST_test(method = "nst.boot", ...)
method
default "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"
.
\donttest{ t1$cal_tNST_test() }
clone()
The objects of this class are cloneable with this method.
trans_nullmodel$clone(deep = FALSE)
deep
Whether 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` ## ------------------------------------------------ t1$cal_mantel_corr(use_env = "pH") ## ------------------------------------------------ ## Method `trans_nullmodel$plot_mantel_corr` ## ------------------------------------------------ t1$plot_mantel_corr() ## ------------------------------------------------ ## 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` ## ------------------------------------------------ # run 50 times for the example; default 1000 t1$cal_ses_betampd(runs = 50, abundance.weighted = TRUE) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_ses_betamntd` ## ------------------------------------------------ # run 50 times for the example; default 1000 t1$cal_ses_betamntd(runs = 50, abundance.weighted = TRUE, exclude.conspecifics = FALSE) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_rcbray` ## ------------------------------------------------ # run 50 times for the example; default 1000 t1$cal_rcbray(runs = 50) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_process` ## ------------------------------------------------ t1$cal_process(use_betamntd = TRUE) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_NRI` ## ------------------------------------------------ t1$cal_NRI() ## ------------------------------------------------ ## Method `trans_nullmodel$cal_NTI` ## ------------------------------------------------ t1$cal_NTI(null.model = "taxa.labels", abundance.weighted = TRUE) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_Cscore` ## ------------------------------------------------ t1$cal_Cscore() ## ------------------------------------------------ ## Method `trans_nullmodel$cal_tNST` ## ------------------------------------------------ t1$cal_tNST(group = "Group", dist.method = "bray", output.rand = TRUE, SES = TRUE) ## ------------------------------------------------ ## Method `trans_nullmodel$cal_tNST_test` ## ------------------------------------------------ t1$cal_tNST_test()
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.