
Build a canonical exploreDE .h5ad from user-supplied data
Source: R/build_explore_h5ad.R
build_explore_h5ad.RdThe source-agnostic "bring your own data" constructor. x is either a rich
upstream object (a DESeqDataSet — the preferred starting point) or the
counts themselves (a matrix, or a named list of matrices such as
list(counts=, normalised=, vst=, tpm=)). Any parts the object doesn't
carry — DE tables, pathway statistics, extra count matrices — are supplied
as arguments and merged. Only counts + coldata + omics are required.
Arguments
- x
A
DESeqDataSet, a counts matrix, or a named list of count matrices.- out
Output
.h5adpath.- omics
Required:
"rnaseq","proteomics", or"crispr".- feature_level
Optional override of the feature granularity within the omics — rnaseq
"gene"/"isoform", proteomics"protein"/"peptide"/"phospho". Omit to auto-detect fromrowdata(site-> phospho,peptide_Id-> peptide,transcript_id-> isoform).- coldata
Sample metadata
data.frame. Required unlessxis a rich object that carries it.- rowdata
Optional per-feature annotation (feature names/symbols/ids and per-feature pathway annotation columns, e.g.
GO BP).- de
Optional named list of DE tables keyed by contrast (
DESeqResults/data.frame). Name each contrast<test>_vs_<reference>, with both groups levels of onecoldatafactor (an error otherwise). Columns are recognised by the column dictionary (inst/dictionaries/column_patterns.json), overridable withde_columns. An optional extra score column (e.g. SAINTexpress'sSaintScore) is picked up by the dictionary alone and shown for display under its own column name.- de_columns
Optional DE column overrides:
list(effect_log2fc = "<col>", score_pvalue = "<col>", score_fdr = "<col>"), applied to all contrasts, or a named list of such lists keyed by contrast. Named columns are used as given; any not named are still found by the dictionary. A producer with no raw p-value (e.g. SAINTexpress) simply has none; the app degrades to FDR-only. Unknown keys are ignored with a warning. Overrides are persisted atuns$exploreDE$mapping$de, so the file stays self-describing.- rowdata_columns
Optional feature column overrides:
list(id_col = "<col>", symbol_col = "<col>")— whichrowdatacolumn supplies the feature id and the display symbol. Anything not named is still found by the dictionary. Unknown keys are ignored with a warning. Overrides are persisted atuns$exploreDE$mapping$feature.- pathways
Optional pathway statistics: a named list keyed by contrast (keys a subset of
de); each entry a named list of clusterProfiler objects and/ordata.frames.- enrichment_padj_max
p.adjust cut-off applied to clusterProfiler results before they are stored (
p.adjust <= enrichment_padj_max). Either one number for every method, or a named list keyed by the method names used inpathways(e.g.list(ora = 0.05, gsea = 0.05)) so that ORA and GSEA can follow their own FDR thresholds; a method not named in the list uses the largest value given. The value(s) are recorded inuns$enrichment_filterand the app uses a per-method value as its significance threshold.- factors
Optional colData columns that are experimental factors (default: all character/factor-typed columns).
- gene_symbol, organism, ref_build
Optional labels.
Examples
library(SummarizedExperiment)
# A prolfqua proteomics result: one contrast, nested in rowData
se <- readRDS(system.file("examples/proteomics/SummarizedExperiment.rds", package = "exploreDE"))
de <- as.data.frame(rowData(se)$constrast_B_vs_A)
path <- build_explore_h5ad(
x = list(raw = assay(se, "rawData"), transformed = assay(se, "transformedData")),
out = tempfile(fileext = ".h5ad"),
omics = "proteomics",
coldata = colData(se),
rowdata = de,
factors = "G_",
de = list(B_vs_A = de)
)
file.exists(path)
#> [1] TRUE
# Counts only
counts_only <- build_explore_h5ad(
assay(se, "rawData"),
out = tempfile(fileext = ".h5ad"),
omics = "proteomics",
coldata = colData(se)
)