Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Classes | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
TransitionTSVReader Class Reference

This class can convert TraML and TSV files into each other. More...

#include <OpenMS/ANALYSIS/OPENSWATH/TransitionTSVReader.h>

Inheritance diagram for TransitionTSVReader:
ProgressLogger DefaultParamHandler

Classes

struct  TSVTransition
 Internal structure to represent a transition. More...
 

Public Member Functions

void convertTargetedExperimentToTSV (const char *filename, OpenMS::TargetedExperiment &targeted_exp)
 Write out a targeted experiment (TraML structure) into a tsv file. More...
 
void convertTSVToTargetedExperiment (const char *filename, FileTypes::Type filetype, OpenMS::TargetedExperiment &targeted_exp)
 Read in a tsv/mrm file and construct a targeted experiment (TraML structure) More...
 
void convertTSVToTargetedExperiment (const char *filename, FileTypes::Type filetype, OpenSwath::LightTargetedExperiment &targeted_exp)
 Read in a tsv file and construct a targeted experiment (Light transition structure) More...
 
void validateTargetedExperiment (OpenMS::TargetedExperiment &targeted_exp)
 Validate a TargetedExperiment (check that all ids are unique) More...
 
 TransitionTSVReader ()
 Constructor. More...
 
 ~TransitionTSVReader ()
 Destructor. More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
 ~ProgressLogger ()
 Destructor. More...
 
 ProgressLogger (const ProgressLogger &other)
 Copy constructor. More...
 
ProgressLoggeroperator= (const ProgressLogger &other)
 Assignment Operator. More...
 
void setLogType (LogType type) const
 Sets the progress log that should be used. The default type is NONE! More...
 
LogType getLogType () const
 Returns the type of progress log being used. More...
 
void startProgress (SignedSize begin, SignedSize end, const String &label) const
 Initializes the progress display. More...
 
void setProgress (SignedSize value) const
 Sets the current progress. More...
 
void endProgress () const
 Ends the progress display. More...
 
- Public Member Functions inherited from DefaultParamHandler
 DefaultParamHandler (const String &name)
 Constructor with name that is displayed in error messages. More...
 
 DefaultParamHandler (const DefaultParamHandler &rhs)
 Copy constructor. More...
 
virtual ~DefaultParamHandler ()
 Destructor. More...
 
virtual DefaultParamHandleroperator= (const DefaultParamHandler &rhs)
 Assignment operator. More...
 
virtual bool operator== (const DefaultParamHandler &rhs) const
 Equality operator. More...
 
void setParameters (const Param &param)
 Sets the parameters. More...
 
const ParamgetParameters () const
 Non-mutable access to the parameters. More...
 
const ParamgetDefaults () const
 Non-mutable access to the default parameters. More...
 
const StringgetName () const
 Non-mutable access to the name. More...
 
void setName (const String &name)
 Mutable access to the name. More...
 
const std::vector< String > & getSubsections () const
 Non-mutable access to the registered subsections. More...
 

Protected Member Functions

void updateMembers_ ()
 Synchronize members with param class. More...
 
- Protected Member Functions inherited from DefaultParamHandler
void defaultsToParam_ ()
 Updates the parameters after the defaults have been set in the constructor. More...
 

Private Types

typedef std::vector
< OpenMS::TargetedExperiment::Protein
ProteinVectorType
 Typedefs. More...
 
typedef std::vector
< OpenMS::TargetedExperiment::Peptide
PeptideVectorType
 
typedef std::vector
< OpenMS::ReactionMonitoringTransition
TransitionVectorType
 

Private Member Functions

void getTSVHeader_ (const std::string &line, char &delimiter, std::vector< std::string > header, std::map< std::string, int > &header_dict)
 Determine separator in a CSV file and check for correct headers. More...
 
void readUnstructuredTSVInput_ (const char *filename, FileTypes::Type filetype, std::vector< TSVTransition > &transition_list)
 Read tab or comma separated input with columns defined by their column headers only. More...
 
