85 if (data.empty())
return;
87 bool sorted = getRetentionTimes_(data, rt_data);
88 computeMedians_(rt_data, reference_, sorted);
89 if (reference_.empty())
91 throw Exception::MissingInformation(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"Could not extract retention time information from the reference file");
102 template <
typename DataType>
103 void align(std::vector<DataType>& data,
104 std::vector<TransformationDescription>& transformations,
105 Int reference_index = -1)
107 checkParameters_(data.size());
108 startProgress(0, 3,
"aligning maps");
110 reference_index_ = reference_index;
112 bool use_internal_reference = (reference_index >= 0);
113 if (use_internal_reference)
115 if (reference_index >= data.size())
118 OPENMS_PRETTY_FUNCTION, reference_index,
121 setReference(data[reference_index]);
125 std::vector<SeqToList> rt_data(data.size() - use_internal_reference);
126 bool all_sorted =
true;
127 for (
Size i = 0, j = 0; i < data.size(); ++i)
129 if ((reference_index >= 0) && (i ==
Size(reference_index)))
133 all_sorted &= getRetentionTimes_(data[i], rt_data[j++]);
137 computeTransformations_(rt_data, transformations, all_sorted);
171 bool sorted =
false);
181 bool getRetentionTimes_(std::vector<PeptideIdentification>& peptides,
206 template <
typename MapType>
209 bool use_feature_rt = param_.getValue(
"use_feature_rt").toBool();
211 feat_it != features.
end(); ++feat_it)
217 double rt_distance = std::numeric_limits<double>::max();
218 bool any_hit =
false;
219 for (std::vector<PeptideIdentification>::iterator pep_it =
220 feat_it->getPeptideIdentifications().begin(); pep_it !=
221 feat_it->getPeptideIdentifications().end(); ++pep_it)
223 if (!pep_it->getHits().empty())
226 double current_distance = fabs(pep_it->getRT() -
228 if (current_distance < rt_distance)
231 sequence = pep_it->getHits()[0].getSequence().toString();
232 rt_distance = current_distance;
237 if (any_hit) rt_data[sequence].push_back(feat_it->getRT());
241 getRetentionTimes_(feat_it->getPeptideIdentifications(), rt_data);
245 if (!use_feature_rt &&
246 param_.getValue(
"use_unassigned_peptides").toBool())
248 getRetentionTimes_(features.getUnassignedPeptideIdentifications(),
254 for (SeqToList::iterator rt_it = rt_data.begin(); rt_it != rt_data.end();
258 sort(rt_values.begin(), rt_values.end());
259 DoubleList::iterator it = unique(rt_values.begin(), rt_values.end());
260 rt_values.resize(it - rt_values.begin());
272 void computeTransformations_(std::vector<SeqToList>& rt_data,
273 std::vector<TransformationDescription>&
274 transforms,
bool sorted =
false);
283 void checkParameters_(
const Size runs);
291 void getReference_();
A more convenient string class.
Definition: String.h:57
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:65
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
Int overflow exception.
Definition: Exception.h:254
Iterator begin()
Definition: MSExperiment.h:157
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:207
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Int reference_index_
Index of input file to use as reference (if any)
Definition: MapAlignmentAlgorithmIdentification.h:153
Iterator end()
Definition: MSExperiment.h:167
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:70
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:103
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:147
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
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:54
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:159
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:156
int Int
Signed integer type.
Definition: Types.h:102
void setReference(DataType &data)
Definition: MapAlignmentAlgorithmIdentification.h:82
std::map< String, double > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:150