Skip to content

Commit

Permalink
Merge branch 'develop' into toppas_outdir
Browse files Browse the repository at this point in the history
  • Loading branch information
cbielow authored Oct 7, 2024
2 parents f99f46f + d8b2c3b commit 2d513ea
Show file tree
Hide file tree
Showing 12 changed files with 202 additions and 183 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ the authors tag in the respective file header.
- Radu Suciu
- Ralf Gabriels
- Rene Hussong
- Rick Helmus
- Ruben Grünberg
- Samuel Wein
- Sandro Andreotti
Expand Down
6 changes: 3 additions & 3 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ PR - Pull Request (on GitHub), i.e. integration of a new feature or bugfix
------------------------------------------------------------------------------------------
---- OpenMS 3.3.0 (under development) ----
------------------------------------------------------------------------------------------

What's new:
- Changes breaking backwards compatibility:
- the QualityControl TOPP tool has some renamed parameters and supports output directories (#7497)
Expand All @@ -22,14 +23,13 @@ Misc:
- TOPPAS
- supports writing results to output directories (for TOPP tools which have such parameters) (#7497)
- TOPPAS tutorial enhanced (#7497)

- FeatureFinderMetabo
- added report_smoothed_intensities parameter (#7594)

------------------------------------------------------------------------------------------
---- OpenMS 3.2.0 (released 09/2024) ----
------------------------------------------------------------------------------------------



What's new:
- Changes breaking backwards compatibility:
- Rename of parameters for TOPP tool FeatureFinderCentroided (debug -> advanced), and PeakPickerWavelet/TOFCalibration (optimization -> optimization:type) (#7154)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ namespace OpenMS
bool enable_RT_filtering_;
String isotope_filtering_model_;
bool use_smoothed_intensities_;

bool report_smoothed_intensities_;

bool use_mz_scoring_C13_;
bool use_mz_scoring_by_element_range_;
bool report_convex_hulls_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ namespace OpenMS
{
OPENMS_LOG_DEBUG << "Correction matrix is the identity matrix." << std::endl;
OPENMS_LOG_DEBUG << correction_matrix << std::endl;

// workaround: TMT11plex has a special case where the correction matrix is the identity matrix
if (quant_method->getMethodName() != "tmt11plex")
{
throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,

throw Exception::InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"IsobaricIsotopeCorrector: The given isotope correction matrix is an identity matrix leading to no correction. "
"Please provide a valid isotope_correction matrix as it was provided with the sample kit!");
}
"Please provide a valid isotope_correction matrix as it was provided with the sample kit!");
}

Eigen::FullPivLU<Eigen::MatrixXd> ludecomp(correction_matrix.getEigenMatrix());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ void TMTElevenPlexQuantitationMethod::setDefaultParams_()
defaults_.setValue("reference_channel", "126", "The reference channel (126, 127N, 127C, 128N, 128C, 129N, 129C, 130N, 130C, 131N, 131C).");
defaults_.setValidStrings("reference_channel", TMTElevenPlexQuantitationMethod::channel_names_);

defaults_.setValue("correction_matrix", std::vector<std::string>{"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0"},
"Correction matrix for isotope distributions (see documentation); use the following format: <-2Da>/<-1Da>/<+1Da>/<+2Da>; e.g. '0/0.3/4/0', '0.1/0.3/3/0.2'");
// default: Product Number: A37725 Lot Number: ZF395505
defaults_.setValue("correction_matrix", std::vector<std::string>{
"0.0/0.0/8.6/0.3",
"0.0/0.1/7.8/0.1",
"0.0/0.8/6.9/0.1",
"0.0/7.4/7.4/0.0",
"0.0/1.5/6.2/0.2",
"0.0/1.5/5.7/0.1",
"0.0/2.6/4.8/0.0",
"0.0/2.2/4.6/0.0",
"0.0/2.8/4.5/0.1",
"0.1/2.9/3.8/0.0",
"0.0/3.9/2.8/0.0"
},
"Correction matrix for isotope distributions (see documentation); use the following format: <-2Da>/<-1Da>/<+1Da>/<+2Da>; e.g. '0/0.3/4/0', '0.1/0.3/3/0.2'");

defaultsToParam_();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,16 @@ namespace OpenMS
defaults_.setMinInt("reference_channel", 126);
defaults_.setMaxInt("reference_channel", 131);

// {0.0, 1.0, 5.9, 0.2}, //114
// {0.0, 2.0, 5.6, 0.1},
// {0.0, 3.0, 4.5, 0.1},
// {0.1, 4.0, 3.5, 0.1} //117
defaults_.setValue("correction_matrix", std::vector<std::string>{"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0",
"0.0/0.0/0.0/0.0"},
"Correction matrix for isotope distributions (see documentation); use the following format: <-2Da>/<-1Da>/<+1Da>/<+2Da>; e.g. '0/0.3/4/0', '0.1/0.3/3/0.2'");
// default: Product Number: 90061 Lot Number: ZE386964
defaults_.setValue("correction_matrix", std::vector<std::string>{
"0.0/0.0/8.6/0.3",
"0.0/0.1/7.8/0.1",
"0.0/1.5/6.2/0.2",
"0.0/1.5/5.7/0.1",
"0.0/3.1/3.6/0.0",
"0.1/2.9/3.8/0.0"
},
"Correction matrix for isotope distributions (see documentation); use the following format: <-2Da>/<-1Da>/<+1Da>/<+2Da>; e.g. '0/0.3/4/0', '0.1/0.3/3/0.2'");

defaultsToParam_();
}
Expand Down
18 changes: 14 additions & 4 deletions src/openms/source/FEATUREFINDER/FeatureFindingMetabo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ namespace OpenMS

defaults_.setValue("use_smoothed_intensities", "true", "Use LOWESS intensities instead of raw intensities.", {"advanced"});
defaults_.setValidStrings("use_smoothed_intensities", {"false","true"});
defaults_.setValue("report_smoothed_intensities", "true", "Report smoothed intensities (only if use_smoothed_intensities is true).", {"advanced"});
defaults_.setValidStrings("report_smoothed_intensities", {"false","true"});

defaults_.setValue("report_convex_hulls", "false", "Augment each reported feature with the convex hull of the underlying mass traces (increases featureXML file size considerably).");
defaults_.setValidStrings("report_convex_hulls", {"false","true"});
Expand Down Expand Up @@ -307,6 +309,14 @@ namespace OpenMS

isotope_filtering_model_ = param_.getValue("isotope_filtering_model").toString();
use_smoothed_intensities_ = param_.getValue("use_smoothed_intensities").toBool();
bool use_smoothed = param_.getValue("use_smoothed_intensities").toBool();
bool report_smoothed = param_.getValue("report_smoothed_intensities").toBool();
if (report_smoothed && !use_smoothed) {
OPENMS_LOG_WARN << "Warning: 'report_smoothed_intensities' is set to true, but 'use_smoothed_intensities' is false. Ignoring 'report_smoothed_intensities'." << std::endl;
report_smoothed = false;
}
use_smoothed_intensities_ = use_smoothed;
report_smoothed_intensities_ = report_smoothed;

use_mz_scoring_C13_ = param_.getValue("mz_scoring_13C").toBool();
report_convex_hulls_ = param_.getValue("report_convex_hulls").toBool();
Expand Down Expand Up @@ -1002,20 +1012,20 @@ namespace OpenMS

if (report_summed_ints_)
{
f.setIntensity(feat_hypos[hypo_idx].getSummedFeatureIntensity(use_smoothed_intensities_));
f.setIntensity(feat_hypos[hypo_idx].getSummedFeatureIntensity(report_smoothed_intensities_));
}
else
{
f.setIntensity(feat_hypos[hypo_idx].getMonoisotopicFeatureIntensity(use_smoothed_intensities_));
f.setIntensity(feat_hypos[hypo_idx].getMonoisotopicFeatureIntensity(report_smoothed_intensities_));
}

f.setWidth(feat_hypos[hypo_idx].getFWHM());
f.setCharge(feat_hypos[hypo_idx].getCharge());
f.setMetaValue(3, feat_hypos[hypo_idx].getLabel());
f.setMetaValue("max_height", feat_hypos[hypo_idx].getMaxIntensity(use_smoothed_intensities_));
f.setMetaValue("max_height", feat_hypos[hypo_idx].getMaxIntensity(report_smoothed_intensities_));

// store isotope intensities
std::vector<double> all_ints(feat_hypos[hypo_idx].getAllIntensities(use_smoothed_intensities_));
std::vector<double> all_ints(feat_hypos[hypo_idx].getAllIntensities(report_smoothed_intensities_));
f.setMetaValue(Constants::UserParam::NUM_OF_MASSTRACES, all_ints.size());
if (report_convex_hulls_) f.setConvexHulls(feat_hypos[hypo_idx].getConvexHulls());
f.setOverallQuality(feat_hypos[hypo_idx].getScore());
Expand Down
27 changes: 19 additions & 8 deletions src/openms/source/METADATA/SpectrumLookup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,18 @@ namespace OpenMS
boost::sregex_token_iterator current_begin(native_id.begin(), native_id.end(), regexp, subgroups);
boost::sregex_token_iterator current_end(native_id.end(), native_id.end(), regexp, subgroups);
matches.insert(matches.end(), current_begin, current_end);
if (matches.size() == 1) // default case: one native identifier

if (matches.size() < subgroups.size()) {
OPENMS_LOG_WARN << "native_id '" << native_id <<"' is invalid. Could not extract scan number." << std::endl;
return -1;
}

if (subgroups.size() == 1) // default case: one native identifier
{
try
{
String value = String(matches[0]);
// In case of merged spectra the last native id matches the scan number of the merged scan.
String value = String(matches[matches.size() - 1]);
if (native_id_type_accession == "MS:1000774")
{
return value.toInt() + 1; // if the native ID is index=.., the scan number is usually considered index+1 (especially for pepXML)
Expand All @@ -334,27 +341,31 @@ namespace OpenMS
}
catch (Exception::ConversionError&)
{
OPENMS_LOG_WARN << "Value: '" << String(matches[0]) << "' could not be converted to int in string. Native ID='" << native_id << "'" << std::endl;
OPENMS_LOG_WARN << "Value: '" << String(matches[matches.size() - 1]) << "' could not be converted to int in string. Native ID='" << native_id << "'" << std::endl;
return -1;
}
}
else if (matches.size() == 2) // special case: wiff file with two native identifiers
else if (subgroups.size() == 2) // special case: wiff file with two native identifiers
{
try
{
if (String(matches[1]).toInt() < 1000) // checks if value of experiment is smaller than 1000 (cycle * 1000 + experiment)
// In case of merged spectra the last native id matches the scan number of the merged scan.
String cycle_str = matches[matches.size() - 2];
String experiment_str = matches[matches.size() - 1];

if (experiment_str.toInt() < 1000) // checks if value of experiment is smaller than 1000 (cycle * 1000 + experiment)
{
int value = String(matches[0]).toInt() * 1000 + String(matches[1]).toInt();
int value = cycle_str.toInt() * 1000 + experiment_str.toInt();
return value;
}
else
{
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The value of experiment is too large and can not be handled properly.", String(matches[1]));
throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "The value of experiment is too large and can not be handled properly.", experiment_str);
}
}
catch (Exception::ConversionError&)
{
OPENMS_LOG_WARN << "Value: '" << String(matches[0]) << "' could not be converted to int in string. Native ID='"
OPENMS_LOG_WARN << "Values: '" << matches[matches.size() - 2] << "', '" << matches[matches.size() - 1] << "' could not be converted to int in string. Native ID='"
<< native_id << "' accession='" << native_id_type_accession << "'" << std::endl;
return -1;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ START_SECTION((virtual Matrix<double> getIsotopeCorrectionMatrix() const ))
{
for (size_t j = 0; j < m.cols(); ++j)
{
if (i == j) { TEST_REAL_SIMILAR(m(i,j), 1.0) }
else { TEST_REAL_SIMILAR(m(i,j), 0.0) }
if (i == j) { TEST_TRUE(m(i,j) > 0.5 ) } // diagonal entries should be largest
else { TEST_TRUE(m(i,j) < 0.5) }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,8 @@ START_SECTION((virtual Matrix<double> getIsotopeCorrectionMatrix() const ))
{
for(size_t j = 0; j < m.cols(); ++j)
{
if (i == j)
TEST_REAL_SIMILAR(m(i,j), 1.0)
else
TEST_REAL_SIMILAR(m(i,j), 0.0)
if (i == j) { TEST_TRUE(m(i,j) > 0.5) } // diagonal entries should be largest
else { TEST_TRUE(m(i,j) < 0.5) }
}
}
}
Expand Down
Loading

0 comments on commit 2d513ea

Please sign in to comment.