Skip to content

Commit

Permalink
Fix a serious bug that may not check the middle bins' combinations.
Browse files Browse the repository at this point in the history
  • Loading branch information
fcyu committed Jan 30, 2018
1 parent 844e3d9 commit a4cc349
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main/java/proteomics/Search/Search.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,12 @@ ResultEntry doSearch(SpectrumEntry spectrumEntry, SparseVector xcorrPL) throws I
Set<Integer> checkedBinSet = new HashSet<>(bin_seq_map.size() + 1, 1);
long candidate_num = 0;
ResultEntry resultEntry = new ResultEntry(spectrumEntry.spectrum_id, spectrumEntry.precursor_mz, spectrumEntry.precursor_mass, spectrumEntry.rt, spectrumEntry.precursor_charge, cal_evalue, binChainMap);
int stopIdx = (int) Math.ceil(build_index_obj.massToBin((spectrumEntry.mass_without_linker_mass + 1.00335483f) * 0.5f + rightMs1Tol));
for (int idx_1 : bin_seq_map.keySet()) {
if (idx_1 > stopIdx) {
break;
}

float left_mass_2;
float right_mass_2;
int left_idx_2;
Expand All @@ -93,17 +98,14 @@ ResultEntry doSearch(SpectrumEntry spectrumEntry, SparseVector xcorrPL) throws I
}

if (!sub_map.isEmpty()) {
if (checkedBinSet.contains(idx_1)) {
// The first bin has reach the middle point of the whole range. All pairs have been checked.
break;
}

// this bin hasn't been visited. Linear scan first.
for (String seq : bin_seq_map.get(idx_1)) {
ChainEntry chainEntry = chain_entry_map.get(seq);
linearScan(spectrumEntry, xcorrPL, chainEntry, idx_1, binChainMap, debugEntryList, devChainScoreMap);
if (!checkedBinSet.contains(idx_1)) {
// This bin hasn't been visited. Linear scan first.
for (String seq : bin_seq_map.get(idx_1)) {
ChainEntry chainEntry = chain_entry_map.get(seq);
linearScan(spectrumEntry, xcorrPL, chainEntry, idx_1, binChainMap, debugEntryList, devChainScoreMap);
}
checkedBinSet.add(idx_1);
}
checkedBinSet.add(idx_1);

if (binChainMap.containsKey(idx_1)) { // There may be no chain with chain score > single_chain_t
ChainResultEntry chain_score_entry_1 = binChainMap.get(idx_1);
Expand Down

0 comments on commit a4cc349

Please sign in to comment.