Skip to content

Commit

Permalink
Absent zero bin bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgeiszler committed Jul 21, 2021
1 parent ea60cfb commit 13b88c4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
21 changes: 17 additions & 4 deletions src/edu/umich/andykong/ptmshepherd/peakpicker/ModSummary.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ public ModSummary(File inPeaks, Set<String> dsets) throws Exception{
}
for(int j = 1; j < inFile.size(); j++){
String line [] = inFile.get(j);
if(line.length == mod1i){
if(line.length == mod1i) {
psmCounts.get(ds).put("None", Double.parseDouble(line[headis.get(ds + "_PSMs")]));
psmCountsNorm.get(ds).put("None", Double.parseDouble(line[headis.get(ds + "_percent_PSMs")]));
mods.add("None");
}
}
}
Expand All @@ -94,11 +95,23 @@ public ModSummary(File inPeaks, Set<String> dsets) throws Exception{
public void toFile(File modOut) throws Exception{
//sort modifications by psm count for table
LinkedHashMap<String, Integer> modsCount = new LinkedHashMap<>();
mods.add("None"); //allow mods to be searched for
//mods.add("None"); //allow mods to be searched for
for (String mod : mods) { //sum PSMs across DSs
int nPsms = 0;
for (String ds : datasets){
nPsms += psmCounts.get(ds).get(mod);
for (String ds : datasets) {
try {
nPsms += psmCounts.get(ds).get(mod);
} catch (Exception e) {
System.out.println(ds);
System.out.println(mod);
System.out.println(psmCounts.size());
System.out.println(psmCounts.get(ds).size());
for(String s : psmCounts.get(ds).keySet()) {
System.out.println(s);
}
System.out.println(e);
System.exit(1);
}
}
modsCount.put(mod, nPsms);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ else if (cdiff < lowerBound)
DeltaMassAnnotation dma = new DeltaMassAnnotation();
for (int j = 0; j < cUnimodIs.size(); j++) {
dma.UnimodMasses.add(mdasUnimod.get(cUnimodIs.get(j)).diff);
dma.UnimodAnnos.add(mdasUnimod.get(cUnimodIs.get(j)).annotation);
dma.UnimodAnnos.add("Mod1: " + mdasUnimod.get(cUnimodIs.get(j)).annotation);
}
for (int j = 0; j < cPtmsIs.size(); j++) {
dma.PtmsMasses.add(this.peaks[0][cPtmsIs.get(j)]);
Expand Down Expand Up @@ -485,9 +485,9 @@ private String formatMultiplePtmsMods (String[] massAnnos) {
if (massAnnos[i].equals(""))
continue;
if (cMods.length() > 0)
cMods.append(String.format(", %s", massAnnos[i]));
cMods.append(String.format(", Mod2: %s", massAnnos[i]));
else
cMods.append(String.format("%s", massAnnos[i]));
cMods.append(String.format("Mod1: %s", massAnnos[i]));
}
return cMods.toString();
}
Expand Down

0 comments on commit 13b88c4

Please sign in to comment.