From 7aa0aded0f39d7443241aa83b0d49fab5fd354b2 Mon Sep 17 00:00:00 2001 From: George Rosenberger Date: Wed, 28 Feb 2018 10:08:40 -0500 Subject: [PATCH 01/12] [FIX,PYOPENMS] Updated patch for macOS --- src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh b/src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh index f0f9f3724e7..ab709d872d8 100755 --- a/src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh +++ b/src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh @@ -8,7 +8,7 @@ # here we look at all of them and fix them using install_name_tool as seen below # -for TOFIX in $(find . -name pyopenms.so); do +for TOFIX in $(find . -name pyopenms*.so); do echo echo "fix $TOFIX now:" echo From fafabfaef6e84025d5f6774a93d63dc56b90cdb4 Mon Sep 17 00:00:00 2001 From: enetz Date: Wed, 28 Feb 2018 16:14:21 +0100 Subject: [PATCH 02/12] [FEATURE] TOPPView: colored peaks, initial commit some experimental code to test access to data structures and peak coloring --- .../include/OpenMS/VISUAL/LayerData.h | 3 +++ .../source/VISUAL/Spectrum1DCanvas.cpp | 26 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/openms_gui/include/OpenMS/VISUAL/LayerData.h b/src/openms_gui/include/OpenMS/VISUAL/LayerData.h index ecc8b27e992..76579d34b9c 100644 --- a/src/openms_gui/include/OpenMS/VISUAL/LayerData.h +++ b/src/openms_gui/include/OpenMS/VISUAL/LayerData.h @@ -308,6 +308,9 @@ namespace OpenMS /// Annotations of all spectra of the experiment (1D view) std::vector annotations_1d; + /// Peak colors of the currently shown spectrum + std::vector peak_colors_1d; + /// Flag that indicates if the layer data can be modified (so far used for features only) bool modifiable; diff --git a/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp b/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp index 25ca18da990..da000b873a5 100644 --- a/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp +++ b/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp @@ -748,6 +748,32 @@ namespace OpenMS { if (layer.filters.passes(spectrum, it - spectrum.begin())) { + // TODO THIS IS WHERE PEAKS ARE DRAWN + // LayerData accessible in "layer" + // vector pep_ids = layer.getPeakData()[layer.getCurrentSpectrumIndex()].getPeptideIdentifications(); + + if (layer.peptide_hit_index == -1) + { + // cout << "TEST NO ID | " << layer.peptide_id_index << " | " << layer.peptide_hit_index << endl; + } + else + { + // cout << "TEST ID AVAILABLE | " << layer.peptide_id_index << " | " << layer.peptide_hit_index << endl; + } + // cout << "TEST " << layer.getCurrentSpectrumIndex() << endl; + // cout << "TEST2 " << spectrum.getIntegerDataArrays().size() << endl; + + // DataArrays accessible from spectrum + // DataArrays::IntegerDataArray test_array = spectrum.getIntegerDataArrays()[0]; + + // layer.param.setValue("peak_color", "blue"); + + QPen pen(QColor(QString("#00ff00")), 1); + pen.setStyle(peak_penstyle_[i]); + painter->setPen(pen); + + + dataToWidget(*it, end, layer.flipped); dataToWidget(it->getMZ(), 0.0f, begin, layer.flipped); From f3ee8535c736992d52f1a0edf42244b7f41e08fa Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Wed, 28 Feb 2018 17:19:00 +0100 Subject: [PATCH 03/12] fix: added case of feature_name=intensity and no IS --- .../ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp | 27 +++++++++++-------- .../QUANTITATION/AbsoluteQuantitation.cpp | 20 +++++++++----- .../source/AbsoluteQuantitation_test.cpp | 3 ++- .../openms/source/MRMFeatureFilter_test.cpp | 4 ++- 4 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp index bea1fedaff7..f6f97b93e5d 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp @@ -370,28 +370,33 @@ namespace OpenMS { double ratio = 0.0; - if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) - { - double feature_1 = component_1.getMetaValue(feature_name); - double feature_2 = component_2.getMetaValue(feature_name); - ratio = feature_1/feature_2; - - } - else if (feature_name == "intensity") + if (feature_name == "intensity" && component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) { const double feature_1 = component_1.getIntensity(); const double feature_2 = component_2.getIntensity(); ratio = feature_1 / feature_2; } + else if (feature_name == "intensity" && component_1.metaValueExists("native_id")) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getIntensity(); + ratio = feature_1; + } + else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + { + double feature_1 = component_1.getMetaValue(feature_name); + double feature_2 = component_2.getMetaValue(feature_name); + ratio = feature_1/feature_2; + } else if (component_1.metaValueExists(feature_name)) { - LOG_INFO << "Warning: no ion pair found for transition_id " << component_1.getMetaValue("native_id") << "."; + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; double feature_1 = component_1.getMetaValue(feature_name); ratio = feature_1; - } + } else { - LOG_INFO << "Feature metaValue " << feature_name << " not found for transition_ids " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; + LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; } return ratio; diff --git a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp index a8dcd4ab52e..e41c444fa46 100644 --- a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp +++ b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp @@ -136,18 +136,24 @@ namespace OpenMS double AbsoluteQuantitation::calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name) { double ratio = 0.0; - if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) - { - double feature_1 = component_1.getMetaValue(feature_name); - double feature_2 = component_2.getMetaValue(feature_name); - ratio = feature_1/feature_2; - } - else if (feature_name == "intensity") + if (feature_name == "intensity" && component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) { const double feature_1 = component_1.getIntensity(); const double feature_2 = component_2.getIntensity(); ratio = feature_1 / feature_2; } + else if (feature_name == "intensity" && component_1.metaValueExists("native_id")) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getIntensity(); + ratio = feature_1; + } + else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + { + double feature_1 = component_1.getMetaValue(feature_name); + double feature_2 = component_2.getMetaValue(feature_name); + ratio = feature_1/feature_2; + } else if (component_1.metaValueExists(feature_name)) { LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; diff --git a/src/tests/class_tests/openms/source/AbsoluteQuantitation_test.cpp b/src/tests/class_tests/openms/source/AbsoluteQuantitation_test.cpp index 672b1761015..3a4702b3628 100644 --- a/src/tests/class_tests/openms/source/AbsoluteQuantitation_test.cpp +++ b/src/tests/class_tests/openms/source/AbsoluteQuantitation_test.cpp @@ -226,7 +226,7 @@ START_SECTION((double calculateRatio(const Feature & component_1, const Feature TEST_REAL_SIMILAR(absquant.calculateRatio(component_1,component_4,feature_name),5.0); TEST_REAL_SIMILAR(absquant.calculateRatio(component_3,component_4,feature_name),0.0); // feature_name == "intensity" - Feature component_5, component_6, component_7; + Feature component_5, component_6, component_7, component_8; feature_name = "intensity"; component_5.setMetaValue("native_id", "component5"); component_6.setMetaValue("native_id", "component6"); @@ -236,6 +236,7 @@ START_SECTION((double calculateRatio(const Feature & component_1, const Feature TEST_REAL_SIMILAR(absquant.calculateRatio(component_6, component_5, feature_name), 1.33333333333333); component_7.setMetaValue("native_id", "component7"); TEST_REAL_SIMILAR(absquant.calculateRatio(component_5, component_7, feature_name), inf); + TEST_REAL_SIMILAR(absquant.calculateRatio(component_5, component_8, feature_name), 3.0); END_SECTION START_SECTION((double calculateBias(const double & actual_concentration, const double & calculated_concentration))) diff --git a/src/tests/class_tests/openms/source/MRMFeatureFilter_test.cpp b/src/tests/class_tests/openms/source/MRMFeatureFilter_test.cpp index 66d9af44109..8bc902139c2 100644 --- a/src/tests/class_tests/openms/source/MRMFeatureFilter_test.cpp +++ b/src/tests/class_tests/openms/source/MRMFeatureFilter_test.cpp @@ -119,7 +119,8 @@ START_SECTION(double calculateIonRatio(const Feature & component_1, const Featur TEST_REAL_SIMILAR(mrmff.calculateIonRatio(component_1,component_4,feature_name),5.0); TEST_REAL_SIMILAR(mrmff.calculateIonRatio(component_3,component_4,feature_name),0.0); // feature_name == "intensity" - Feature component_5, component_6, component_7; + // feature_name == "intensity" + Feature component_5, component_6, component_7, component_8; feature_name = "intensity"; component_5.setMetaValue("native_id", "component5"); component_6.setMetaValue("native_id", "component6"); @@ -129,6 +130,7 @@ START_SECTION(double calculateIonRatio(const Feature & component_1, const Featur TEST_REAL_SIMILAR(mrmff.calculateIonRatio(component_6, component_5, feature_name), 1.33333333333333); component_7.setMetaValue("native_id", "component7"); TEST_REAL_SIMILAR(mrmff.calculateIonRatio(component_5, component_7, feature_name), inf); + TEST_REAL_SIMILAR(mrmff.calculateIonRatio(component_5, component_8, feature_name), 3.0); } END_SECTION From e61965f9871265294aab18ed4fa964aeea2bba64 Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Wed, 28 Feb 2018 22:33:40 +0100 Subject: [PATCH 04/12] fix: fixed formulas for asymmetry and tailing factor...again --- src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp b/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp index e026c81ba99..1b6343fc78d 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp @@ -317,8 +317,8 @@ namespace OpenMS psm.baseline_delta_2_height = psm.slope_of_baseline / peak_height; // Source of tailing_factor and asymmetry_factor formulas: // USP 40 - NF 35 The United States Pharmacopeia and National Formulary - Supplementary - psm.tailing_factor = psm.width_at_5 / (peak_apex_pos - psm.start_position_at_5); - psm.asymmetry_factor = (psm.end_position_at_10 - peak_apex_pos) / (peak_apex_pos - psm.start_position_at_10); + psm.tailing_factor = psm.width_at_5 / 2*(peak_apex_pos - psm.start_position_at_5); + psm.asymmetry_factor = (peak_apex_pos - psm.start_position_at_10) / (psm.end_position_at_10 - peak_apex_pos); return psm; } From 53bee7a2e8fc611a430f60237390c4cf848e215c Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Wed, 28 Feb 2018 23:18:12 +0100 Subject: [PATCH 05/12] fix: fixed formulas for asymmetry and tailing factor...again --- src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp b/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp index 1b6343fc78d..ec1d590c33b 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp @@ -317,8 +317,8 @@ namespace OpenMS psm.baseline_delta_2_height = psm.slope_of_baseline / peak_height; // Source of tailing_factor and asymmetry_factor formulas: // USP 40 - NF 35 The United States Pharmacopeia and National Formulary - Supplementary - psm.tailing_factor = psm.width_at_5 / 2*(peak_apex_pos - psm.start_position_at_5); - psm.asymmetry_factor = (peak_apex_pos - psm.start_position_at_10) / (psm.end_position_at_10 - peak_apex_pos); + psm.tailing_factor = psm.width_at_5 / (2*(peak_apex_pos - psm.start_position_at_5)); + psm.asymmetry_factor = (psm.end_position_at_10 - peak_apex_pos) / (peak_apex_pos - psm.start_position_at_10); return psm; } From d7e4d4a4aa026ecd42cc8f0ecf71896b3f9a59ec Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Wed, 28 Feb 2018 23:32:00 +0100 Subject: [PATCH 06/12] tests: updated test values --- .../class_tests/openms/source/PeakIntegrator_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp b/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp index 362272b83a9..80e13379210 100644 --- a/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp +++ b/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp @@ -602,7 +602,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 2.14352889450752) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -652,7 +652,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 2.14352889450752) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -702,7 +702,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 2.14352889450752) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -752,7 +752,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 2.14352889450752) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) From 582b2c0bcaa7f7fd0111423a8e20bb6022c9f968 Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Wed, 28 Feb 2018 23:39:24 +0100 Subject: [PATCH 07/12] tests: updated test values --- .../class_tests/openms/source/PeakIntegrator_test.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp b/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp index 80e13379210..765574909ee 100644 --- a/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp +++ b/src/tests/class_tests/openms/source/PeakIntegrator_test.cpp @@ -602,7 +602,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.07176444725376) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -652,7 +652,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.07176444725376) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -702,7 +702,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.07176444725376) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) @@ -752,7 +752,7 @@ START_SECTION(PeakShapeMetrics calculatePeakShapeMetrics( TEST_REAL_SIMILAR(psm.end_position_at_10, 2.779016667) TEST_REAL_SIMILAR(psm.end_position_at_50, 2.736266667) TEST_REAL_SIMILAR(psm.total_width, 0.540983333) - TEST_REAL_SIMILAR(psm.tailing_factor, 1.76444725379) + TEST_REAL_SIMILAR(psm.tailing_factor, 1.07176444725376) TEST_REAL_SIMILAR(psm.asymmetry_factor, 1.16705821456539) TEST_REAL_SIMILAR(psm.slope_of_baseline, 2454) TEST_REAL_SIMILAR(psm.baseline_delta_2_height, 0.00253908735640033) From 47feb7edcf7c98f36e58e246fbe76c832cf5f2c0 Mon Sep 17 00:00:00 2001 From: enetz Date: Thu, 1 Mar 2018 11:32:22 +0100 Subject: [PATCH 08/12] [FEATURE] TOPPView: peaks colored by label content --- .../include/OpenMS/VISUAL/LayerData.h | 1 + .../source/VISUAL/Spectrum1DCanvas.cpp | 28 ++++--------------- .../TOPPViewIdentificationViewBehavior.cpp | 6 ++++ 3 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/openms_gui/include/OpenMS/VISUAL/LayerData.h b/src/openms_gui/include/OpenMS/VISUAL/LayerData.h index 76579d34b9c..28d375d914a 100644 --- a/src/openms_gui/include/OpenMS/VISUAL/LayerData.h +++ b/src/openms_gui/include/OpenMS/VISUAL/LayerData.h @@ -138,6 +138,7 @@ namespace OpenMS gradient(), filters(), annotations_1d(), + peak_colors_1d(), modifiable(false), modified(false), label(L_NONE), diff --git a/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp b/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp index da000b873a5..9fd6e4c20ff 100644 --- a/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp +++ b/src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp @@ -748,31 +748,15 @@ namespace OpenMS { if (layer.filters.passes(spectrum, it - spectrum.begin())) { - // TODO THIS IS WHERE PEAKS ARE DRAWN - // LayerData accessible in "layer" - // vector pep_ids = layer.getPeakData()[layer.getCurrentSpectrumIndex()].getPeptideIdentifications(); - if (layer.peptide_hit_index == -1) + // use peak colors stored in the layer, if available + if (layer.peak_colors_1d.size() == spectrum.size()) { - // cout << "TEST NO ID | " << layer.peptide_id_index << " | " << layer.peptide_hit_index << endl; + // find correct peak index + Size peak_index = std::distance(spectrum.begin(), it); + pen.setColor(layer.peak_colors_1d[peak_index]); + painter->setPen(pen); } - else - { - // cout << "TEST ID AVAILABLE | " << layer.peptide_id_index << " | " << layer.peptide_hit_index << endl; - } - // cout << "TEST " << layer.getCurrentSpectrumIndex() << endl; - // cout << "TEST2 " << spectrum.getIntegerDataArrays().size() << endl; - - // DataArrays accessible from spectrum - // DataArrays::IntegerDataArray test_array = spectrum.getIntegerDataArrays()[0]; - - // layer.param.setValue("peak_color", "blue"); - - QPen pen(QColor(QString("#00ff00")), 1); - pen.setStyle(peak_penstyle_[i]); - painter->setPen(pen); - - dataToWidget(*it, end, layer.flipped); dataToWidget(it->getMZ(), 0.0f, begin, layer.flipped); diff --git a/src/openms_gui/source/VISUAL/TOPPViewIdentificationViewBehavior.cpp b/src/openms_gui/source/VISUAL/TOPPViewIdentificationViewBehavior.cpp index 70a08a00b18..934ad0cd533 100644 --- a/src/openms_gui/source/VISUAL/TOPPViewIdentificationViewBehavior.cpp +++ b/src/openms_gui/source/VISUAL/TOPPViewIdentificationViewBehavior.cpp @@ -935,24 +935,30 @@ namespace OpenMS ann_spectrum[i].getIntensity()); const String& label = labels[i]; QColor color; + QColor peak_color; + LayerData& annotated_layer = current_canvas->getCurrentLayer(); // XL-MS specific coloring of the labels, green for linear fragments and red for cross-linked fragments if (label.hasSubstring("[alpha|") || label.hasSubstring("[beta|")) { if (label.hasSubstring("|ci$")) { color = Qt::darkGreen; + peak_color = Qt::green; } else if (label.hasSubstring("|xi$")) { color = Qt::darkRed; + peak_color = Qt::red; } } else // different colors for left/right fragments (e.g. b/y ions) { color = (label.at(0) < 'n') ? Qt::darkRed : Qt::darkGreen; + peak_color = (label.at(0) < 'n') ? Qt::red : Qt::green; } Annotation1DItem* item = new Annotation1DPeakItem(position, label.toQString(), color); + annotated_layer.peak_colors_1d.push_back(peak_color); item->setSelected(false); tv_->getActive1DWidget()->canvas()->getCurrentLayer().getCurrentAnnotations().push_front(item); } From 01a39fa1ee6c6955bea7c25c8fa58ff4d11c8e98 Mon Sep 17 00:00:00 2001 From: jpfeuffer Date: Thu, 1 Mar 2018 13:57:43 +0100 Subject: [PATCH 09/12] [FIX] PyOpenMS CMakeLists now supporting any Xerces version and static/dynamic. --- src/pyOpenMS/CMakeLists.txt | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/pyOpenMS/CMakeLists.txt b/src/pyOpenMS/CMakeLists.txt index 746e83d9188..11427f1987b 100644 --- a/src/pyOpenMS/CMakeLists.txt +++ b/src/pyOpenMS/CMakeLists.txt @@ -353,17 +353,20 @@ if(WIN32) file(COPY ${_runtime} DESTINATION ${CMAKE_BINARY_DIR}/pyOpenMS/pyopenms NO_SOURCE_PERMISSIONS) endforeach() - set(FOUND_XERCES FALSE) - foreach(CONTRIB_PATH ${CMAKE_PREFIX_PATH}) - if(EXISTS ${CONTRIB_PATH}/lib/xerces-c_3_1.dll) - file(COPY ${CONTRIB_PATH}/lib/xerces-c_3_1.dll DESTINATION ${CMAKE_BINARY_DIR}/pyOpenMS/pyopenms) - set(FOUND_XERCES TRUE) - message(STATUS "found xerces-c-3_1_dll") - endif() - endforeach() - if(NOT FOUND_XERCES) - message(FATAL_ERROR "could not find xerces-c_3_1.dll in contrib dir") - endif() + find_package(XercesC) + if (XercesC_FOUND) + get_filename_component(XercesC_LIBRARY_RELEASE_DIR ${XercesC_LIBRARY_RELEASE} DIRECTORY) + get_filename_component(XercesC_LIBRARY_RELEASE_BASENAME ${XercesC_LIBRARY_RELEASE} NAME_WE) + message("-- Looking for Xerces in Path found by module: ${XercesC_LIBRARY_RELEASE_DIR}/${XercesC_LIBRARY_RELEASE_BASENAME}") + if(EXISTS "${XercesC_LIBRARY_RELEASE_DIR}/${XercesC_LIBRARY_RELEASE_BASENAME}.dll" ) + message("-- Found XercesC DLL. Assuming dynamic linkage. Copying.") + file(COPY "${XercesC_LIBRARY_RELEASE_DIR}/${XercesC_LIBRARY_RELEASE_BASENAME}.dll" DESTINATION ${CMAKE_BINARY_DIR}/pyOpenMS/pyopenms) + else() + message("-- XercesC found only with lib extension. Assuming static library. Not copying.") + endif() + else() + message(FATAL_ERROR "-- XercesC not found during pyOpenMS configure. If it went through the initial OpenMS configure, please report.") + endif() endif() find_boost() From 12b7a790e32191b4fe50588966200e69be65d3f3 Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Thu, 1 Mar 2018 14:53:20 +0100 Subject: [PATCH 10/12] fix: changed if else loop structure --- .../ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp | 55 +++++++++++-------- .../QUANTITATION/AbsoluteQuantitation.cpp | 54 ++++++++++-------- 2 files changed, 62 insertions(+), 47 deletions(-) diff --git a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp index f6f97b93e5d..d5fe5793b62 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp @@ -368,35 +368,42 @@ namespace OpenMS double MRMFeatureFilter::calculateIonRatio(const Feature & component_1, const Feature & component_2, const String & feature_name) { - double ratio = 0.0; - if (feature_name == "intensity" && component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) - { - const double feature_1 = component_1.getIntensity(); - const double feature_2 = component_2.getIntensity(); - ratio = feature_1 / feature_2; - } - else if (feature_name == "intensity" && component_1.metaValueExists("native_id")) - { - LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; - const double feature_1 = component_1.getIntensity(); - ratio = feature_1; - } - else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + // member feature_name access + if (feature_name == "intensity") { - double feature_1 = component_1.getMetaValue(feature_name); - double feature_2 = component_2.getMetaValue(feature_name); - ratio = feature_1/feature_2; - } - else if (component_1.metaValueExists(feature_name)) - { - LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; - double feature_1 = component_1.getMetaValue(feature_name); - ratio = feature_1; + if (component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) + { + const double feature_1 = component_1.getIntensity(); + const double feature_2 = component_2.getIntensity(); + ratio = feature_1 / feature_2; + } + else if (component_1.metaValueExists("native_id")) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getIntensity(); + ratio = feature_1; + } } + // metaValue feature_name access else { - LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; + else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + { + const double feature_1 = component_1.getMetaValue(feature_name); + const double feature_2 = component_2.getMetaValue(feature_name); + ratio = feature_1/feature_2; + } + else if (component_1.metaValueExists(feature_name)) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getMetaValue(feature_name); + ratio = feature_1; + } + else + { + LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; + } } return ratio; diff --git a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp index e41c444fa46..8d277b59c79 100644 --- a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp +++ b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp @@ -136,33 +136,41 @@ namespace OpenMS double AbsoluteQuantitation::calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name) { double ratio = 0.0; - if (feature_name == "intensity" && component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) + // member feature_name access + if (feature_name == "intensity") { - const double feature_1 = component_1.getIntensity(); - const double feature_2 = component_2.getIntensity(); - ratio = feature_1 / feature_2; - } - else if (feature_name == "intensity" && component_1.metaValueExists("native_id")) - { - LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; - const double feature_1 = component_1.getIntensity(); - ratio = feature_1; - } - else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) - { - double feature_1 = component_1.getMetaValue(feature_name); - double feature_2 = component_2.getMetaValue(feature_name); - ratio = feature_1/feature_2; - } - else if (component_1.metaValueExists(feature_name)) - { - LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; - double feature_1 = component_1.getMetaValue(feature_name); - ratio = feature_1; + if (component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) + { + const double feature_1 = component_1.getIntensity(); + const double feature_2 = component_2.getIntensity(); + ratio = feature_1 / feature_2; + } + else if (component_1.metaValueExists("native_id")) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getIntensity(); + ratio = feature_1; + } } + // metaValue feature_name access else { - LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; + else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + { + const double feature_1 = component_1.getMetaValue(feature_name); + const double feature_2 = component_2.getMetaValue(feature_name); + ratio = feature_1/feature_2; + } + else if (component_1.metaValueExists(feature_name)) + { + LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; + const double feature_1 = component_1.getMetaValue(feature_name); + ratio = feature_1; + } + else + { + LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; + } } return ratio; From 12258ca20e8bb442cdafab4c3a68bf102d7e9f46 Mon Sep 17 00:00:00 2001 From: jpfeuffer Date: Thu, 1 Mar 2018 15:18:17 +0100 Subject: [PATCH 11/12] Added comment and removed unsuffixed name from Debug libraries. select_library_config will do that for us. It just increases chances that two different libraries are found on non-win systems otherwise. --- cmake/modules/FindXercesC.cmake | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmake/modules/FindXercesC.cmake b/cmake/modules/FindXercesC.cmake index 1fb5e11424d..13ffc5bebe3 100644 --- a/cmake/modules/FindXercesC.cmake +++ b/cmake/modules/FindXercesC.cmake @@ -54,8 +54,10 @@ find_path( # Find the xerces libraries if (NOT XercesC_LIBRARIES) - find_library(XercesC_LIBRARY_RELEASE NAMES xerces-c xerces-c_3 xerces-c_3_1 xerces-c-3.1 xerces-c_3_2 xerces-c-3.2 ${_XercesC_PATHS} PATH_SUFFIXES lib) - find_library(XercesC_LIBRARY_DEBUG NAMES xerces-c xerces-c_3D xerces-c_3_1D xerces-c-3.1D xerces-c_3_2D xerces-c-3.2D ${_XercesC_PATHS} PATH_SUFFIXES lib) + ## The NAMES_PER_DIR option will make sure that the PATHS are the "outer for loop" when searching for the libraries. + ## We want that because we put the contrib as the first search path usually. + find_library(XercesC_LIBRARY_RELEASE NAMES xerces-c xerces-c_3 xerces-c_3_1 xerces-c-3.1 xerces-c_3_2 xerces-c-3.2 NAMES_PER_DIR ${_XercesC_PATHS} PATH_SUFFIXES lib) + find_library(XercesC_LIBRARY_DEBUG NAMES xerces-c_3D xerces-c_3_1D xerces-c-3.1D xerces-c_3_2D xerces-c-3.2D NAMES_PER_DIR ${_XercesC_PATHS} PATH_SUFFIXES lib) include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake) select_library_configurations(XercesC) From 28608fc2bf508f69c64c49cdb77e029170fed810 Mon Sep 17 00:00:00 2001 From: Douglas McCloskey Date: Thu, 1 Mar 2018 16:32:13 +0100 Subject: [PATCH 12/12] fix: if else bug --- src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp | 2 +- .../source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp index d5fe5793b62..c32d95af8cc 100644 --- a/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp +++ b/src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp @@ -388,7 +388,7 @@ namespace OpenMS // metaValue feature_name access else { - else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) { const double feature_1 = component_1.getMetaValue(feature_name); const double feature_2 = component_2.getMetaValue(feature_name); diff --git a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp index 8d277b59c79..b26fdda075d 100644 --- a/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp +++ b/src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp @@ -155,7 +155,7 @@ namespace OpenMS // metaValue feature_name access else { - else if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) + if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) { const double feature_1 = component_1.getMetaValue(feature_name); const double feature_2 = component_2.getMetaValue(feature_name);