87 if (data.empty())
return;
90 use_feature_rt_ = param_.getValue(
"use_feature_rt").toBool();
91 score_cutoff_ = param_.getValue(
"score_cutoff").toBool();
92 score_type_ = (std::string)param_.getValue(
"score_type");
93 bool sorted = getRetentionTimes_(data, rt_data);
94 computeMedians_(rt_data, reference_, sorted);
96 if (reference_.empty())
98 throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Could not extract retention time information from the reference file");
111 template <
typename DataType>
112 void align(std::vector<DataType>& data,
113 std::vector<TransformationDescription>& transformations,
114 Int reference_index = -1)
116 checkParameters_(data.size());
117 startProgress(0, 3,
"aligning maps");
119 reference_index_ = reference_index;
121 bool use_internal_reference = (reference_index >= 0);
122 if (use_internal_reference)
124 if (reference_index >=
Int(data.size()))
127 OPENMS_PRETTY_FUNCTION,
128 reference_index, data.size());
130 setReference(data[reference_index]);
134 std::vector<SeqToList> rt_data(data.size() - use_internal_reference);
135 bool all_sorted =
true;
136 for (
Size i = 0, j = 0; i < data.size(); ++i)
138 if ((reference_index >= 0) && (i ==
Size(reference_index)))
142 all_sorted &= getRetentionTimes_(data[i], rt_data[j++]);
146 computeTransformations_(rt_data, transformations, all_sorted);
197 void computeMedians_(SeqToList& rt_data, SeqToValue& medians,
198 bool sorted =
false);
208 bool getRetentionTimes_(std::vector<PeptideIdentification>& peptides,
230 bool getRetentionTimes_(
PeakMap& experiment, SeqToList& rt_data);
246 template <
typename MapType>
254 else if (features[0].getPeptideIdentifications()[0].isHigherScoreBetter())
256 better_ = [](
double a,
double b)
261 better_ = [](
double a,
double b)
266 feat_it != features.
end(); ++feat_it)
272 double rt_distance = std::numeric_limits<double>::max();
273 bool any_hit =
false;
274 for (std::vector<PeptideIdentification>::iterator pep_it =
275 feat_it->getPeptideIdentifications().begin(); pep_it !=
276 feat_it->getPeptideIdentifications().end(); ++pep_it)
278 if (!pep_it->getHits().empty())
281 double current_distance = fabs(pep_it->getRT() -
283 if (current_distance < rt_distance)
286 if (better_(pep_it->getHits()[0].getScore(), min_score_))
288 sequence = pep_it->getHits()[0].getSequence().toString();
289 rt_distance = current_distance;
295 if (any_hit) rt_data[sequence].push_back(feat_it->getRT());
299 getRetentionTimes_(feat_it->getPeptideIdentifications(), rt_data);
303 if (!use_feature_rt_ &&
304 param_.getValue(
"use_unassigned_peptides").toBool())
306 getRetentionTimes_(features.getUnassignedPeptideIdentifications(),
312 for (SeqToList::iterator rt_it = rt_data.begin(); rt_it != rt_data.end();
316 sort(rt_values.begin(), rt_values.end());
317 DoubleList::iterator it = unique(rt_values.begin(), rt_values.end());
318 rt_values.resize(it - rt_values.begin());
330 void computeTransformations_(std::vector<SeqToList>& rt_data,
331 std::vector<TransformationDescription>&
332 transforms,
bool sorted =
false);
341 void checkParameters_(
const Size runs);
348 void getReference_();
A more convenient string class.
Definition: String.h:58
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:62
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:103
bool use_feature_rt_
Use feature RT instead of RT from best peptide ID in the feature?
Definition: MapAlignmentAlgorithmIdentification.h:171
Int overflow exception.
Definition: Exception.h:245
Iterator begin()
Definition: MSExperiment.h:182
Definition: IdentificationData.h:112
bool getRetentionTimes_(MapType &features, SeqToList &rt_data)
Collect retention time data from peptide IDs contained in feature maps or consensus maps...
Definition: MapAlignmentAlgorithmIdentification.h:247
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Int reference_index_
Index of input file to use as reference (if any)
Definition: MapAlignmentAlgorithmIdentification.h:162
Iterator end()
Definition: MSExperiment.h:192
bool score_cutoff_
Actually use the above defined score_cutoff? Needed since it is hard to define a non-cutting score fo...
Definition: MapAlignmentAlgorithmIdentification.h:180
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:72
void align(std::vector< DataType > &data, std::vector< TransformationDescription > &transformations, Int reference_index=-1)
Align feature maps, consensus maps, peak maps, or peptide identifications.
Definition: MapAlignmentAlgorithmIdentification.h:112
String score_type_
Score type to use for filtering.
Definition: MapAlignmentAlgorithmIdentification.h:183
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:156
double min_score_
Minimum score to reach for a peptide to be considered.
Definition: MapAlignmentAlgorithmIdentification.h:177
In-Memory representation of a mass spectrometry run.
Definition: MSExperiment.h:70
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:52
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:168
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:165
int Int
Signed integer type.
Definition: Types.h:102
void setReference(DataType &data)
Definition: MapAlignmentAlgorithmIdentification.h:84
std::map< String, double > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:159
Wrapper that adds operator< to iterators, so they can be used as (part of) keys in maps/sets or multi...
Definition: MetaData.h:45
bool use_adducts_
Consider differently adducted IDs as different?
Definition: MapAlignmentAlgorithmIdentification.h:174