OpenMS
XQuestResultXMLFile Class Reference

Used to load and store xQuest result files. More...

#include <OpenMS/FORMAT/XQuestResultXMLFile.h>

Inheritance diagram for XQuestResultXMLFile:
[legend]
Collaboration diagram for XQuestResultXMLFile:
[legend]

Public Member Functions

 XQuestResultXMLFile ()
 
 ~XQuestResultXMLFile () override
 
void load (const String &filename, std::vector< PeptideIdentification > &pep_ids, std::vector< ProteinIdentification > &prot_ids)
 Load the content of the xquest.xml file into the provided data structures. More...
 
void store (const String &filename, const std::vector< ProteinIdentification > &poid, const std::vector< PeptideIdentification > &peid) const
 Stores the identifications in a xQuest XML file. More...
 
int getNumberOfHits () const
 Returns the total number of hits in the file. More...
 
double getMinScore () const
 Returns minimum score among the hits in the file. More...
 
double getMaxScore () const
 Returns maximum score among the hits in the file. More...
 
- Public Member Functions inherited from XMLFile
 XMLFile ()
 Default constructor. More...
 
 XMLFile (const String &schema_location, const String &version)
 Constructor that sets the schema location. More...
 
virtual ~XMLFile ()
 Destructor. More...
 
bool isValid (const String &filename, std::ostream &os)
 Checks if a file validates against the XML schema. More...
 
const StringgetVersion () const
 return the version of the schema More...
 
- Public Member Functions inherited from ProgressLogger
 ProgressLogger ()
 Constructor. More...
 
virtual ~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...
 
void nextProgress () const
 increment progress by 1 (according to range begin-end) More...
 

Static Public Member Functions

static void writeXQuestXMLSpec (const String &out_file, const String &base_name, const OPXLDataStructs::PreprocessedPairSpectra &preprocessed_pair_spectra, const std::vector< std::pair< Size, Size > > &spectrum_pairs, const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &all_top_csms, const PeakMap &spectra, const bool &test_mode=false)
 Writes spec.xml output containing matching peaks between heavy and light spectra after comparing and filtering. More...
 
static void writeXQuestXMLSpec (const String &out_file, const String &base_name, const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &all_top_csms, const PeakMap &spectra, const bool &test_mode=false)
 Writes spec.xml output containing spectra for visualization. This version of the function is meant to be used for label-free linkers. More...
 

Static Private Member Functions

static String getxQuestBase64EncodedSpectrum_ (const PeakSpectrum &spec, const String &header, const bool &test_mode=false)
 Transforms a PeakSpectrum into a base64 encoded string, which is the format used in spec.xml for xQuest. More...
 
static void wrap_ (const String &input, Size width, String &output)
 A helper function, that takes one string containing one line and wraps it into several lines of a given width. More...
 

Private Attributes

int n_hits_
 Total number of hits within the result file. More...
 
double min_score_
 Minimum score encountered in file. More...
 
double max_score_
 Maximum score encountered in file. More...
 

Additional Inherited Members

- Public Types inherited from ProgressLogger
enum  LogType { CMD , GUI , NONE }
 Possible log types. More...
 
- Protected Member Functions inherited from XMLFile
void parse_ (const String &filename, XMLHandler *handler)
 Parses the XML file given by filename using the handler given by handler. More...
 
void parseBuffer_ (const std::string &buffer, XMLHandler *handler)
 Parses the in-memory buffer given by buffer using the handler given by handler. More...
 
void save_ (const String &filename, XMLHandler *handler) const
 Stores the contents of the XML handler given by handler in the file given by filename. More...
 
void enforceEncoding_ (const String &encoding)
 
- 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 XMLFile
String schema_location_
 XML schema file location. More...
 
String schema_version_
 Version string. More...
 
String enforced_encoding_
 Encoding string that replaces the encoding (system dependent or specified in the XML). Disabled if empty. Used as a workaround for XTandem output xml. More...
 
- Protected Attributes inherited from ProgressLogger
LogType type_
 
time_t last_invoke_
 
ProgressLoggerImplcurrent_logger_
 
- Static Protected Attributes inherited from ProgressLogger
static int recursion_depth_
 

Detailed Description

Used to load and store xQuest result files.

