void MapAlignmentTransformer::applyToBaseFeature_(BaseFeature & feature, const TransformationDescription & trafo) { // transform feature position: DoubleReal rt = feature.getRT(); feature.setRT(trafo.apply(rt)); // adapt RT values of annotated peptides: if (!feature.getPeptideIdentifications().empty()) { transformSinglePeptideIdentification(feature.getPeptideIdentifications(), trafo); } }
void MapAlignmentTransformer::applyToBaseFeature_( BaseFeature& feature, const TransformationDescription& trafo, bool store_original_rt) { // transform feature position: double rt = feature.getRT(); if (store_original_rt) storeOriginalRT_(feature, rt); feature.setRT(trafo.apply(rt)); // adapt RT values of annotated peptides: if (!feature.getPeptideIdentifications().empty()) { transformRetentionTimes(feature.getPeptideIdentifications(), trafo, store_original_rt); } }
pair<bool, DoubleReal> FeatureDistance::operator()(const BaseFeature & left, const BaseFeature & right) { if (!ignore_charge_) { Int charge_left = left.getCharge(), charge_right = right.getCharge(); if (charge_left != charge_right) { if ((charge_left != 0) && (charge_right != 0)) { return make_pair(false, infinity); } } } bool valid = true; // check m/z difference constraint: DoubleReal left_mz = left.getMZ(), right_mz = right.getMZ(); DoubleReal dist_mz = fabs(left_mz - right_mz); DoubleReal max_diff_mz = params_mz_.max_difference; if (params_mz_.max_diff_ppm) // compute absolute difference (in Da/Th) { max_diff_mz *= left_mz * 1e-6; // overwrite this parameter - it will be recomputed each time anyway: params_mz_.norm_factor = 1 / max_diff_mz; } if (dist_mz > max_diff_mz) { if (force_constraints_) { return make_pair(false, infinity); } valid = false; } // check RT difference constraint: DoubleReal dist_rt = fabs(left.getRT() - right.getRT()); if (dist_rt > params_rt_.max_difference) { if (force_constraints_) { return make_pair(false, infinity); } valid = false; } dist_rt = distance_(dist_rt, params_rt_); dist_mz = distance_(dist_mz, params_mz_); DoubleReal dist_intensity = 0.0; if (params_intensity_.relevant) // not by default, so worth checking { dist_intensity = fabs(left.getIntensity() - right.getIntensity()); dist_intensity = distance_(dist_intensity, params_intensity_); } DoubleReal dist = dist_rt + dist_mz + dist_intensity; dist *= total_weight_reciprocal_; return make_pair(valid, dist); }