Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Commit 0980134

Browse files
committed
fix for 2nd round which includes the bad qualtiy compounds
1 parent 2cf429b commit 0980134

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

gibbs_sampling/src/main/java/de/unijena/bioinf/GibbsSampling/model/scorer/CommonFragmentAndLossScorer.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ private void prepare(FragmentsCandidate[][] candidates, double minimum_number_ma
3636
System.out.println("prepare.");
3737

3838

39-
if (normalizationMap==null & (used_minimum_number_matched_peaks_losses != minimum_number_matched_peaks_losses)){
39+
if (normalizationMap==null || (used_minimum_number_matched_peaks_losses != minimum_number_matched_peaks_losses)
40+
|| !containsAllCompounds(normalizationMap, Arrays.stream(candidates).map(c->c[0].getExperiment()).toArray(s->new Ms2Experiment[s]))){
41+
//something changed, so recompute all.
4042
long start = System.currentTimeMillis();
4143
used_minimum_number_matched_peaks_losses = minimum_number_matched_peaks_losses;
4244
norm = this.normalization(candidates, minimum_number_matched_peaks_losses);
@@ -102,9 +104,12 @@ private void prepare(FragmentsCandidate[][] candidates, double minimum_number_ma
102104
if (GibbsMFCorrectionNetwork.DEBUG) System.out.println("compounds: " + this.maybeSimilar.length + " | maybeSimilar: " + sum + " | threshold was "+threshold);
103105
}
104106

105-
// private void prepareData(){
106-
//
107-
// }
107+
private boolean containsAllCompounds(TObjectDoubleHashMap<Ms2Experiment> normalizationMap, Ms2Experiment[] ms2Experiments) {
108+
for (Ms2Experiment ms2Experiment : ms2Experiments) {
109+
if (!normalizationMap.containsKey(ms2Experiment)) return false;
110+
}
111+
return true;
112+
}
108113

109114

110115

0 commit comments

Comments
 (0)