Skip to contents

Identifies top features shared across factors based on integration method. For MOFA/MCIA, takes intersection across factors. For DIABLO/RGCCA, takes features recurring in ≥2 block-specific components.

Usage

run_factor_overlap(
  expomicset,
  robust = TRUE,
  stability_score = NULL,
  score_col = "stability_score",
  pval_thresh = 0.05,
  logfc_thresh = log2(1.5),
  pval_col = "padj",
  logfc_col = "logFC",
  action = "add"
)

Arguments

expomicset

A MultiAssayExperiment with integration results and top factor features.

robust

Logical; if TRUE, uses sensitivity score. Otherwise, uses DEG thresholds.

stability_score

Optional numeric threshold (overrides default from metadata).

score_col

Column name for sensitivity score. Default is "stability_score".

pval_thresh

DEG p-value threshold (if robust = FALSE). Default is 0.05.

logfc_thresh

DEG logFC threshold (if robust = FALSE). Default is log2(1.5).

pval_col

Column name for p-value. Default is "padj".

logfc_col

Column name for logFC. Default is "logFC".

action

"add" to return modified object, "get" to return data.frame.

Value

Modified MultiAssayExperiment or data.frame of shared top features.

Examples

# create example data
mae <- make_example_data(
    n_samples = 20,
    return_mae = TRUE
)
#> Ensuring all omics datasets are matrices with column names.
#> Creating SummarizedExperiment objects.
#> Creating MultiAssayExperiment object.
#> MultiAssayExperiment created successfully.

# perform multiomics integration
mae <- run_multiomics_integration(
    mae,
    method = "MCIA",
    n_factors = 3
)
#> Scaling each assay in MultiAssayExperiment.
#> Running multi-omics integration using MCIA...
#> Applying MCIA with `nipalsMCIA`
#> Performing column-level pre-processing...
#> Column pre-processing completed.
#> Performing block-level preprocessing...
#> Block pre-processing completed.
#> Computing order 1 scores
#> Computing order 2 scores
#> Computing order 3 scores


# identify the features that contribute most to the factors
mae <- extract_top_factor_features(
    mae,
    factors = c("V1", "V2", "V3"),
    method = "percentile",
    percentile = 0.5,
    action = "add"
)
#> Extracting top contributing features for specified factors.
#> Using MCIA block loadings.
#> Applying percentile-based filtering (>50%).
#> Selected 312 features contributing to specified factors.

# perform differential abundance analysis
mae <- run_differential_abundance(
    expomicset = mae,
    formula = ~ smoker + sex,
    abundance_col = "counts",
    method = "limma_voom",
    action = "add"
)
#> Running differential abundance testing.
#> Processing assay: mRNA
#> No group or design set. Assuming all samples belong to one group.
#> tidybulk says: The design column names are "(Intercept), smokeryes, sexM"
#> tidybulk says: to access the raw results (fitted GLM) do `attr(..., "internals")$limma_voom`
#> Processing assay: proteomics
#> No group or design set. Assuming all samples belong to one group.
#> tidybulk says: The design column names are "(Intercept), smokeryes, sexM"
#> tidybulk says: to access the raw results (fitted GLM) do `attr(..., "internals")$limma_voom`
#> Differential abundance testing completed.

# determine the overlap in features
mae <- mae |>
    run_factor_overlap(
        robust = FALSE,
        pval_col = "adj.P.Val"
    )