Files
digital-patients/main_corto.nf
Olamide Isreal 9e6a16c19b Initial commit: digital-patients pipeline (clean, no large files)
Large reference/model files excluded from repo - to be staged to S3 or baked into Docker images.
2026-03-26 15:15:23 +01:00

47 lines
1.2 KiB
Plaintext

nextflow.enable.dsl=2
process CORTO {
memory 1.GB
container "${params.container_corto}"
containerOptions "${params.containerOptions}"
publishDir "${params.outdir}/${params.project_name}", mode: 'copy'
// debug true
// maxForks 1
stageInMode 'copy'
input:
path TPM
path regulon
// path TPM_ref
// Define output channels
output:
path "*_metabolome.csv", emit: csv_metabol
script:
"""
#!/usr/bin/Rscript
library(corto)
library(data.table)
TPM <- as.matrix(fread("$TPM"),rownames=1)
#TPM_ref <- as.matrix(fread("TPM_ref"),rownames=1) #dollar sign is missing
#try normalization; dont use
#TPM <- scale(TPM)
#TPM_log2 = log2(TPM + 1)
load("$regulon")
predicted<-mra(TPM, regulon=regulon)
#use this if we want to compare patients and reference TPM, data formet output is not csv -> work on data saving if needed
#predicted<-mra(TPM, path TPM_ref, regulon=regulon)
name = strsplit(strsplit("$TPM", split = "/")[[1]][length(strsplit("$TPM", split = "/")[[1]])], split = "_TPM.csv")[[1]][1]
name = paste(name, "_metabolome.csv", sep="")
write.csv(predicted, name)
"""
}