Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@
^README\.Rmd$
^\.github$
^LICENSE\.md$
^\.semquery$
^\.active_plans$
^\.agents_context$
14 changes: 12 additions & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ export(detectBatchEffects)
export(detectOutlierSamples)
export(detect_probetype)
export(double_center_scale_fast)
export(drugs.analysisInfo)
export(drugs.enrichmentTable)
export(drugs.moaEnrichment)
export(drugs.supportBucket)
export(eset.getPhenoData)
export(eset.parsePhenoFromTitle)
export(estimateBatchCorrectionVectors)
Expand Down Expand Up @@ -388,7 +392,6 @@ export(pgx.createSignatureDatabaseH5)
export(pgx.createSignatureDatabaseH5.fromMatrix)
export(pgx.createSingleCellPGX)
export(pgx.createVipGeneLayer)
export(pgx.create_reports)
export(pgx.crosscheckINPUT)
export(pgx.deconvolution)
export(pgx.dimPlot)
Expand Down Expand Up @@ -434,11 +437,14 @@ export(pgx.getPCSFcentrality)
export(pgx.getSigGO)
export(pgx.getSymbolFromFeatureData)
export(pgx.getTopDrugs)
export(pgx.getTopGS)
export(pgx.getTopGeneSets)
export(pgx.getTopGenes)
export(pgx.getTopMOA)
export(pgx.inferCellCyclePhase)
export(pgx.inferCellType)
export(pgx.inferGender)
export(pgx.info)
export(pgx.initialize)
export(pgx.justSeuratObject)
export(pgx.load)
Expand Down Expand Up @@ -489,6 +495,8 @@ export(pgx.testPhenoCorrelation)
export(pgx.testPhenoCorrelation2)
export(pgx.testTCGAsurvival)
export(pgx.update_drugs_results)
export(pgx.update_infographics)
export(pgx.update_reports)
export(pgx.variableImportance)
export(pgx.violinPlot)
export(pgx.wgcna)
Expand Down Expand Up @@ -558,9 +566,9 @@ export(rownames.data.table)
export(rowscale)
export(rowsduplicated.dgCMatrix)
export(rpt.compile_cmap_report)
export(rpt.compile_sections)
export(rpt.compile_wgcna_report)
export(rpt.create_full_report)
export(rpt.create_summary_report)
export(run.GSEA)
export(run.GSEA.LeadingEdge)
export(run.GSEA.preranked)
Expand Down Expand Up @@ -633,6 +641,7 @@ export(wgcna.create_infographic)
export(wgcna.create_module_infographic)
export(wgcna.create_report)
export(wgcna.describeModules)
export(wgcna.ensureStats)
export(wgcna.filterColors)
export(wgcna.getConsensusGeneStats)
export(wgcna.getConsensusTopGenesAndSets)
Expand All @@ -641,6 +650,7 @@ export(wgcna.getModuleCrossGenes)
export(wgcna.getMultiTopGenesAndSets)
export(wgcna.getTopGenesAndSets)
export(wgcna.getTopModules)
export(wgcna.get_modTraits)
export(wgcna.init)
export(wgcna.matchColors)
export(wgcna.pickSoftThreshold)
Expand Down
37 changes: 36 additions & 1 deletion R/compute2-extra.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#' @export
compute_extra <- function(pgx, extra = c(
"meta.go", "infer", "deconv", "drugs", ## "graph",
"connectivity", "wordcloud", "wgcna", "mofa"
"connectivity", "wordcloud", "wgcna", "wgcna_mox", "mofa"
), sigdb = NULL, pgx.dir = "./data", libx.dir = "./libx",
user_input_dir = getwd(),
llm_model = NULL, img_model = NULL
Expand Down Expand Up @@ -253,6 +253,41 @@ compute_extra <- function(pgx, extra = c(
timings <- rbind(timings, c("wgcna", tt))
}

if ("wgcna_mox" %in% extra && isTRUE(pgx$datatype %in% c("multi-omics", "multiomics"))) {
info("[compute_extra] Computing multi-omics WGCNA...")
tt <- system.time({
tryCatch(
{
pgx$wgcna_mox <- wgcna.compute_multiomics(
dataX = mofa.split_data(pgx$X),
samples = pgx$samples,
contrasts = pgx$contrasts,
annot = pgx$genes,
GMT = pgx$GMT,
experiment = pgx$description,
power = NULL,
ngenes = 2000,
deepsplit = 2,
minmodsize = 10,
minKME = 0.3,
compute.enrichment = TRUE,
add.gsets = FALSE,
add.pheno = FALSE,
do.consensus = FALSE,
report = FALSE
)
},
error = function(e) {
message("[ERROR_WGCNA_MOX] FATAL: ", as.character(e))
write(as.character(e), file = paste0(user_input_dir, "/ERROR_WGCNA_MOX"))
return(NULL)
}
)
})
timings <- rbind(timings, c("wgcna_mox", tt))
info("[compute_extra] multi-omics WGCNA done")
}

if ("mofa" %in% extra) {
message(">>> Computing MOFA...")
tt <- system.time({
Expand Down
4 changes: 4 additions & 0 deletions R/pgx-annot.R
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,10 @@ getHumanOrtholog.biomart <- function(organism, symbols, verbose = 1) {
#' @export
probe2symbol <- function(probes, annot_table, query = "symbol",
key = NULL, fill_na = FALSE, add_datatype = FALSE) {

# NULL annot_table: no mapping possible — return probes as-is (same behaviour as fill_na=TRUE)
if (is.null(annot_table)) return(probes)

# Prepare inputs. add extra matching columns.
annot_table <- cbind(rownames = rownames(annot_table), annot_table)
id.cols <- intersect(c("feature", "gene_name", "symbol"), colnames(annot_table))
Expand Down
Loading