Skip to content

Commit 37ecadb

Browse files
committed
handle c-terminal assigned mods
1 parent dd9fee0 commit 37ecadb

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/edu/umich/andykong/ptmshepherd/localization/SiteLocalization.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,10 +296,17 @@ private float[] extractMSFraggerScores(String positionScores, int length) {
296296

297297
public static void localizeMods(TreeMap<Integer, Float> assignedMods, float[] mods) {
298298
for (Map.Entry<Integer, Float> mod : assignedMods.entrySet()) {
299-
// Mods are 1-indexed in PSMs, except for N-term mods which are placed at 0. Leave at 0 if N-term mod, otherwise, convert to 0-indexed
300-
int pos = mod.getKey() == 0 ? 0 : mod.getKey() - 1;
299+
// Mods are 1-indexed in PSMs, except for terminal mods which are 0 (N-term) or length+1 (C-term)
300+
int pos;
301+
if (mod.getKey() == 0) {
302+
pos = 0; // N-term
303+
} else if (mod.getKey() == mods.length + 1) {
304+
pos = mods.length - 1; // C-term
305+
} else {
306+
pos = mod.getKey() - 1; // all other mods
307+
}
301308
float mass = mod.getValue();
302-
mods[pos] += mass;
309+
mods[pos] += mass;
303310
}
304311
}
305312

0 commit comments

Comments
 (0)