Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/OpenMS/OpenMS into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
cbielow committed Mar 5, 2018
2 parents 0861584 + f8f7544 commit 347be9d
Show file tree
Hide file tree
Showing 12 changed files with 111 additions and 57 deletions.
6 changes: 4 additions & 2 deletions cmake/modules/FindXercesC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
50 changes: 31 additions & 19 deletions src/openms/source/ANALYSIS/OPENSWATH/MRMFeatureFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,30 +368,42 @@ namespace OpenMS

double MRMFeatureFilter::calculateIonRatio(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")
// 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;
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;
}
}
else if (component_1.metaValueExists(feature_name))
{
LOG_INFO << "Warning: no ion pair found for transition_id " << component_1.getMetaValue("native_id") << ".";
double feature_1 = component_1.getMetaValue(feature_name);
ratio = feature_1;
}
// metaValue feature_name access
else
{
LOG_INFO << "Feature metaValue " << feature_name << " not found for transition_ids " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << ".";
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;
Expand Down
2 changes: 1 addition & 1 deletion src/openms/source/ANALYSIS/OPENSWATH/PeakIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ 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.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;
}
Expand Down
48 changes: 31 additions & 17 deletions src/openms/source/ANALYSIS/QUANTITATION/AbsoluteQuantitation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,27 +136,41 @@ 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))
// 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 (feature_name == "intensity")
{
const double feature_1 = component_1.getIntensity();
const double feature_2 = component_2.getIntensity();
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") << ".";
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;
Expand Down
4 changes: 4 additions & 0 deletions src/openms_gui/include/OpenMS/VISUAL/LayerData.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ namespace OpenMS
gradient(),
filters(),
annotations_1d(),
peak_colors_1d(),
modifiable(false),
modified(false),
label(L_NONE),
Expand Down Expand Up @@ -308,6 +309,9 @@ namespace OpenMS
/// Annotations of all spectra of the experiment (1D view)
std::vector<Annotations1DContainer> annotations_1d;

/// Peak colors of the currently shown spectrum
std::vector<QColor> peak_colors_1d;

/// Flag that indicates if the layer data can be modified (so far used for features only)
bool modifiable;

Expand Down
10 changes: 10 additions & 0 deletions src/openms_gui/source/VISUAL/Spectrum1DCanvas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,16 @@ namespace OpenMS
{
if (layer.filters.passes(spectrum, it - spectrum.begin()))
{

// use peak colors stored in the layer, if available
if (layer.peak_colors_1d.size() == spectrum.size())
{
// find correct peak index
Size peak_index = std::distance(spectrum.begin(), it);
pen.setColor(layer.peak_colors_1d[peak_index]);
painter->setPen(pen);
}

dataToWidget(*it, end, layer.flipped);
dataToWidget(it->getMZ(), 0.0f, begin, layer.flipped);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
25 changes: 14 additions & 11 deletions src/pyOpenMS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/pyOpenMS/fix_pyopenms_dependencies_on_mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/tests/class_tests/openms/source/PeakIntegrator_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.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)
Expand Down Expand Up @@ -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.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)
Expand Down Expand Up @@ -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.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)
Expand Down Expand Up @@ -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.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)
Expand Down

0 comments on commit 347be9d

Please sign in to comment.