| trans_multiomics | R Documentation |
This class is a wrapper for microbiome multi-omics data integration analysis based on the mixOmics package
<doi:10.1371/journal.pcbi.1005752>. It integrates multiple microtable objects (e.g. microbiome and metabolome data)
and provides methods for data preprocessing, supervised/unsupervised multi-block integration (DIABLO, sPLS),
parameter tuning, model evaluation, feature extraction and visualization.
The core integration models are powered by mixOmics functions such as
block.splsda (DIABLO), block.spls and spls.
new()Create the trans_multiomics object.
The function receives multiple microtable objects and automatically aligns samples
(intersection of sample names across all microtable objects) to ensure the matrices are compatible
for multi-omics integration.
trans_multiomics$new(microtables = NULL, group = NULL, group_col = "Group")
microtablesdefault NULL; a named list of microtable objects (e.g. list(microb = soil_microb, metab = soil_metab)),
or a single microtable object. The names of the list are used as the omics block names.
groupdefault NULL; a factor or character vector indicating the group membership of each sample.
If NULL, the function extracts the group from group_col column of sample_table in the first microtable.
group_coldefault "Group"; the column name in sample_table used to extract the group factor when group is NULL.
self (invisible), enabling chained calls; dataset_list, data_list_names and Y are stored in the object.
\dontrun{
data(soil_microb)
data(soil_metab)
t1 <- trans_multiomics$new(
microtables = list(microb = soil_microb, metab = soil_metab),
group_col = "Group"
)
}
preprocess_data()Preprocess the data: filter low-abundance features and apply normalization/transformation.
This function reuses the trans_norm class to apply normalization methods (e.g. CLR)
to each omics block. The processed matrices (rows are samples, columns are features) are stored
in data_list for mixOmics input.
trans_multiomics$preprocess_data( method = "clr", pseudocount = 1, filter_thres = NULL, filter_freq = 1, ... )
methoddefault "clr"; the normalization method passed to trans_norm$norm.
Available options include "clr", "rclr", "css", "tss", "log", etc.
See the method parameter of trans_norm class for details.
pseudocountdefault 1; add pseudocount for zero values when method = "clr".
filter_thresdefault NULL; the relative abundance threshold for filtering low-abundance features.
Passed to rel_abund parameter of microtable$filter_taxa. NULL means no filtering.
filter_freqdefault 1; the occurrence frequency threshold for filtering features.
Passed to freq parameter of microtable$filter_taxa.
...other parameters passed to norm method of trans_norm class.
self (invisible), enabling chained calls; data_list is stored in the object.
\dontrun{
t1$preprocess_data(method = "clr", filter_thres = 0.0001, filter_freq = 0.2)
}
set_design()Set the design matrix for DIABLO analysis.
The design matrix defines the weights of correlation between different omics blocks. A full design (weight = 1) maximizes the covariance between blocks, while a small weight (e.g. 0.1) favors classification accuracy.
trans_multiomics$set_design(design = NULL, weight = 0.1)
designdefault NULL; a user-specified design matrix. If NULL, a matrix filled with
weight (with 0 on the diagonal) is created.
weightdefault 0.1; the off-diagonal weight when design is NULL.
self (invisible), enabling chained calls; design is stored in the object.
\dontrun{
t1$set_design(weight = 0.1)
}
run_diablo()Run supervised multi-omics integration using DIABLO (block.sPLS-DA).
This function wraps mixOmics::block.splsda to perform supervised multi-block sparse PLS-DA.
It is suitable when the user has a clear grouping variable and wants to identify cross-omics
features that discriminate between groups.
trans_multiomics$run_diablo( ncomp = 2, keepX = NULL, design = NULL, scale = TRUE, ... )
ncompdefault 2; the number of components.
keepXdefault NULL; a list of variable numbers to select per block per component.
If NULL, all features are retained (full model). Example: list(microb = c(10, 10), metab = c(15, 15)).
designdefault NULL; the design matrix. If NULL, use self$design; if still NULL, create with set_design().
scaledefault TRUE; whether to scale the data.
...other parameters passed to mixOmics::block.splsda.
self (invisible), enabling chained calls; model is stored in the object.
\dontrun{
t1$run_diablo(ncomp = 2, keepX = list(microb = c(10, 10), metab = c(15, 15)))
}
run_spls()Run unsupervised multi-omics integration using block.sPLS.
This function wraps mixOmics::block.spls to perform unsupervised multi-block sparse PLS.
It is suitable when there is no grouping variable and the user wants to explore the covariance
structure across multiple omics data sets.
Note that mixOmics::block.spls requires a numeric response matrix, so one omics block
must be designated as the response block through the Y_block parameter (passed to indY).
trans_multiomics$run_spls( ncomp = 2, Y_block = NULL, keepX = NULL, design = NULL, mode = "regression", scale = TRUE, ... )
ncompdefault 2; the number of components.
Y_blockdefault NULL; the index or name of the omics block used as the response (indY).
If NULL, the last block in data_list is used.
keepXdefault NULL; a list of variable numbers to select per block per component (including the response block,
as mixOmics ignores keepY when indY is used). If NULL, all features are retained (full model).
designdefault NULL; the design matrix. If NULL, use self$design; if still NULL, create with set_design().
modedefault "regression"; the PLS mode. One of "regression", "canonical", "invariant", "classic".
scaledefault TRUE; whether to scale the data.
...other parameters passed to mixOmics::block.spls.
self (invisible), enabling chained calls; model is stored in the object.
\dontrun{
t1$run_spls(ncomp = 2, Y_block = "metab", mode = "regression")
}
run_spls_single()Run two-omics sPLS (sparse PLS) regression for unsupervised association analysis.
This function wraps mixOmics::spls to perform sparse PLS between two omics blocks.
It is useful for exploring the covariation between two data sets (e.g. microbiome and metabolome).
trans_multiomics$run_spls_single( X_block = 1, Y_block = 2, ncomp = 2, mode = "regression", keepX = NULL, keepY = NULL, scale = TRUE, ... )
X_blockdefault 1; the index or name of the X block in data_list.
Y_blockdefault 2; the index or name of the Y block in data_list.
ncompdefault 2; the number of components.
modedefault "regression"; the PLS mode.
keepXdefault NULL; the number of variables to select in X per component.
keepYdefault NULL; the number of variables to select in Y per component.
scaledefault TRUE; whether to scale the data.
...other parameters passed to mixOmics::spls.
self (invisible), enabling chained calls; model is stored in the object.
\dontrun{
t1$run_spls_single(X_block = "microb", Y_block = "metab", ncomp = 2)
}
tune_model()Tune the DIABLO model to select the optimal number of variables to select (keepX).
This function wraps mixOmics::tune.block.splsda (or tune.block.spls) to perform
cross-validation and identify the optimal keepX per block per component.
The optimal parameters are stored in best_keepX for use in the final model.
trans_multiomics$tune_model( method = "block.splsda", ncomp = 2, test_keepX = NULL, folds = 10, nrepeat = 1, dist = "centroids.dist", seed = NULL, ... )
methoddefault "block.splsda"; the tuning method. Currently only "block.splsda" is supported,
as mixOmics provides no tune function for unsupervised block.spls.
ncompdefault 2; the number of components to tune.
test_keepXdefault NULL; a list of candidate keepX values per block. If NULL, an adaptive grid (5%, 10% and 20% of the feature number of each block) is used.
foldsdefault 10; the number of folds for cross-validation.
Must not exceed the smallest class size of Y.
nrepeatdefault 1; the number of repeats. Increase to 10-50 for robust results.
distdefault "centroids.dist"; the prediction distance for DA methods.
seeddefault NULL; an integer used to set the random seed before cross-validation for reproducible results.
...other parameters passed to mixOmics::tune.block.splsda.
self (invisible), enabling chained calls; tune_result and best_keepX are stored in the object.
\dontrun{
t1$tune_model(ncomp = 2, test_keepX = list(microb = c(5, 10, 20),
metab = c(5, 10, 20)), seed = 123)
}
eval_performance()Evaluate the performance of the model using cross-validation.
This function wraps mixOmics::perf to assess the classification error rate (BER) or
prediction performance of the model.
trans_multiomics$eval_performance( method = "Mfold", folds = 10, nrepeat = 1, seed = NULL, ... )
methoddefault "Mfold"; the cross-validation method. "Mfold" or "loo".
foldsdefault 10; the number of folds (when method = "Mfold").
Must not exceed the smallest class size of Y.
nrepeatdefault 1; the number of repeats.
seeddefault NULL; an integer used to set the random seed before cross-validation for reproducible results.
...other parameters passed to mixOmics::perf.
self (invisible), enabling chained calls; perf_result is stored in the object.
\dontrun{
t1$eval_performance(folds = 5, nrepeat = 1, seed = 123)
}
get_features()Extract the selected features (variables with non-zero loadings) from the model.
This function wraps mixOmics::selectVar to extract the selected variables on a given
component, and returns a tidy data.frame with feature names, block, component and loading values.
trans_multiomics$get_features(comp = 1, block = NULL)
compdefault 1; the component of interest.
blockdefault NULL; the block(s) to extract. NULL means all blocks. Can be integer index or block name.
res_features stored in the object and returned.
\dontrun{
features <- t1$get_features(comp = 1)
}
get_correlation()Extract the correlation/similarity matrix between selected variables from the model.
This function uses the internal similarity computation of the model to derive a correlation matrix between selected variables across blocks. The result can be used for external network analysis or pathway enrichment.
trans_multiomics$get_correlation(comp = 1, block = NULL, cutoff = NULL)
compdefault 1; the component(s) used to compute the similarity (identical across all blocks).
blockdefault NULL; the block(s) to include. NULL means all blocks.
cutoffdefault NULL; only show correlations with absolute value above this threshold.
res_correlation stored in the object and returned.
\dontrun{
cor_mat <- t1$get_correlation(comp = 1, cutoff = 0.7)
}
get_stability()Extract the feature selection stability from the cross-validation results.
This function summarizes how often each feature was selected across the cross-validation
folds and repeats (stored in perf_result$features$stable of mixOmics::perf).
Features with high stability (close to 1) are robust biomarker candidates, while features
with low stability may be artifacts of a particular data split.
trans_multiomics$get_stability(comp = NULL)
compdefault NULL; the component(s) to extract. NULL means all components.
res_stability stored in the object and returned; a tidy data.frame with columns
Feature, Block, Comp and Stability (mean selection frequency across folds and repeats).
\dontrun{
t1$eval_performance(folds = 5, nrepeat = 10, seed = 123)
stab <- t1$get_stability()
}
plot_samples()Plot the samples projected onto the latent components.
This function wraps mixOmics::plotIndiv with style = "ggplot2" to visualize
the clustering of samples in the latent space. The returned object is a ggplot object that
can be further customized with + theme_xx().
trans_multiomics$plot_samples( comp = c(1, 2), group = NULL, blocks = "average", ellipse = FALSE, legend = TRUE, ... )
compdefault c(1, 2); the components on the x and y axes.
groupdefault NULL; the group factor for coloring. If NULL, use self$Y.
blocksdefault "average"; which blocks to display. "average" for consensus, or block index/name.
ellipsedefault FALSE; whether to add ellipses.
legenddefault TRUE; whether to show the legend.
...other parameters passed to mixOmics::plotIndiv.
a ggplot object.
\dontrun{
p <- t1$plot_samples(comp = c(1, 2), ellipse = TRUE)
}
plot_loadings()Plot the loading weights of selected variables.
This function wraps mixOmics::plotLoadings with style = "ggplot2" to visualize
the contribution of selected variables on a given component.
trans_multiomics$plot_loadings(comp = 1, block = NULL, ...)
compdefault 1; the component to plot.
blockdefault NULL; the block to display. NULL means the first block.
...other parameters passed to mixOmics::plotLoadings.
a ggplot object.
\dontrun{
p <- t1$plot_loadings(comp = 1, block = "microb")
}
plot_cor_network()Plot the relevance network showing correlations between variables across blocks.
This function wraps mixOmics::network to display the relevance network of selected
variables. The network data is also stored in res_network for potential bridging with
the trans_network class.
trans_multiomics$plot_cor_network(comp = 1, cutoff = 0.7, block = NULL, ...)
compdefault 1; the component used to compute the similarity (identical across all blocks).
cutoffdefault 0.7; only show edges with absolute correlation above this threshold.
blockdefault NULL; the block(s) to include.
...other parameters passed to mixOmics::network.
the network result (invisibly), with res_network stored.
\dontrun{
t1$plot_cor_network(comp = 1, cutoff = 0.7)
}
plot_circos()Plot the circos plot showing correlations between selected variables across blocks.
This function wraps mixOmics::circosPlot to display a circos visualization of the
correlations between selected variables from different blocks.
trans_multiomics$plot_circos(comp = 1, cutoff = 0.7, ...)
compdefault 1; the component(s) to display.
cutoffdefault 0.7; only show links with absolute correlation above this threshold.
...other parameters passed to mixOmics::circosPlot.
the circos plot result (invisibly).
\dontrun{
t1$plot_circos(comp = 1, cutoff = 0.7)
}
plot_diablo()Plot the diagnostic plot for DIABLO showing the correlation between components of each block.
This function wraps mixOmics::plotDiablo to check whether the correlations between
components from each data set were maximized as specified in the design matrix.
trans_multiomics$plot_diablo(ncomp = 1, ...)
ncompdefault 1; the dimension to be assessed.
...other parameters passed to mixOmics::plotDiablo.
the plot (invisibly).
\dontrun{
t1$plot_diablo(ncomp = 1)
}
plot_heatmap()Plot the clustered image map (heatmap) of selected variables.
This function wraps mixOmics::cimDiablo to display a clustered image map (CIM) of
the selected variables across blocks.
trans_multiomics$plot_heatmap(comp = 1, ...)
compdefault 1; the component(s) to display.
...other parameters passed to mixOmics::cimDiablo.
the CIM result (invisibly).
\dontrun{
t1$plot_heatmap(comp = 1)
}
cal_transkingdom()Build a trans-kingdom (cross-omics) association network following the TkNA framework.
This function implements a lightweight Transkingdom Network Analysis (TkNA) workflow:
(1) reduce nodes by differential filtering within each omics block (when Y is available),
(2) build a cross-block (bipartite) association network from correlations between features of
different blocks, and (3) compute the Bipartite Betweenness Centrality (BiBC) to identify
cross-omics hub nodes that are most likely to mediate the interactions between omics layers.
Confounders (age, BMI, batch, ...) can be regressed out from all features before computing
the associations (MaAsLin2-style marginal models) to reduce spurious cross-layer edges.
The resulting network provides testable mechanistic hypotheses rather than causal conclusions; prioritized hubs/edges should be validated with independent cohorts or perturbation experiments.
trans_multiomics$cal_transkingdom( corr_method = "spearman", corr_thres = 0.6, p_thres = 0.05, p_adjust = "BH", diff_test = "kruskal", diff_p = 0.05, covariates = NULL, blocks = NULL, hub_quantile = 0.9 )
corr_methoddefault "spearman"; the association method, "spearman" or "pearson".
The data in data_list must be compositional-transformed (e.g. CLR via preprocess_data)
before entering correlation-based network analysis.
corr_thresdefault 0.6; the minimal absolute correlation to retain an edge.
p_thresdefault 0.05; the maximal adjusted p value to retain an edge.
p_adjustdefault "BH"; the p value adjustment method used for both the differential filtering (within each block) and the correlation testing (across all cross-block pairs).
diff_testdefault "kruskal"; the differential test for node filtering: "kruskal" (Kruskal-Wallis rank sum test, any number of groups), "aov" (one-way ANOVA) or "wilcox" (Wilcoxon rank sum test, exactly 2 groups). Use NULL to skip differential filtering.
diff_pdefault 0.05; the adjusted p value threshold of the differential filtering.
covariatesdefault NULL; a data.frame of confounders (rows are samples with rownames matching the sample names) to be regressed out from all features before computing correlations. NULL means no confounder adjustment.
blocksdefault NULL; the blocks to include (block names or indices). NULL means all blocks.
hub_quantiledefault 0.9; features with a BiBC above this quantile (among features with BiBC > 0) are flagged as cross-omics hubs.
self (invisible); the network is stored in res_transkingdom
(a list with graph, nodes and edges).
\dontrun{
t1$cal_transkingdom(corr_method = "spearman", corr_thres = 0.6, diff_test = "kruskal")
head(t1$res_transkingdom$nodes)
head(t1$res_transkingdom$edges)
}
plot_transkingdom()Plot the trans-kingdom (cross-omics) network from cal_transkingdom.
Nodes are colored by omics block and sized by BiBC (bipartite betweenness centrality);
edges are colored by the sign and strength of the correlation. Cross-omics hub features
(flagged by cal_transkingdom) are labeled by default. The returned object is a
ggplot object that can be further customized with + theme_xx().
trans_multiomics$plot_transkingdom(
label = "hub",
layout = "fr",
node_size_range = c(3, 8),
edge_colors = c("#B2182B", "#2166AC")
)labeldefault "hub"; which nodes to label: "hub" (only cross-omics hubs), "all" (all nodes) or "none".
layoutdefault "fr"; the node layout: "fr" (force-directed Fruchterman-Reingold, using the absolute correlations as attraction) or "circle".
node_size_rangedefault c(3, 8); the size range mapping BiBC to node size.
edge_colorsdefault c("#B2182B", "#2166AC"); colors for positive and negative correlations.
a ggplot object.
\dontrun{
t1$cal_transkingdom()
p <- t1$plot_transkingdom(label = "hub")
print(p)
}
convert_transkingdom()Convert the trans-kingdom network (result of cal_transkingdom) to a trans_network object.
This function bridges the trans-kingdom (cross-omics) network with the downstream network analyses of the
trans_network class, such as module detection (cal_module), node/edge property tables
(get_node_table/get_edge_table), network topological attributes (cal_network_attr),
sub-network extraction (subset_network), eigengene analysis (cal_eigen), random network
comparison (random_network) and network visualization (plot_network).
The conversion follows the conventions of correlation networks built by trans_network$cal_network:
the edge weight is re-defined as the absolute correlation and the edge label as the correlation sign
("+"/"-"); note that this differs from the distance-like weight (1 - |Corr|) temporarily used inside
cal_transkingdom for the BiBC computation. The node attributes (Block, Diff_p,
BiBC and Hub) are preserved, so they are reported in the node table of
get_node_table. The original (non-transformed) abundances of the network features are extracted
from dataset_list to fill data_abund (rows are samples), data_relabund (relative
abundance within each block, used as the "Abundance" of get_node_table) and sample_table;
the tax_table slots of all blocks are merged (union of the columns) to fill tax_table
when add_taxonomy = TRUE.
Note that the taxonomy-dependent functions of trans_network, e.g. cal_sum_links and
plot_sum_links, require a taxonomic column shared by all the involved blocks; for a bipartite
cross-omics network (e.g. microbe vs metabolite) such a column usually does not exist, so those
functions are not applicable unless the blocks use the same feature annotation.
trans_multiomics$convert_transkingdom( delete_unlinked_nodes = TRUE, add_taxonomy = TRUE )
delete_unlinked_nodesdefault TRUE; whether delete the nodes without any link,
same with the default of cal_network in trans_network class.
add_taxonomydefault TRUE; whether add the taxonomy information of the network features to the
returned object by merging the tax_table of all blocks (columns are unioned and missing
values are filled with NA). Use FALSE to skip, e.g. when the blocks have no meaningful tax_table.
a trans_network object; the network is stored in its res_network slot.
\dontrun{
t1$cal_transkingdom()
net1 <- t1$convert_transkingdom()
net1$cal_module()
net1$get_node_table()
net1$plot_network(method = "ggraph", node_color = "module")
}
cal_auroc()Compute the Area Under the ROC Curve (AUC) for the model.
This function wraps mixOmics::auroc to perform ROC analysis for supervised models.
trans_multiomics$cal_auroc(comp = 1, ...)
compdefault 1; the component to use for ROC analysis.
...other parameters passed to mixOmics::auroc.
the AUC result (invisibly).
\dontrun{
t1$cal_auroc(comp = 1)
}
run_mediation()Run mediation analysis bridging to the multimedia package.
This function is a thin wrapper around the multimedia package (Jiang et al. 2024,
<doi:10.1101/2024.03.27.587024>) to quantify the pathway "exposure -> mediator -> outcome",
e.g. microbes -> metabolites -> host phenotype. The high-dimensional blocks are taken from
data_list (compositional-transformed by preprocess_data); the exposure and the
outcome can alternatively be low-dimensional named vectors/factors (e.g. a treatment indicator
or a continuous phenotype). The result provides direct/indirect (mediation) effect estimates
that decompose the total effect, plus optional bootstrap confidence intervals.
Note that the "causal" interpretation of the mediation effects relies on the assumed ordering
of the chain and remains observational; validation with longitudinal or perturbation data is
recommended. Variable names are replaced internally by syntactically valid names (V1, V2, ...)
because multimedia builds R formulas from the variable names; the original names are restored
in the returned effect tables (the mapping is stored in res_mediation$name_map).
trans_multiomics$run_mediation( exposure, mediator, outcome, model = "glmnet", features = NULL, max_features = NULL, covariates = NULL, n_boot = 0 )
exposurethe exposure (treatment): either the name of one omics block in
data_list_names (high-dimensional), or a named numeric vector/factor whose names match
the sample names (low-dimensional, e.g. the grouping factor).
mediatorthe name of the omics block acting as the mediator (e.g. "metab").
outcomethe outcome: either the name of one omics block in data_list_names
(e.g. host transcriptome block), or a named numeric vector/2-level factor whose names match
the sample names.
modeldefault "glmnet"; the mediation/outcome model engine passed to multimedia:
"glmnet" (regularized regression, recommended for high-dimensional blocks),
"lm" (linear model, only for low-dimensional exposure) or "rf" (random forest).
featuresdefault NULL; an optional named list of feature subsets per block
(e.g. list(microb = c("m1", "m2"))), useful to focus on features selected by
get_features of a previous DIABLO analysis.
max_featuresdefault NULL; an optional cap on the number of features per block; when a block exceeds it, only the most variable features are kept.
covariatesdefault NULL; a data.frame of covariates (rows are samples with rownames
matching the sample names) passed to the pretreatments of multimedia.
n_bootdefault 0; the number of bootstrap resamples for confidence intervals. 0 skips the bootstrap (recommended for a first exploration; use 1000 for final results).
self (invisible); the result is stored in res_mediation.
\dontrun{
# microbes -> metabolites -> host phenotype
t1$run_mediation(exposure = "microb", mediator = "metab", outcome = pheno_vector,
model = "glmnet", n_boot = 200)
t1$res_mediation$indirect_pathwise
}
export_bridge()Export feature tables formatted for knowledge-based mechanism tools (MIMOSA2 / AMON / anansi).
This function writes the abundance tables of the selected blocks into the input formats expected by external knowledge-constrained tools, bridging layer 1 (data-driven association) with layer 2 (biochemistry-constrained mechanism inference):
MIMOSA2: KO (or other microbial feature) abundance table + metabolite abundance table, both tab-separated with features as rows and samples as columns, used to link community metabolic potential to measured metabolites.
AMON: metabolite KEGG ID list + KO ID list (one ID per line), used to attribute metabolite origins (microbial vs host) on the KEGG reaction network.
anansi: KO abundance table + metabolite abundance table (features as rows, samples as columns) for constrained KO-metabolite association testing.
The exported tables use the original (non-transformed) abundances stored in dataset_list,
because these tools expect raw counts or relative abundances rather than CLR-transformed values.
trans_multiomics$export_bridge( target = "mimosa2", file = NULL, ko_block = NULL, metab_block = NULL, metab_id_table = NULL, features = NULL )
targetdefault "mimosa2"; the target tool: "mimosa2", "amon" or "anansi".
filedefault NULL; the path prefix of the exported files (without extension), e.g.
"./bridge/input" produces "./bridge/input_ko.txt" and "./bridge/input_metabolites.txt".
ko_blockdefault NULL; the block holding the microbial features (KO/gene/taxon abundances).
NULL uses the first block of data_list_names.
metab_blockdefault NULL; the block holding the metabolite abundances. NULL auto-detects a block whose name contains "metab" (case-insensitive) and falls back to the second block.
metab_id_tabledefault NULL; an optional 2-column data.frame mapping the metabolite names in the data (column 1) to KEGG compound IDs (column 2). If NULL, the original metabolite names are used and a reminder is printed that MIMOSA2/AMON/anansi expect KEGG IDs.
featuresdefault NULL; an optional named list of feature subsets per block
(e.g. list(microb = c("K00001", ...), metab = c("C00095", ...))); useful to export only
features prioritized by a previous DIABLO analysis (see get_features).
a named character vector of the written file paths (invisibly).
\dontrun{
t1$export_bridge(target = "mimosa2", file = "./bridge/mimosa_input",
ko_block = "microb", metab_block = "metab")
}
clone()The objects of this class are cloneable with this method.
trans_multiomics$clone(deep = FALSE)
deepWhether to make a deep clone.
## ------------------------------------------------
## Method `trans_multiomics$new`
## ------------------------------------------------
## Not run:
data(soil_microb)
data(soil_metab)
t1 <- trans_multiomics$new(
microtables = list(microb = soil_microb, metab = soil_metab),
group_col = "Group"
)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$preprocess_data`
## ------------------------------------------------
## Not run:
t1$preprocess_data(method = "clr", filter_thres = 0.0001, filter_freq = 0.2)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$set_design`
## ------------------------------------------------
## Not run:
t1$set_design(weight = 0.1)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$run_diablo`
## ------------------------------------------------
## Not run:
t1$run_diablo(ncomp = 2, keepX = list(microb = c(10, 10), metab = c(15, 15)))
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$run_spls`
## ------------------------------------------------
## Not run:
t1$run_spls(ncomp = 2, Y_block = "metab", mode = "regression")
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$run_spls_single`
## ------------------------------------------------
## Not run:
t1$run_spls_single(X_block = "microb", Y_block = "metab", ncomp = 2)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$tune_model`
## ------------------------------------------------
## Not run:
t1$tune_model(ncomp = 2, test_keepX = list(microb = c(5, 10, 20),
metab = c(5, 10, 20)), seed = 123)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$eval_performance`
## ------------------------------------------------
## Not run:
t1$eval_performance(folds = 5, nrepeat = 1, seed = 123)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$get_features`
## ------------------------------------------------
## Not run:
features <- t1$get_features(comp = 1)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$get_correlation`
## ------------------------------------------------
## Not run:
cor_mat <- t1$get_correlation(comp = 1, cutoff = 0.7)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$get_stability`
## ------------------------------------------------
## Not run:
t1$eval_performance(folds = 5, nrepeat = 10, seed = 123)
stab <- t1$get_stability()
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_samples`
## ------------------------------------------------
## Not run:
p <- t1$plot_samples(comp = c(1, 2), ellipse = TRUE)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_loadings`
## ------------------------------------------------
## Not run:
p <- t1$plot_loadings(comp = 1, block = "microb")
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_cor_network`
## ------------------------------------------------
## Not run:
t1$plot_cor_network(comp = 1, cutoff = 0.7)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_circos`
## ------------------------------------------------
## Not run:
t1$plot_circos(comp = 1, cutoff = 0.7)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_diablo`
## ------------------------------------------------
## Not run:
t1$plot_diablo(ncomp = 1)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_heatmap`
## ------------------------------------------------
## Not run:
t1$plot_heatmap(comp = 1)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$cal_transkingdom`
## ------------------------------------------------
## Not run:
t1$cal_transkingdom(corr_method = "spearman", corr_thres = 0.6, diff_test = "kruskal")
head(t1$res_transkingdom$nodes)
head(t1$res_transkingdom$edges)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$plot_transkingdom`
## ------------------------------------------------
## Not run:
t1$cal_transkingdom()
p <- t1$plot_transkingdom(label = "hub")
print(p)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$convert_transkingdom`
## ------------------------------------------------
## Not run:
t1$cal_transkingdom()
net1 <- t1$convert_transkingdom()
net1$cal_module()
net1$get_node_table()
net1$plot_network(method = "ggraph", node_color = "module")
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$cal_auroc`
## ------------------------------------------------
## Not run:
t1$cal_auroc(comp = 1)
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$run_mediation`
## ------------------------------------------------
## Not run:
# microbes -> metabolites -> host phenotype
t1$run_mediation(exposure = "microb", mediator = "metab", outcome = pheno_vector,
model = "glmnet", n_boot = 200)
t1$res_mediation$indirect_pathwise
## End(Not run)
## ------------------------------------------------
## Method `trans_multiomics$export_bridge`
## ------------------------------------------------
## Not run:
t1$export_bridge(target = "mimosa2", file = "./bridge/mimosa_input",
ko_block = "microb", metab_block = "metab")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.