Skip to content

Error in the msstats_tmt.R function parse_contrasts #577

Closed

Description

@kai-lawsonmcdowall

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.

PXD018893_2025-08-04.sdrf.tsv

The params file was params.json, I'm also happy to provide the fasta database file if required.

And the nextflow.log was

issue_nextflow.log

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

Activity

  1. added
    bug
    on Aug 20, 2025
  2. added a commit that references this issue on Aug 24, 2025
  3. jpfeuffer commented on Aug 25, 2025

    @jpfeuffer
    Collaborator

    @kai-lawsonmcdowall Please let us know if your merged PR fixed that problem. Thanks for the contribution.

  4. ypriverol commented on Mar 21, 2026

    @ypriverol
    Contributor

    done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions