Error in the msstats_tmt.R function parse_contrasts
Description of the bug
There are appears to be a bug in the msstats_tmt.R function, which is executed by the process MSSTATS_TMT module. Specifically, in the parse_contrasts function. The error which I received was:
Error in parse_contrasts(l = l, contrast_str = contrast_str, lvls = lvls) :
object 'i' not found
Execution halted
SDRF I used is attached, the original .raw files can be found at PXD018893.
The params file was params.json, I'm also happy to provide the fasta database file if required.
And the nextflow.log was
In believe the issue originates In the else block (when control_str != ""):
for (j in setdiff(1:l, control)) {
comparison <- rep(0, l)
comparison[i] <- -1 # <--- 'i' isnt defined here
comparison[j] <- 1
contrast_mat[c,] <- comparison
rownames(contrast_mat)[c] <- paste0(lvls[i], "-", lvls[j])
c <- c + 1
}
We only loop over j (the non-control levels).
we don't declare i in this scope, so when we call comparison[i] <- -1, it errors with:
Error in comparison[i] <- -1 : object 'i' not found
From my understanding and based on the context, i was meant to represent the control group index, which we have here
control <- which(as.character(lvls) == control_str)
So inside that loop, we should use control instead of i:
comparison[control] <- -1
comparison[j] <- 1
rownames(contrast_mat)[c] <- paste0(lvls[control], "-", lvls[j])
Command used and terminal output
nextflow run main.nf -profile docker -params-file params.json
Relevant files
No response
System information
N E X T F L O W version 25.04.2 build 5947 Local Local Docker Ubuntu 22.04
@kai-lawsonmcdowall Please let us know if your merged PR fixed that problem. Thanks for the contribution.