void cleanupTransitions_ (TSVTransition &mytransition)
 Cleanup of the read fields (removing quotes etc.) More...
 
void TSVToTargetedExperiment_ (std::vector< TSVTransition > &transition_list, OpenMS::TargetedExperiment &exp)
 Convert a list of TSVTransition to a TargetedExperiment. More...
 
void TSVToTargetedExperiment_ (std::vector< TSVTransition > &transition_list, OpenSwath::LightTargetedExperiment &exp)
 Convert a list of TSVTransition to a LightTargetedExperiment. More...
 
void writeTSVOutput_ (const char *filename, OpenMS::TargetedExperiment &targeted_exp)
 Write a TargetedExperiment to a file. More...
 
Conversion functions from TSVTransition objects to TraML datastructures

These functions convert the relevant data from a TSVTransition to the datastructures used by the TraML handler, namely ReactionMonitoringTransition, TargetedExperiment::Protein and TargetedExperiment::Peptide.

void resolveMixedSequenceGroups_ (std::vector< TSVTransition > &transition_list)
 
void createTransition_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::ReactionMonitoringTransition &rm_trans)
 
void createProtein_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::TargetedExperiment::Protein &protein)
 
void createPeptide_ (std::vector< TSVTransition >::iterator &tr_it, OpenMS::TargetedExperiment::Peptide &peptide)
 
void addModification_ (std::vector< TargetedExperiment::Peptide::Modification > &mods, int location, ResidueModification &rmod, const String &name)
 

Private Attributes

String retentionTimeInterpretation_
 Members. More...
 
bool override_group_label_check_
 

Static Private Attributes

static const char * strarray_ []
 
static const std::vector
< std::string > 
header_names_
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD, GUI, NONE }
 Possible log types. More...
 
- Static Protected Member Functions inherited from ProgressLogger
static String logTypeToFactoryName_ (LogType type)
 Return the name of the factory product used for this log type. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Protected Attributes inherited from DefaultParamHandler
Param param_
 Container for current parameters. More...
 
Param defaults_
 Container for default parameters. This member should be filled in the constructor of derived classes! More...
 
std::vector< Stringsubsections_
 Container for registered subsections. This member should be filled in the constructor of derived classes! More...
 
String error_name_
 Name that is displayed in error messages during the parameter checking. More...
 
bool check_defaults_
 If this member is set to false no checking if parameters in done;. More...
 
bool warn_empty_defaults_
 If this member is set to false no warning is emitted when defaults are empty;. More...
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

This class can convert TraML and TSV files into each other.

The TSV are tab-separated and need to have the following columns:

PrecursorMz (float) ProductMz (float) Tr_calibrated (float) transition_name (free text, needs to be unique for each transition [in this file]) CE (float) LibraryIntensity (float) transition_group_id (free text, designates the transition group [e.g. peptide] to which this transition belongs) decoy (1==decoy, 0== no decoy; determines whether the transition is a decoy transition or not) PeptideSequence (free text, sequence only (no modifications) ) ProteinName (free text) Annotation (free text, e.g. y7) FullUniModPeptideName (free text, should contain modifications*) MissedCleavages Replicates NrModifications PrecursorCharge (integer) PeptideGroupLabel (free text, designates to which peptide label group (as defined in MS:1000893) the peptide belongs to) LabelType (free text, optional description of which label was used, e.g. heavy or light)

Member Typedef Documentation

Typedefs.

Constructor & Destructor Documentation

Constructor.

Destructor.

Member Function Documentation

void addModification_ ( std::vector< TargetedExperiment::Peptide::Modification > &  mods,
int  location,
ResidueModification rmod,
const String name 
)
private
void cleanupTransitions_ ( TSVTransition mytransition)
private

Cleanup of the read fields (removing quotes etc.)

