Skip to content

Commit

Permalink
Add TPM the quantification RDS
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed May 10, 2024
1 parent dbc4042 commit 86af7b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion modules/local/quantification/merge_experiments/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ process MERGE_EXPERIMENTS {
'biocontainers/bioconductor-rtracklayer:1.62.0--r43ha9d7317_0' }"

input:
tuple val(meta), path(experiments)
tuple val(meta), path(experiments)
tuple val(meta2), path(phenotype)
tuple val(meta3), path(gtf)
tuple val(meta4), path(tpm)

output:
tuple val(meta), path("${meta.id}.merged.rds"), emit: merged
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ experiments <- lapply(paths, readRDS)

phenotype <- read.csv('${phenotype}', stringsAsFactors = FALSE)
annotation <- rtracklayer::import('${gtf}')
tpm <- read.table('${tpm}', header=TRUE, row.names=1)[, -1]

se_assays <- list()

Expand Down Expand Up @@ -42,6 +43,9 @@ for (col in colnames(colData(se))) {
annotation <- annotation[match(rownames(se), annotation\$transcript_id),]
rowData(se) <- annotation

# Add TPM
assay(se, "tpm", withDimnames = FALSE) <- tpm[rownames(se), colData(se)\$names]

saveRDS(se, '${meta.id}.merged.rds')

writeLines(
Expand Down
3 changes: 2 additions & 1 deletion subworkflows/local/quantification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ workflow QUANTIFICATION {
MERGE_EXPERIMENTS(
TXIMETA_TXIMETA.out.se.map{meta, se -> se}.collect().map{[[id: "experiments"], it]},
ch_phenotype,
EXCLUDE_OVERLONG_TRANSCRIPTS.out.output
EXCLUDE_OVERLONG_TRANSCRIPTS.out.output,
JOIN_TX_TPM.out.csv
)

ch_versions = ch_versions.mix(
Expand Down

0 comments on commit 86af7b2

Please sign in to comment.