trans_multiomics: Multi-omics data integration analysis.

trans_multiomicsR Documentation

Multi-omics data integration analysis.

Description

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.

Methods

Public methods


Method 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.

Usage
trans_multiomics$new(microtables = NULL, group = NULL, group_col = "Group")
Arguments
microtables

default 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.

group

default 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_col

default "Group"; the column name in sample_table used to extract the group factor when group is NULL.

Returns

self (invisible), enabling chained calls; dataset_list, data_list_names and Y are stored in the object.

Examples
\dontrun{
data(soil_microb)
data(soil_metab)
t1 <- trans_multiomics$new(
  microtables = list(microb = soil_microb, metab = soil_metab),
  group_col = "Group"
)
}

Method 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.

Usage
trans_multiomics$preprocess_data(
  method = "clr",
  pseudocount = 1,
  filter_thres = NULL,
  filter_freq = 1,
  ...
)
Arguments
method

default "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.

pseudocount

default 1; add pseudocount for zero values when method = "clr".

filter_thres

default NULL; the relative abundance threshold for filtering low-abundance features. Passed to rel_abund parameter of microtable$filter_taxa. NULL means no filtering.

filter_freq

default 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.

Returns

self (invisible), enabling chained calls; data_list is stored in the object.

Examples
\dontrun{
t1$preprocess_data(method = "clr", filter_thres = 0.0001, filter_freq = 0.2)
}

Method 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.

Usage
trans_multiomics$set_design(design = NULL, weight = 0.1)
Arguments
design

default NULL; a user-specified design matrix. If NULL, a matrix filled with weight (with 0 on the diagonal) is created.

weight

default 0.1; the off-diagonal weight when design is NULL.

Returns

self (invisible), enabling chained calls; design is stored in the object.

Examples
\dontrun{
t1$set_design(weight = 0.1)
}

Method 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.

Usage
trans_multiomics$run_diablo(
  ncomp = 2,
  keepX = NULL,
  design = NULL,
  scale = TRUE,
  ...
)
Arguments
ncomp

default 2; the number of components.

keepX

default 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)).

design

default NULL; the design matrix. If NULL, use self$design; if still NULL, create with set_design().

scale

default TRUE; whether to scale the data.

...

other parameters passed to mixOmics::block.splsda.

Returns

self (invisible), enabling chained calls; model is stored in the object.

Examples
\dontrun{
t1$run_diablo(ncomp = 2, keepX = list(microb = c(10, 10), metab = c(15, 15)))
}

Method 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).

Usage
trans_multiomics$run_spls(
  ncomp = 2,
  Y_block = NULL,
  keepX = NULL,
  design = NULL,
  mode = "regression",
  scale = TRUE,
  ...
)
Arguments
ncomp

default 2; the number of components.

Y_block

default NULL; the index or name of the omics block used as the response (indY). If NULL, the last block in data_list is used.

keepX

default 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).

design

default NULL; the design matrix. If NULL, use self$design; if still NULL, create with set_design().

mode

default "regression"; the PLS mode. One of "regression", "canonical", "invariant", "classic".

scale

default TRUE; whether to scale the data.

...

other parameters passed to mixOmics::block.spls.

Returns

self (invisible), enabling chained calls; model is stored in the object.

Examples
\dontrun{
t1$run_spls(ncomp = 2, Y_block = "metab", mode = "regression")
}

Method 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).

Usage
trans_multiomics$run_spls_single(
  X_block = 1,
  Y_block = 2,
  ncomp = 2,
  mode = "regression",
  keepX = NULL,
  keepY = NULL,
  scale = TRUE,
  ...
)
Arguments
X_block

default 1; the index or name of the X block in data_list.

Y_block

default 2; the index or name of the Y block in data_list.

ncomp

default 2; the number of components.

mode

default "regression"; the PLS mode.

keepX

default NULL; the number of variables to select in X per component.

keepY

default NULL; the number of variables to select in Y per component.

scale

default TRUE; whether to scale the data.

...

other parameters passed to mixOmics::spls.

Returns

self (invisible), enabling chained calls; model is stored in the object.

Examples
\dontrun{
t1$run_spls_single(X_block = "microb", Y_block = "metab", ncomp = 2)
}

Method 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.

Usage
trans_multiomics$tune_model(
  method = "block.splsda",
  ncomp = 2,
  test_keepX = NULL,
  folds = 10,
  nrepeat = 1,
  dist = "centroids.dist",
  seed = NULL,
  ...
)
Arguments
method

default "block.splsda"; the tuning method. Currently only "block.splsda" is supported, as mixOmics provides no tune function for unsupervised block.spls.

ncomp

default 2; the number of components to tune.

test_keepX

default 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.

folds

default 10; the number of folds for cross-validation. Must not exceed the smallest class size of Y.

nrepeat

default 1; the number of repeats. Increase to 10-50 for robust results.

dist

default "centroids.dist"; the prediction distance for DA methods.

seed

default NULL; an integer used to set the random seed before cross-validation for reproducible results.

...

other parameters passed to mixOmics::tune.block.splsda.

Returns

self (invisible), enabling chained calls; tune_result and best_keepX are stored in the object.

Examples
\dontrun{
t1$tune_model(ncomp = 2, test_keepX = list(microb = c(5, 10, 20), 
		metab = c(5, 10, 20)), seed = 123)
}

Method 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.

Usage
trans_multiomics$eval_performance(
  method = "Mfold",
  folds = 10,
  nrepeat = 1,
  seed = NULL,
  ...
)
Arguments
method

default "Mfold"; the cross-validation method. "Mfold" or "loo".

folds

default 10; the number of folds (when method = "Mfold"). Must not exceed the smallest class size of Y.

nrepeat

default 1; the number of repeats.

seed

default NULL; an integer used to set the random seed before cross-validation for reproducible results.

...

other parameters passed to mixOmics::perf.

Returns

self (invisible), enabling chained calls; perf_result is stored in the object.

Examples
\dontrun{
t1$eval_performance(folds = 5, nrepeat = 1, seed = 123)
}

Method 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.

Usage
trans_multiomics$get_features(comp = 1, block = NULL)
Arguments
comp

default 1; the component of interest.

block

default NULL; the block(s) to extract. NULL means all blocks. Can be integer index or block name.

Returns

res_features stored in the object and returned.

Examples
\dontrun{
features <- t1$get_features(comp = 1)
}

Method 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.

Usage
trans_multiomics$get_correlation(comp = 1, block = NULL, cutoff = NULL)
Arguments
comp

default 1; the component(s) used to compute the similarity (identical across all blocks).

block

default NULL; the block(s) to include. NULL means all blocks.

cutoff

default NULL; only show correlations with absolute value above this threshold.

Returns

res_correlation stored in the object and returned.

Examples
\dontrun{
cor_mat <- t1$get_correlation(comp = 1, cutoff = 0.7)
}

Method 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.

Usage
trans_multiomics$get_stability(comp = NULL)
Arguments
comp

default NULL; the component(s) to extract. NULL means all components.

Returns

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).

Examples
\dontrun{
t1$eval_performance(folds = 5, nrepeat = 10, seed = 123)
stab <- t1$get_stability()
}

Method 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().

Usage
trans_multiomics$plot_samples(
  comp = c(1, 2),
  group = NULL,
  blocks = "average",
  ellipse = FALSE,
  legend = TRUE,
  ...
)
Arguments
comp

default c(1, 2); the components on the x and y axes.

group

default NULL; the group factor for coloring. If NULL, use self$Y.

blocks

default "average"; which blocks to display. "average" for consensus, or block index/name.

ellipse

default FALSE; whether to add ellipses.

legend

default TRUE; whether to show the legend.

...

other parameters passed to mixOmics::plotIndiv.

Returns

a ggplot object.

Examples
\dontrun{
p <- t1$plot_samples(comp = c(1, 2), ellipse = TRUE)
}

Method 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.

Usage
trans_multiomics$plot_loadings(comp = 1, block = NULL, ...)
Arguments
comp

default 1; the component to plot.

block

default NULL; the block to display. NULL means the first block.

...

other parameters passed to mixOmics::plotLoadings.

Returns

a ggplot object.

Examples
\dontrun{
p <- t1$plot_loadings(comp = 1, block = "microb")
}

Method 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.

Usage
trans_multiomics$plot_cor_network(comp = 1, cutoff = 0.7, block = NULL, ...)
Arguments
comp

default 1; the component used to compute the similarity (identical across all blocks).

cutoff

default 0.7; only show edges with absolute correlation above this threshold.

block

default NULL; the block(s) to include.

...

other parameters passed to mixOmics::network.

Returns

the network result (invisibly), with res_network stored.

Examples
\dontrun{
t1$plot_cor_network(comp = 1, cutoff = 0.7)
}

Method 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.

Usage
trans_multiomics$plot_circos(comp = 1, cutoff = 0.7, ...)
Arguments
comp

default 1; the component(s) to display.

cutoff

default 0.7; only show links with absolute correlation above this threshold.

...

other parameters passed to mixOmics::circosPlot.

Returns

the circos plot result (invisibly).

Examples
\dontrun{
t1$plot_circos(comp = 1, cutoff = 0.7)
}

Method 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.

Usage
trans_multiomics$plot_diablo(ncomp = 1, ...)
Arguments
ncomp

default 1; the dimension to be assessed.

...

other parameters passed to mixOmics::plotDiablo.

Returns

the plot (invisibly).

Examples
\dontrun{
t1$plot_diablo(ncomp = 1)
}

Method 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.

Usage
trans_multiomics$plot_heatmap(comp = 1, ...)
Arguments
comp

default 1; the component(s) to display.

...

other parameters passed to mixOmics::cimDiablo.

Returns

the CIM result (invisibly).

Examples
\dontrun{
t1$plot_heatmap(comp = 1)
}

Method 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.

Usage
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
)
Arguments
corr_method

default "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_thres

default 0.6; the minimal absolute correlation to retain an edge.

p_thres

default 0.05; the maximal adjusted p value to retain an edge.

p_adjust

default "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_test

default "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_p

default 0.05; the adjusted p value threshold of the differential filtering.

covariates

default 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.

blocks

default NULL; the blocks to include (block names or indices). NULL means all blocks.

hub_quantile

default 0.9; features with a BiBC above this quantile (among features with BiBC > 0) are flagged as cross-omics hubs.

Returns

self (invisible); the network is stored in res_transkingdom (a list with graph, nodes and edges).

Examples
\dontrun{
t1$cal_transkingdom(corr_method = "spearman", corr_thres = 0.6, diff_test = "kruskal")
head(t1$res_transkingdom$nodes)
head(t1$res_transkingdom$edges)
}

Method 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().

Usage
trans_multiomics$plot_transkingdom(
  label = "hub",
  layout = "fr",
  node_size_range = c(3, 8),
  edge_colors = c("#B2182B", "#2166AC")
)
Arguments
label

default "hub"; which nodes to label: "hub" (only cross-omics hubs), "all" (all nodes) or "none".

layout

default "fr"; the node layout: "fr" (force-directed Fruchterman-Reingold, using the absolute correlations as attraction) or "circle".

node_size_range

default c(3, 8); the size range mapping BiBC to node size.

edge_colors

default c("#B2182B", "#2166AC"); colors for positive and negative correlations.

Returns

a ggplot object.

Examples
\dontrun{
t1$cal_transkingdom()
p <- t1$plot_transkingdom(label = "hub")
print(p)
}

Method 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.

Usage
trans_multiomics$convert_transkingdom(
  delete_unlinked_nodes = TRUE,
  add_taxonomy = TRUE
)
Arguments
delete_unlinked_nodes

default TRUE; whether delete the nodes without any link, same with the default of cal_network in trans_network class.

add_taxonomy

default 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.

Returns

a trans_network object; the network is stored in its res_network slot.

Examples
\dontrun{
t1$cal_transkingdom()
net1 <- t1$convert_transkingdom()
net1$cal_module()
net1$get_node_table()
net1$plot_network(method = "ggraph", node_color = "module")
}

Method 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.

Usage
trans_multiomics$cal_auroc(comp = 1, ...)
Arguments
comp

default 1; the component to use for ROC analysis.

...

other parameters passed to mixOmics::auroc.

Returns

the AUC result (invisibly).

Examples
\dontrun{
t1$cal_auroc(comp = 1)
}

Method 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).

Usage
trans_multiomics$run_mediation(
  exposure,
  mediator,
  outcome,
  model = "glmnet",
  features = NULL,
  max_features = NULL,
  covariates = NULL,
  n_boot = 0
)
Arguments
exposure

the 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).

mediator

the name of the omics block acting as the mediator (e.g. "metab").

outcome

the 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.

model

default "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).

features

default 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_features

default NULL; an optional cap on the number of features per block; when a block exceeds it, only the most variable features are kept.

covariates

default NULL; a data.frame of covariates (rows are samples with rownames matching the sample names) passed to the pretreatments of multimedia.

n_boot

default 0; the number of bootstrap resamples for confidence intervals. 0 skips the bootstrap (recommended for a first exploration; use 1000 for final results).

Returns

self (invisible); the result is stored in res_mediation.

Examples
\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
}

Method 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.

Usage
trans_multiomics$export_bridge(
  target = "mimosa2",
  file = NULL,
  ko_block = NULL,
  metab_block = NULL,
  metab_id_table = NULL,
  features = NULL
)
Arguments
target

default "mimosa2"; the target tool: "mimosa2", "amon" or "anansi".

file

default 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_block

default NULL; the block holding the microbial features (KO/gene/taxon abundances). NULL uses the first block of data_list_names.

metab_block

default 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_table

default 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.

features

default 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).

Returns

a named character vector of the written file paths (invisibly).

Examples
\dontrun{
t1$export_bridge(target = "mimosa2", file = "./bridge/mimosa_input",
  ko_block = "microb", metab_block = "metab")
}

Method clone()

The objects of this class are cloneable with this method.

Usage
trans_multiomics$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## 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)

microeco documentation built on Oct. 20, 2026, 9:06 a.m.