These files are used to store results derived from chemical cross-linking coupled to MS experiments.

A documented schema for this format can be found at https://github.com/OpenMS/OpenMS/tree/develop/share/OpenMS/SCHEMAS

Constructor & Destructor Documentation

◆ XQuestResultXMLFile()

◆ ~XQuestResultXMLFile()

~XQuestResultXMLFile ( )
override

Member Function Documentation

◆ getMaxScore()

double getMaxScore ( ) const

Returns maximum score among the hits in the file.

Returns
Maximum score among the hits in the file.

◆ getMinScore()

double getMinScore ( ) const

Returns minimum score among the hits in the file.

Returns
Minimum score among the hits in the file.

◆ getNumberOfHits()

int getNumberOfHits ( ) const

Returns the total number of hits in the file.

Returns
total number of hits in the file

◆ getxQuestBase64EncodedSpectrum_()

static String getxQuestBase64EncodedSpectrum_ ( const PeakSpectrum spec,
const String header,
const bool &  test_mode = false 
)
staticprivate

Transforms a PeakSpectrum into a base64 encoded string, which is the format used in spec.xml for xQuest.

Parameters
specThe spectrum
headerA header for the spectrum, build using the base_name parameter for writeXQuestXMLSpec and the index of the spectrum.

◆ load()

void load ( const String filename,
std::vector< PeptideIdentification > &  pep_ids,
std::vector< ProteinIdentification > &  prot_ids 
)

Load the content of the xquest.xml file into the provided data structures.

Parameters
filenameFilename of the file which is to be loaded.
pep_idsWhere the spectra with identifications of the input file will be loaded to.
prot_idsWhere the protein identification of the input file will be loaded to.

◆ store()

void store ( const String filename,
const std::vector< ProteinIdentification > &  poid,
const std::vector< PeptideIdentification > &  peid 
) const

Stores the identifications in a xQuest XML file.

Exceptions
Exception::UnableToCreateFileis thrown if the file could not be created

◆ wrap_()

static void wrap_ ( const String input,
Size  width,
String output 
)
staticprivate

A helper function, that takes one string containing one line and wraps it into several lines of a given width.

Parameters
inputThe string as one line
widthThe preferred line width
outputString in which the output is written

◆ writeXQuestXMLSpec() [1/2]

static void writeXQuestXMLSpec ( const String out_file,
const String base_name,
const OPXLDataStructs::PreprocessedPairSpectra preprocessed_pair_spectra,
const std::vector< std::pair< Size, Size > > &  spectrum_pairs,
const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &  all_top_csms,
const PeakMap spectra,
const bool &  test_mode = false 
)
static

Writes spec.xml output containing matching peaks between heavy and light spectra after comparing and filtering.

Parameters
out_filePath and filename for the output file
base_nameThe base_name should be the name of the input spectra file without the file ending. Used as part of an identifier string for the spectra.
preprocessed_pair_spectraThe preprocessed spectra after comparing and filtering
spectrum_pairsIndices of spectrum pairs in the input map
all_top_csmsCrossLinkSpectrumMatches, from which the IDs were generated. Only spectra with matches are written out.
spectraThe spectra, that were searched as a PeakMap. The indices in spectrum_pairs correspond to spectra in this map.

◆ writeXQuestXMLSpec() [2/2]

static void writeXQuestXMLSpec ( const String out_file,
const String base_name,
const std::vector< std::vector< OPXLDataStructs::CrossLinkSpectrumMatch > > &  all_top_csms,
const PeakMap spectra,
const bool &  test_mode = false 
)
static

Writes spec.xml output containing spectra for visualization. This version of the function is meant to be used for label-free linkers.

Parameters
out_filePath and filename for the output file
base_nameThe base_name should be the name of the input spectra file without the file ending. Used as part of an identifier string for the spectra.
all_top_csmsCrossLinkSpectrumMatches, from which the IDs were generated. Only spectra with matches are written out.
spectraThe spectra, that were searched as a PeakMap.

Member Data Documentation

◆ max_score_

double max_score_
private

Maximum score encountered in file.

◆ min_score_

double min_score_
private

Minimum score encountered in file.

◆ n_hits_

int n_hits_
private

Total number of hits within the result file.