86 if (data.empty())
return;
87 use_feature_rt_ = param_.getValue(
"use_feature_rt").toBool();
89 bool sorted = getRetentionTimes_(data, rt_data);
90 computeMedians_(rt_data, reference_, sorted);
91 if (reference_.empty())
93 throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Could not extract retention time information from the reference file");
104 template <
typename DataType>
105 void align(std::vector<DataType>& data,
106 std::vector<TransformationDescription>& transformations,
107 Int reference_index = -1)
109 checkParameters_(data.size());
110 startProgress(0, 3,
"aligning maps");
112 reference_index_ = reference_index;
114 bool use_internal_reference = (reference_index >= 0);
115 if (use_internal_reference)
117 if (reference_index >= static_cast<Int>(data.size()))
120 OPENMS_PRETTY_FUNCTION, reference_index,
123 setReference(data[reference_index]);
127 std::vector<SeqToList> rt_data(data.size() - use_internal_reference);
128 bool all_sorted =
true;
129 for (
Size i = 0, j = 0; i < data.size(); ++i)
131 if ((reference_index >= 0) && (i ==
Size(reference_index)))
135 all_sorted &= getRetentionTimes_(data[i], rt_data[j++]);
139 computeTransformations_(rt_data, transformations, all_sorted);
184 void computeMedians_(SeqToList& rt_data, SeqToValue& medians,
185 bool sorted =
false);
195 bool getRetentionTimes_(std::vector<PeptideIdentification>& peptides,
206 bool getRetentionTimes_(
PeakMap& experiment, SeqToList& rt_data);
222 template <
typename MapType>
230 else if (features[0].getPeptideIdentifications()[0].isHigherScoreBetter())
232 better_ = [](
double a,
double b)
237 better_ = [](
double a,
double b)
242 feat_it != features.
end(); ++feat_it)
248 double rt_distance = std::numeric_limits<double>::max();
249 bool any_hit =
false;
250 for (std::vector<PeptideIdentification>::iterator pep_it =
251 feat_it->getPeptideIdentifications().begin(); pep_it !=
252 feat_it->getPeptideIdentifications().end(); ++pep_it)
254 if (!pep_it->getHits().empty())
257 double current_distance = fabs(pep_it->getRT() -
259 if (current_distance < rt_distance)
262 if (better_(pep_it->getHits()[0].getScore(), min_score_))
264 sequence = pep_it->getHits()[0].getSequence().toString();
265 rt_distance = current_distance;
271 if (any_hit) rt_data[sequence].push_back(feat_it->getRT());
275 getRetentionTimes_(feat_it->getPeptideIdentifications(), rt_data);
279 if (!use_feature_rt_ &&
280 param_.getValue(
"use_unassigned_peptides").toBool())
282 getRetentionTimes_(features.getUnassignedPeptideIdentifications(),
288 for (SeqToList::iterator rt_it = rt_data.begin(); rt_it != rt_data.end();
292 sort(rt_values.begin(), rt_values.end());
293 DoubleList::iterator it = unique(rt_values.begin(), rt_values.end());
294 rt_values.resize(it - rt_values.begin());
306 void computeTransformations_(std::vector<SeqToList>& rt_data,
307 std::vector<TransformationDescription>&
308 transforms,
bool sorted =
false);
317 void checkParameters_(
const Size runs);
325 void getReference_();
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:170
A more convenient string class.
Definition: String.h:58
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
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:105
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:158
bool getRetentionTimes_(MapType &features, SeqToList &rt_data)
Collect retention time data ("RT" MetaInfo) from peptide IDs contained in feature maps or consensus m...
Definition: MapAlignmentAlgorithmIdentification.h:223
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:161
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
Int reference_index_
Index of input file to use as reference (if any)
Definition: MapAlignmentAlgorithmIdentification.h:155
bool use_feature_rt_
Use feature RT instead of RT from best peptide ID in the feature.
Definition: MapAlignmentAlgorithmIdentification.h:164
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:62
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
std::map< String, double > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:152
Int overflow exception.
Definition: Exception.h:254
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
Not all required information provided.
Definition: Exception.h:195
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:71
Iterator begin()
Definition: MSExperiment.h:157
double min_score_
Minimum score to reach for a peptide to be considered.
Definition: MapAlignmentAlgorithmIdentification.h:167
Iterator end()
Definition: MSExperiment.h:167
void setReference(DataType &data)
Definition: MapAlignmentAlgorithmIdentification.h:83
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:149