Skip to content

DIANNtoMSstatsPTMFormat default protein_id_col gives no site labels #136

Open

Description

@swaraj-neu

With the default protein_id_col = "Protein.Group", DIANNtoMSstatsPTMFormat returns plain protein names with no site suffix, so the PTM data ends up at protein level. There's no error or warning.

It reproduces on the package's own DIA-NN examples. On tinytest/raw_data/DIANN/report.tsv the defaults give BRD2_HUMAN, BRD3_HUMAN and BRD4_HUMAN, while protein_id_col = "Protein.Names" with fasta_protein_name = "entry_name" gives site labels like BRD2_HUMAN_K614. The DIA-NN 2.0 parquet example behaves the same way.

The site locator writes the site label into the column named by protein_id_col (R/converters.R line 108), but DIANNtoMSstatsFormat then keeps Protein.Names and drops Protein.Group (.cleanDIANNSelectRequiredColumns in MSstatsConvert), so the labels never make it through. Both man page examples pass Protein.Names, which is probably why this hasn't come up. Keeping whichever column protein_id_col names, or defaulting to Protein.Names, would fix it.

Repro (MSstatsPTM 2.14.0)

library(MSstatsPTM)
library(data.table)

dir   <- system.file("tinytest/raw_data/DIANN", package = "MSstatsPTM")
fasta <- system.file("extdata", "diann.fasta", package = "MSstatsPTM")
input <- fread(file.path(dir, "report.tsv"))
annot <- fread(file.path(dir, "annot.csv"))

labels <- function(...) {
  out <- DIANNtoMSstatsPTMFormat(input, annot, fasta_path = fasta,
                                 use_log_file = FALSE, verbose = FALSE, ...)
  unique(as.character(out$PTM$ProteinName))
}

a <- labels()                                             # default: "Protein.Group"
b <- labels(protein_id_col   = "Protein.Names",           # as the man page uses
            fasta_protein_name = "entry_name")

report <- function(tag, x) cat(sprintf(
  "%-26s %2d labels, %2d carry a site  |  %s\n",
  tag, length(x), sum(grepl("_[A-Z][0-9]+$", x)), paste(head(x, 3), collapse = ", ")))

report("default (Protein.Group)", a)
report("Protein.Names", b)

stopifnot(sum(grepl("_[A-Z][0-9]+$", a)) == 0)   # the bug: no sites, no warning

Output

default (Protein.Group)     3 labels,  0 carry a site  |  BRD2_HUMAN, BRD3_HUMAN, BRD4_HUMAN
Protein.Names              36 labels, 36 carry a site  |  BRD2_HUMAN_K614, BRD3_HUMAN_K487, BRD2_HUMAN_K544

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions