Skip to content

groupComparisonPTM can adjust a site against an unrelated protein #138

Open

Description

@swaraj-neu

When a site's parent protein isn't in the protein data, groupComparisonPTM doesn't leave the site unadjusted. It matches the site to any protein whose name is a substring of the site label and subtracts that protein's log2FC. With UniProt entry names this is easy to hit, since short names are often substrings of longer ones. A site on EYA4_HUMAN gets adjusted against A4_HUMAN (APP), and one on CABL1_HUMAN against ABL1_HUMAN. These rows come back with Adjusted = TRUE and a normal-looking p-value, so nothing flags them.

The matching is in extract_protein_name (src/model_adjustment.cpp lines 18 to 31). Line 24 removes the protein name from anywhere in the label, and line 27 counts any change as a match, with no anchor to the start of the label. .extractProtein sorts candidates longest-first (R/utils_groupComparison.R lines 7 to 9), so the true parent wins when it's present, and the failure only happens when it's missing. Requiring the protein name to be a prefix followed by a site suffix would fix it. Since the DIA-NN converter needs Protein.Names to produce site labels (#136), anyone using the DIA-NN workflow gets entry names and can run into this.

Also noticed that the no-match value is the string "NA" (line 16), not a real NA, and that's what ends up in GlobalProtein. Infinite rows with no match still come back with Adjusted = TRUE.

Repro (MSstatsPTM 2.14.0), calling the internal helper directly to keep it short

library(MSstatsPTM)
library(data.table)

extractProtein <- getFromNamespace(".extractProtein", "MSstatsPTM")

## EYA4 and CABL1 carry sites but were not quantified in the global run
ptm_model <- data.table(
  Protein = c("EYA4_HUMAN_S361", "CABL1_HUMAN_S291", "BRD2_HUMAN_K614"),
  Label = "cond2 vs cond1", log2FC = 1)
protein_model <- data.table(
  Protein = c("A4_HUMAN", "ABL1_HUMAN", "BRD2_HUMAN"),
  Label = "cond2 vs cond1", log2FC = 0.5)

res <- extractProtein(copy(ptm_model), protein_model)
print(res[, .(site = Site, protein_subtracted = Protein)])

stopifnot(res[Site == "EYA4_HUMAN_S361", Protein] == "A4_HUMAN")   # expected: no match

Output

               site protein_subtracted
1:  BRD2_HUMAN_K614         BRD2_HUMAN
2: CABL1_HUMAN_S291         ABL1_HUMAN
3:  EYA4_HUMAN_S361           A4_HUMAN

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