OmicNetR provides a minimal, reproducible workflow for integrating two omics layers (e.g., gene expression and metabolomics) using sparse canonical correlation analysis (sCCA).
This vignette demonstrates:
For demonstration we use simulated multi-omics data. Replace this section with your own matrices in real analyses.
Alignment ensures that X and Y contain the
same samples in the same order.
The penalty_X and penalty_Y parameters
control sparsity (higher = sparser).
scca_model <- omic_scca(
X = X_aligned,
Y = Y_aligned,
n_components = 2,
penalty_X = 0.70,
penalty_Y = 0.70
)
#> Model Optimization: Keeping 240 genes and 45 metabolites.
str(scca_model, max.level = 1)
#> List of 4
#> $ canonical_correlations: NULL
#> $ loadings :List of 2
#> $ variates :List of 2
#> $ penalties :List of 2
#> - attr(*, "class")= chr "OmicNetR_sCCA"Edges are formed by pairing selected genes and metabolites and
filtering by the absolute product of weights
(weight_threshold).
net_data <- scca_to_network(
scca_model,
comp_select = 1,
weight_threshold = 0.01
)
# Keep the strongest edges for readability
net_data <- net_data[order(abs(net_data$Weight_Product), decreasing = TRUE), ]
net_data <- head(net_data, 50)
head(net_data)
#> Gene Metabolite Weight_Product Interaction_Type
#> 722 Gene_2 Met_4 -0.05146821 Negative
#> 1202 Gene_2 Met_6 -0.05144102 Negative
#> 728 Gene_8 Met_4 -0.05139479 Negative
#> 1208 Gene_8 Met_6 -0.05136764 Negative
#> 2402 Gene_2 Met_11 0.05108216 Positive
#> 2408 Gene_8 Met_11 0.05100929 Positive