Skip to content

Commit

Permalink
only warn once if invalid MSFragger localization prevents writing gly…
Browse files Browse the repository at this point in the history
…can to assigned mods
  • Loading branch information
dpolasky committed Feb 26, 2024
1 parent 12ce184 commit e5ca4d8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/edu/umich/andykong/ptmshepherd/PSMFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public class PSMFile {

private HashMap<String, Integer> scanToLine;
public File fname;
boolean alreadyWarned;

public PSMFile(String fn) throws Exception {
this(new File(fn));
alreadyWarned = false;
}

/**
Expand Down Expand Up @@ -549,13 +551,14 @@ public ArrayList<String> writeGlycanToAssignedMod(ArrayList<String> newLine, Str
/* Get glycan location */
int glycanLocation = readMSFraggerGlycanLocation(newLine, fraggerLocCol, peptideCol, glycoParams.nGlycan, glycoParams.allowedLocalizationResidues);
String glycanAA;
String fraggerPepLocStr = newLine.get(fraggerLocCol);
// skip missing loc column for now (quant will fail, but not needed for basic ID)
try {
glycanAA = fraggerPepLocStr.substring(glycanLocation, glycanLocation + 1).toUpperCase();
glycanAA = newLine.get(peptideCol).substring(glycanLocation, glycanLocation + 1).toUpperCase();
} catch (StringIndexOutOfBoundsException ex) {
PTMShepherd.print(String.format("ERROR: MSFragger localization not reported for spectrum %s. Spectrum will NOT have glycan put to assigned mods", newLine.get(0)));
if (!alreadyWarned) {
PTMShepherd.print(String.format("WARNING: invalid MSFragger localization reported for spectrum %s. Spectrum will NOT have glycan put to assigned mods. Please check the Allowed Residues parameter if not in N-glyco mode.", newLine.get(0)));
alreadyWarned = true;
}
return newLine;
}

Expand Down

0 comments on commit e5ca4d8

Please sign in to comment.