-
Notifications
You must be signed in to change notification settings - Fork 5
Push MTD #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Push MTD #143
Conversation
|
||
// calc_left_border_ | ||
Size calc_left_border_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector<Apex>& apices_vec); | ||
|
||
// parameter stuff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does stuff mean?
Suggestion: more precise description
#include <omp.h> | ||
// #include <parallel/algorithm> | ||
// #include <ctime> | ||
#include <chrono> | ||
|
||
#include <OpenMS/MATH/MISC/MathFunctions.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sort includes lexicographically
@@ -193,6 +200,7 @@ namespace OpenMS | |||
|
|||
void MassTraceDetection::run(const PeakMap& input_exp, std::vector<MassTrace>& found_masstraces, const Size max_traces) | |||
{ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why blank line?
@@ -267,14 +276,48 @@ namespace OpenMS | |||
return; | |||
} // end of MassTraceDetection::run | |||
|
|||
double MassTraceDetection::find_offset_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector<Apex>& apices_vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double MassTraceDetection::find_offset_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector<Apex>& apices_vec) | |
double MassTraceDetection::find_offset_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& intput_map, const std::vector<Apex>& apices_vec) |
input_exp may not be concise name.
{ | ||
double centroid_mz = input_exp[apices_vec[peak_index_in_apices_vec].scan_idx][apices_vec[peak_index_in_apices_vec].peak_idx].getMZ(); //create function | ||
// double ftl_sd((centroid_mz / 1e6) * mass_error_ppm_); | ||
double ftl_sd = Math::ppmToMass(mass_error_ppm_,centroid_mz); // mit formel ergänzen header ppm to dalton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the name "ftl_sd" supposed to mean?
more precise naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coding convention! in several function names: instead of foo_bar() do fooBar()
double find_offset_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector& apices_vec);
Size j{}; | ||
while (input_exp[apices_vec[peak_index_in_apices_vec + j].scan_idx][apices_vec[peak_index_in_apices_vec + j].peak_idx].getMZ() <= right_bound) | ||
{ | ||
if(peak_index_in_apices_vec + j >= apices_vec.size()) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(peak_index_in_apices_vec + j >= apices_vec.size()) break; | |
if(peak_index_in_apices_vec + j >= apices_vec.size()) | |
{ | |
break; | |
} |
|
||
Size MassTraceDetection::calc_right_border_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector<Apex>& apices_vec) | ||
{ | ||
double right_bound = (input_exp[apices_vec[peak_index_in_apices_vec].scan_idx][apices_vec[peak_index_in_apices_vec].peak_idx].getMZ()) + (3 /* border gerade 3 mal so groß wie "noetig" */ * find_offset_(peak_index_in_apices_vec, mass_error_ppm_, input_exp, apices_vec)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double right_bound = (input_exp[apices_vec[peak_index_in_apices_vec].scan_idx][apices_vec[peak_index_in_apices_vec].peak_idx].getMZ()) + (3 /* border gerade 3 mal so groß wie "noetig" */ * find_offset_(peak_index_in_apices_vec, mass_error_ppm_, input_exp, apices_vec)); | |
double tmp_mz = input_exp[apices_vec[peak_index_in_apices_vec].scan_idx][apices_vec[peak_index_in_apices_vec].peak_idx].getMZ(); | |
double right_bound = tmp_mz + 3 * find_offset_(peak_index_in_apices_vec, mass_error_ppm_, input_exp, apices_vec); //border gerade 3 mal so groß wie "noetig" |
return peak_index_in_apices_vec + j; | ||
} | ||
|
||
Size MassTraceDetection::calc_left_border_(Size peak_index_in_apices_vec, double mass_error_ppm_, const PeakMap& input_exp, const std::vector<Apex>& apices_vec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as in right border :)
for (auto m_it = chrom_apices.crbegin(); m_it != chrom_apices.crend(); ++m_it) | ||
|
||
// Size binnumber{1}; | ||
Size binnumber = omp_get_max_threads(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Size binnumber = omp_get_max_threads(); | |
Size bin_number = omp_get_max_threads(); |
double prev_counter(apex_peak.getIntensity() * apex_peak.getMZ()); | ||
double prev_denom(apex_peak.getIntensity()); | ||
#pragma omp parallel for num_threads(binnumber) | ||
for (Size i = 0; i < binnumber; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (Size i = 0; i < binnumber; ++i) | |
for(Size i = 0; i < binnumber; ++i) |
{ | ||
return a.intensity > b.intensity; | ||
}); | ||
for (auto m_it = chrom_apices_2.cbegin(); m_it != chrom_apices_2.cend(); ++m_it) // iterate reverse from high intensity to low intensity |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (auto m_it = chrom_apices_2.cbegin(); m_it != chrom_apices_2.cend(); ++m_it) // iterate reverse from high intensity to low intensity | |
for(auto m_it = chrom_apices_2.cbegin(); m_it != chrom_apices_2.cend(); ++m_it) // iterate reverse from high intensity to low intensity |
std::sort(chrom_apices_2.begin(), chrom_apices_2.end(), // sort by intensity | ||
[](const Apex & a, const Apex & b) -> bool | ||
{ | ||
return a.intensity > b.intensity; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::sort(chrom_apices_2.begin(), chrom_apices_2.end(), // sort by intensity | |
[](const Apex & a, const Apex & b) -> bool | |
{ | |
return a.intensity > b.intensity; | |
}); | |
std::sort(chrom_apices_2.begin(), chrom_apices_2.end(), // sort by intensity | |
[](const Apex & a, const Apex & b) -> bool | |
{ | |
return a.intensity > b.intensity; | |
}); |
// Step 2.1 MOVE DOWN in RT dim | ||
// *********************************************************** // | ||
if ((trace_down_idx > 0) && toggle_down) | ||
std::list<PeakType> current_trace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use std:.vector if possible
std::list<PeakType> current_trace; | ||
double startint = work_exp[apex_scan_idx][apex_peak_idx].getIntensity(); | ||
current_trace.push_back(apex_peak); | ||
std::vector<double> fwhms_mz; // peak-FWHM meta values of collected peaks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does the s mean in fwhms_mz?
double prev_counter(apex_peak.getIntensity() * apex_peak.getMZ()); | ||
double prev_denom(apex_peak.getIntensity()); | ||
|
||
updateIterativeWeightedMeanMZ(apex_peak.getMZ(), apex_peak.getIntensity(), centroid_mz, prev_counter, prev_denom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updateIterativeWeightedMeanMZ(apex_peak.getMZ(), apex_peak.getIntensity(), centroid_mz, prev_counter, prev_denom); | |
updateIterativeWeightedMeanMZ(centroid_mz, prev_denom, centroid_mz, prev_counter, prev_denom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why multiple inputs of the same thing
while (((trace_down_idx > 0) && toggle_down) || | ||
((trace_up_idx < work_exp.size() - 1) && toggle_up) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while (((trace_down_idx > 0) && toggle_down) || | |
((trace_up_idx < work_exp.size() - 1) && toggle_up) | |
) | |
while (trace_down_idx > 0 && toggle_down || trace_up_idx < work_exp.size() - 1 && toggle_up) |
// *********************************************************** // | ||
// Step 2.1 MOVE DOWN in RT dim | ||
// *********************************************************** // | ||
if ((trace_down_idx > 0) && toggle_down) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((trace_down_idx > 0) && toggle_down) | |
if (trace_down_idx > 0 && toggle_down) |
if ((next_down_peak_mz <= right_bound) && | ||
(next_down_peak_mz >= left_bound) && | ||
!peak_visited_1[spec_offsets[trace_down_idx - 1] + next_down_peak_idx] | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((next_down_peak_mz <= right_bound) && | |
(next_down_peak_mz >= left_bound) && | |
!peak_visited_1[spec_offsets[trace_down_idx - 1] + next_down_peak_idx] | |
) | |
if (next_down_peak_mz <= right_bound && | |
next_down_peak_mz >= left_bound && | |
!peak_visited_1[spec_offsets[trace_down_idx - 1] + next_down_peak_idx]) |
// Update the m/z mean of the current trace as we added a new peak | ||
updateIterativeWeightedMeanMZ(next_down_peak_mz, next_down_peak_int, centroid_mz, prev_counter, prev_denom); | ||
gathered_idx.emplace_back(trace_down_idx - 1, next_down_peak_idx); | ||
if(next_down_peak_int > startint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this for debugging?
// *********************************************************** // | ||
// Step 2.2 MOVE UP in RT dim | ||
// *********************************************************** // | ||
if ((trace_up_idx < work_exp.size() - 1) && toggle_up) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((trace_up_idx < work_exp.size() - 1) && toggle_up) | |
if (trace_up_idx < work_exp.size() - 1 && toggle_up) |
if ((next_up_peak_mz <= right_bound) && | ||
(next_up_peak_mz >= left_bound) && | ||
!peak_visited_1[spec_offsets[trace_up_idx + 1] + next_up_peak_idx]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ((next_up_peak_mz <= right_bound) && | |
(next_up_peak_mz >= left_bound) && | |
!peak_visited_1[spec_offsets[trace_up_idx + 1] + next_up_peak_idx]) | |
if (next_up_peak_mz <= right_bound && | |
next_up_peak_mz >= left_bound && | |
!peak_visited_1[spec_offsets[trace_up_idx + 1] + next_up_peak_idx]) |
// Update the m/z variance dynamically | ||
if (reestimate_mt_sd_) // && (up_hitting_peak+1 > min_flank_scans)) | ||
{ | ||
// if (ftl_t > min_fwhm_scans) | ||
{ | ||
updateWeightedSDEstimateRobust(next_peak, centroid_mz, ftl_sd, intensity_so_far); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Update the m/z variance dynamically | |
if (reestimate_mt_sd_) // && (up_hitting_peak+1 > min_flank_scans)) | |
{ | |
// if (ftl_t > min_fwhm_scans) | |
{ | |
updateWeightedSDEstimateRobust(next_peak, centroid_mz, ftl_sd, intensity_so_far); | |
} | |
} | |
// Update the m/z variance dynamically | |
if (reestimate_mt_sd_)// && (up_hitting_peak+1 > min_flank_scans)) | |
{ | |
updateWeightedSDEstimateRobust(next_peak, centroid_mz, ftl_sd, intensity_so_far); | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly checked for syntax and coding convention
Description
Checklist
How can I get additional information on failed tests during CI
Click to expand
If your PR is failing you can check outIf you click in the column that lists the failed tests you will get detailed error messages.
Advanced commands (admins / reviewer only)
Click to expand
/reformat
(experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.rebuild jenkins
will retrigger Jenkins-based CI builds