|
OpenMS
2.5.0
|
Go to the documentation of this file.
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_();
OpenMS identification format (.idXML)
Definition: FileTypes.h:66
void setProgress(SignedSize value) const
Sets the current progress.
Representation of the Experimental Design in OpenMS. Instances can be loaded via the ExperimentalDesi...
Definition: ExperimentalDesign.h:85
static void buildTree(std::vector< FeatureMap > &feature_maps, std::vector< BinaryTreeNode > &tree, std::vector< std::vector< double >> &maps_ranges)
Extract RTs given for individual features of each map, calculate distances for each pair of maps and ...
Param copy(const String &prefix, bool remove_prefix=false) const
Returns a new Param object containing all entries that start with prefix.
static ExperimentalDesign load(const String &tsv_file, bool require_spectra_files)
Loads an experimental design from a tabular separated file.
Options for loading files containing features.
Definition: FeatureFileOptions.h:46
std::map< String, double > SeqToValue
Type to store one representative retention time per peptide sequence.
Definition: MapAlignmentAlgorithmIdentification.h:152
Size min_run_occur_
Minimum number of runs a peptide must occur in.
Definition: MapAlignmentAlgorithmIdentification.h:161
Retention time alignment of different maps.
Definition: DataProcessing.h:68
std::map< unsigned int, std::vector< String > > getFractionToMSFilesMapping() const
return fraction index to file paths (ordered by fraction_group)
void store(const String &filename, const PeakMap &map) const
Stores a map in an MzML file.
MzML file (.mzML)
Definition: FileTypes.h:72
File adapter for MzML files.
Definition: MzMLFile.h:55
A more convenient string class.
Definition: String.h:58
Iterator begin()
Definition: MSExperiment.h:157
std::vector< double > DoubleList
Vector of double precision real types.
Definition: ListUtils.h:62
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
OpenMS consensus map format (.consensusXML)
Definition: FileTypes.h:67
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
const DataValue & getValue(const String &key) const
Returns a value of a parameter.
void startProgress(SignedSize begin, SignedSize end, const String &label) const
Initializes the progress display.
void treeGuidedAlignment(const std::vector< BinaryTreeNode > &tree, std::vector< FeatureMap > feature_maps_transformed, std::vector< std::vector< double >> &maps_ranges, FeatureMap &map_transformed, std::vector< Size > &trafo_order)
Align feature maps tree guided using align() of OpenMS::MapAlignmentAlgorithmIdentification and use T...
void setReference(DataType &data)
Definition: MapAlignmentAlgorithmIdentification.h:83
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
void endProgress() const
Ends the progress display.
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
void load(const String &filename, std::vector< ProteinIdentification > &protein_ids, std::vector< PeptideIdentification > &peptide_ids)
Loads the identifications of an idXML file without identifier.
bool use_feature_rt_
Use feature RT instead of RT from best peptide ID in the feature.
Definition: MapAlignmentAlgorithmIdentification.h:164
int Int
Signed integer type.
Definition: Types.h:102
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
std::vector< SpectrumType >::iterator Iterator
Mutable iterator.
Definition: MSExperiment.h:111
UInt64 getSize() const
returns the total number of peaks
virtual void align(std::vector< PeakMap > &, std::vector< TransformationDescription > &)
Align peak maps.
OpenMS feature file (.featureXML)
Definition: FileTypes.h:65
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
double min_score_
Minimum score to reach for a peptide to be considered.
Definition: MapAlignmentAlgorithmIdentification.h:167
void load(const String &filename, PeakMap &map)
Loads a map from a MzML file. Spectra and chromatograms are sorted by default (this can be disabled u...
Bundles analyzing tools for a clustering (given as sequence of BinaryTreeNode's)
Definition: ClusterAnalyzer.h:51
Size loadSize(const String &filename)
void load(const String &filename, FeatureMap &feature_map)
loads the file with name filename into map and calls updateRanges().
Type
Actual file types enum.
Definition: FileTypes.h:58
void align(const FeatureMap &map, TransformationDescription &trafo)
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
void setOptions(const FeatureFileOptions &)
setter for options for loading/storing
static FileTypes::Type getType(const String &filename)
Tries to determine the file type (by name or content)
A map alignment algorithm based on pose clustering.
Definition: MapAlignmentAlgorithmPoseClustering.h:70
void setParameters(const Param ¶m)
Sets the parameters.
const Param & getParameters() const
Non-mutable access to the parameters.
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 map alignment algorithm based on spectrum similarity (dynamic programming).
Definition: MapAlignmentAlgorithmSpectrumAlignment.h:54
A container for consensus elements.
Definition: ConsensusMap.h:79
std::vector< String > StringList
Vector of String.
Definition: ListUtils.h:70
void store(const String &filename, const FeatureMap &feature_map)
stores the map feature_map in file with name filename.
void load(const String &filename, ConsensusMap &map)
Loads a consensus map from file and calls updateRanges.
std::map< String, DoubleList > SeqToList
Type to store retention times given for individual peptide sequences.
Definition: MapAlignmentAlgorithmIdentification.h:149
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmIdentification.h:71
Int overflow exception.
Definition: Exception.h:254
int main(int argc, const char **argv)
Definition: INIFileEditor.cpp:73
Int reference_index_
Index of input file to use as reference (if any)
Definition: MapAlignmentAlgorithmIdentification.h:155
SeqToValue reference_
Reference retention times (per peptide sequence)
Definition: MapAlignmentAlgorithmIdentification.h:158
void setLoadSubordinates(bool sub)
A container for features.
Definition: FeatureMap.h:95
Iterator end()
Definition: MSExperiment.h:167
This class provides Input/Output functionality for feature maps.
Definition: FeatureXMLFile.h:68
void computeTrafosByOriginalRT(std::vector< FeatureMap > &feature_maps, FeatureMap &map_transformed, std::vector< TransformationDescription > &transformations, const std::vector< Size > &trafo_order)
Extract original RT ("original_RT" MetaInfo) and transformed RT for each feature to compute RT transf...
void updateRanges() override
Updates minimum and maximum position/intensity.
A map alignment algorithm based on peptide identifications from MS2 spectra.
Definition: MapAlignmentAlgorithmTreeGuided.h:71
Management and storage of parameters / INI files.
Definition: Param.h:73
#define OPENMS_LOG_INFO
Macro if a information, e.g. a status should be reported.
Definition: LogStream.h:465
void setLoadConvexHull(bool convex)
static void computeTransformedFeatureMaps(std::vector< FeatureMap > &feature_maps, const std::vector< TransformationDescription > &transformations)
Apply transformations on input maps.
void setReference(const MapType &map)
Sets the reference for the alignment.
Definition: MapAlignmentAlgorithmPoseClustering.h:87
FeatureFileOptions & getOptions()
Mutable access to the options for loading/storing.
void setLogType(LogType type) const
Sets the progress log that should be used. The default type is NONE!
bool sameNrOfMSFilesPerFraction() const
This class provides Input functionality for ConsensusMaps and Output functionality for alignments and...
Definition: ConsensusXMLFile.h:61
Used to load and store idXML files.
Definition: IdXMLFile.h:63
String newickTree(const std::vector< BinaryTreeNode > &tree, const bool include_distance=false)
Returns the hierarchy described by a clustering tree as Newick-String.