Skip to content

Commit

Permalink
Fix a bug triggered by empty spectrum.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Feb 5, 2018
1 parent b07b34c commit a3262e0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/proteomics/Search/SearchWrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public Entry call() throws IOException, JMzReaderException, SQLException {
}

SparseVector xcorrPL = preSpectrumObj.preSpectrum(rawPLMap, precursorMass, scanId);

if (xcorrPL == null) {
return null;
}

if (ECL2.debug) {
BufferedWriter writer = new BufferedWriter(new FileWriter(scanId + ".xcorr.spectrum.csv"));
writer.write("bin_idx,intensity\n");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/proteomics/Spectrum/PreSpectra.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ public PreSpectra(JMzReader spectra_parser, double ms1Tolerance, double leftInve

Map<Double, Double> raw_mz_intensity_map = spectrum.getPeakList();

if (raw_mz_intensity_map.size() < 5) {
continue;
}

if (ECL2.debug) {
BufferedWriter writer = new BufferedWriter(new FileWriter(Integer.valueOf(spectrum.getId()) + ".raw.spectrum.csv"));
writer.write("mz,intensity\n");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/proteomics/Spectrum/PreSpectrum.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public SparseVector preSpectrum (Map<Double, Double> peaks_map, double precursor
}
}

if (sqrt_pl_map.isEmpty()) {
return null;
}

// digitize the spectrum
double[] pl_array = digitizeSpec(sqrt_pl_map);

Expand Down

0 comments on commit a3262e0

Please sign in to comment.