Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
TransitionTSVReader.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2017.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Hannes Roest $
32 // $Authors: Hannes Roest $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_ANALYSIS_OPENSWATH_TRANSITIONTSVREADER_H
36 #define OPENMS_ANALYSIS_OPENSWATH_TRANSITIONTSVREADER_H
37 
40 
45 
46 #include <fstream>
47 
48 namespace OpenMS
49 {
50 
81  class OPENMS_DLLAPI TransitionTSVReader :
82  public ProgressLogger,
83  public DefaultParamHandler
84  {
85 
86 protected:
94  {
95  double precursor;
96  double product;
97  double rt_calibrated;
99  double CE;
102  int decoy;
122  std::vector<String> peptidoforms;
123 
125  precursor(-1),
126  product(-1),
127  rt_calibrated(-1),
128  CE(-1),
129  library_intensity(-1),
130  decoy(0),
131  fragment_charge("NA"),
132  fragment_nr(-1),
133  fragment_mzdelta(-1),
134  fragment_modification(0),
135  detecting_transition(true),
136  identifying_transition(false),
137  quantifying_transition(true)
138  {}
139 
140  // By convention, if there is no (metabolic) compound name, it is a peptide
141  bool isPeptide()
142  {
143  return CompoundName.empty();
144  }
145  };
146 
154  void TSVToTargetedExperiment_(std::vector<TSVTransition>& transition_list, OpenMS::TargetedExperiment& exp);
155 
163  void TSVToTargetedExperiment_(std::vector<TSVTransition>& transition_list, OpenSwath::LightTargetedExperiment& exp);
164 
174 
176 
178  void updateMembers_();
179 
180 private:
185 
187  typedef std::vector<OpenMS::TargetedExperiment::Protein> ProteinVectorType;
188  typedef std::vector<OpenMS::TargetedExperiment::Peptide> PeptideVectorType;
189  typedef std::vector<OpenMS::ReactionMonitoringTransition> TransitionVectorType;
190 
191  static const char* strarray_[];
192 
193  static const std::vector<std::string> header_names_;
194 
203  void getTSVHeader_(const std::string& line, char& delimiter, std::vector<std::string> header, std::map<std::string, int>& header_dict);
204 
212  void readUnstructuredTSVInput_(const char* filename, FileTypes::Type filetype, std::vector<TSVTransition>& transition_list);
213 
216  void cleanupTransitions_(TSVTransition& mytransition);
217 
230  void resolveMixedSequenceGroups_(std::vector<TSVTransition>& transition_list);
231 
233  void createTransition_(std::vector<TSVTransition>::iterator& tr_it, OpenMS::ReactionMonitoringTransition& rm_trans);
234 
236  void createProtein_(std::vector<TSVTransition>::iterator& tr_it, OpenMS::TargetedExperiment::Protein& protein);
237 
239  void interpretRetentionTime_(std::vector<TargetedExperiment::RetentionTime>& retention_times, const OpenMS::DataValue rt_value);
240 
242  void createPeptide_(std::vector<TSVTransition>::iterator& tr_it, OpenMS::TargetedExperiment::Peptide& peptide);
243 
245  void createCompound_(std::vector<TSVTransition>::iterator& tr_it, OpenMS::TargetedExperiment::Compound& compound);
246 
247  void addModification_(std::vector<TargetedExperiment::Peptide::Modification>& mods,
248  int location, const ResidueModification& rmod);
250 
256  void writeTSVOutput_(const char* filename, OpenMS::TargetedExperiment& targeted_exp);
257 
258 public:
259 
263 
267 
274  void convertTargetedExperimentToTSV(const char* filename, OpenMS::TargetedExperiment& targeted_exp);
275 
283  void convertTSVToTargetedExperiment(const char* filename, FileTypes::Type filetype, OpenMS::TargetedExperiment& targeted_exp);
284 
292  void convertTSVToTargetedExperiment(const char* filename, FileTypes::Type filetype, OpenSwath::LightTargetedExperiment& targeted_exp);
293 
295  void validateTargetedExperiment(OpenMS::TargetedExperiment& targeted_exp);
296 
297  };
298 }
299 
300 #endif // OPENMS_ANALYSIS_OPENSWATH_TRANSITIONTSVREADER_H
301 
Type
Actual file types enum.
Definition: FileTypes.h:59
double fragment_mzdelta
Definition: TransitionTSVReader.h:115
bool override_group_label_check_
Definition: TransitionTSVReader.h:183
double CE
Definition: TransitionTSVReader.h:99
int fragment_modification
Definition: TransitionTSVReader.h:116
String SMILES
Definition: TransitionTSVReader.h:108
A more convenient string class.
Definition: String.h:57
String fragment_charge
Definition: TransitionTSVReader.h:113
bool identifying_transition
Definition: TransitionTSVReader.h:120
String Annotation
Definition: TransitionTSVReader.h:105
String label_type
Definition: TransitionTSVReader.h:112
std::vector< OpenMS::TargetedExperiment::Protein > ProteinVectorType
Typedefs.
Definition: TransitionTSVReader.h:187
std::vector< OpenMS::TargetedExperiment::Peptide > PeptideVectorType
Definition: TransitionTSVReader.h:188
This class can convert TraML and TSV files into each other.
Definition: TransitionTSVReader.h:81
TSVTransition()
Definition: TransitionTSVReader.h:124
Representation of a modification.
Definition: ResidueModification.h:77
String SumFormula
Definition: TransitionTSVReader.h:109
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
double precursor
Definition: TransitionTSVReader.h:95
double library_intensity
Definition: TransitionTSVReader.h:100
String ProteinName
Definition: TransitionTSVReader.h:104
int decoy
Definition: TransitionTSVReader.h:102
Class to hold strings, numeric values, lists of strings and lists of numeric values.
Definition: DataValue.h:57
std::vector< OpenMS::ReactionMonitoringTransition > TransitionVectorType
Definition: TransitionTSVReader.h:189
String group_id
Definition: TransitionTSVReader.h:101
String precursor_charge
Definition: TransitionTSVReader.h:110
std::vector< String > peptidoforms
Definition: TransitionTSVReader.h:122
String uniprot_id
Definition: TransitionTSVReader.h:118
Definition: TargetedExperimentHelper.h:181
String fragment_type
Definition: TransitionTSVReader.h:117
String CompoundName
Definition: TransitionTSVReader.h:107
String peptide_group_label
Definition: TransitionTSVReader.h:111
bool isPeptide()
Definition: TransitionTSVReader.h:141
bool quantifying_transition
Definition: TransitionTSVReader.h:121
int fragment_nr
Definition: TransitionTSVReader.h:114
double product
Definition: TransitionTSVReader.h:96
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
Internal structure to represent a transition.
Definition: TransitionTSVReader.h:93
A description of a targeted experiment containing precursor and production ions.
Definition: TargetedExperiment.h:62
String transition_name
Definition: TransitionTSVReader.h:98
String PeptideSequence
Definition: TransitionTSVReader.h:103
bool detecting_transition
Definition: TransitionTSVReader.h:119
String retentionTimeInterpretation_
Members.
Definition: TransitionTSVReader.h:182
Definition: TargetedExperimentHelper.h:111
double rt_calibrated
Definition: TransitionTSVReader.h:97
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
static const std::vector< std::string > header_names_
Definition: TransitionTSVReader.h:193
bool force_invalid_mods_
Definition: TransitionTSVReader.h:184
Definition: TransitionExperiment.h:195
String FullPeptideName
Definition: TransitionTSVReader.h:106
Definition: TargetedExperimentHelper.h:266
This class stores a SRM/MRM transition.
Definition: ReactionMonitoringTransition.h:56

OpenMS / TOPP release 2.3.0 Documentation generated on Tue Jan 9 2018 18:22:04 using doxygen 1.8.13