void convertTargetedExperimentToTSV ( const char *  filename,
OpenMS::TargetedExperiment targeted_exp 
)

Write out a targeted experiment (TraML structure) into a tsv file.

Parameters
filenameThe output file
targeted_expThe targeted experiment
void convertTSVToTargetedExperiment ( const char *  filename,
FileTypes::Type  filetype,
OpenMS::TargetedExperiment targeted_exp 
)

Read in a tsv/mrm file and construct a targeted experiment (TraML structure)

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
targeted_expThe output targeted experiment
void convertTSVToTargetedExperiment ( const char *  filename,
FileTypes::Type  filetype,
OpenSwath::LightTargetedExperiment targeted_exp 
)

Read in a tsv file and construct a targeted experiment (Light transition structure)

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
targeted_expThe output targeted experiment
void createPeptide_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::TargetedExperiment::Peptide peptide 
)
private
void createProtein_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::TargetedExperiment::Protein protein 
)
private
void createTransition_ ( std::vector< TSVTransition >::iterator &  tr_it,
OpenMS::ReactionMonitoringTransition rm_trans 
)
private
void getTSVHeader_ ( const std::string &  line,
char &  delimiter,
std::vector< std::string >  header,
std::map< std::string, int > &  header_dict 
)
private

Determine separator in a CSV file and check for correct headers.

Parameters
lineThe header to be parsed
delimiterThe delimiter which will be determined from the input
headerThe fields of the header
header_dictThe map which maps the fields in the header to their position
void readUnstructuredTSVInput_ ( const char *  filename,
FileTypes::Type  filetype,
std::vector< TSVTransition > &  transition_list 
)
private

Read tab or comma separated input with columns defined by their column headers only.

Parameters
filenameThe input file
filetypeThe type of file ("mrm" or "tsv")
transition_listThe output list of transitions
void resolveMixedSequenceGroups_ ( std::vector< TSVTransition > &  transition_list)
private

Resolve cases where the same peptide label group has different sequences.

Since members in a peptide label group (MS:1000893) should only be isotopically modified forms of the same peptide, having different peptide sequences (different AA order) within the same group most likely constitutes an error. This function will fix the error by erasing the provided "peptide group label" for a peptide and replace it with the peptide id (transition group id).

Parameters
transition_listThe list of read transitions to be fixed.
void TSVToTargetedExperiment_ ( std::vector< TSVTransition > &  transition_list,
OpenMS::TargetedExperiment exp 
)
private

Convert a list of TSVTransition to a TargetedExperiment.

Converts the list (read from csv/mrm) file into a object model using the TargetedExperiment with proper hierarchical structure from Transition to Peptide to Protein.

void TSVToTargetedExperiment_ ( std::vector< TSVTransition > &  transition_list,
OpenSwath::LightTargetedExperiment exp 
)
private

Convert a list of TSVTransition to a LightTargetedExperiment.

Converts the list (read from csv/mrm) file into a object model using the LightTargetedExperiment with proper hierarchical structure from Transition to Peptide to Protein.

void updateMembers_ ( )
protectedvirtual

Synchronize members with param class.

Reimplemented from DefaultParamHandler.

void validateTargetedExperiment ( OpenMS::TargetedExperiment targeted_exp)

Validate a TargetedExperiment (check that all ids are unique)

void writeTSVOutput_ ( const char *  filename,
OpenMS::TargetedExperiment targeted_exp 
)
private

Write a TargetedExperiment to a file.

Parameters
filenameName of the output file
targeted_expThe data structure to be written to the file

Member Data Documentation

const std::vector<std::string> header_names_
staticprivate
bool override_group_label_check_
private
String retentionTimeInterpretation_
private

Members.

const char* strarray_[]
staticprivate

OpenMS / TOPP release 2.0.0 Documentation generated on Wed Mar 30 2016 16:18:44 using doxygen 1.8.5