Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
ms_msr2dat28 Class Reference

This class converts a Mascot Search Results (MSR) file to legacy .dat format. More...

#include <ms_msr2dat28.hpp>

Inheritance diagram for ms_msr2dat28:
Collaboration diagram for ms_msr2dat28:

Public Member Functions

 ms_msr2dat28 (const ms_mascotresfile_msr &resfile)
 Create a converter.
 
void appendErrors (const ms_errors &src)
 Copies all errors from another instance and appends them at the end of own list.
 
void clearAllErrors ()
 Remove all errors from the current list of errors.
 
void copyFrom (const ms_errors *right)
 Use this member to make a copy of another instance.
 
int getCurrentLineNumber () const
 Get the current line number.
 
const ms_errsgetErrorHandler () const
 Retrive the error object using this function to get access to all errors and error parameters.
 
int getLastError () const
 Return the error description of the last error that occurred.
 
std::string getLastErrorString () const
 Return the error description of the last error that occurred.
 
std::string getNextLine ()
 Generate the next line of text.
 
void includeIndexSection (bool maybe)
 Enable or disable the index section.
 
void includeQuerySectionIonsLines (bool maybe)
 Enable or disable inclusion of peak lists in query sections.
 
bool isConversionSupported () const
 Check whether this file can be converted.
 
bool isIndexSectionIncluded () const
 Check whether the index section is enabled.
 
bool isQuerySectionIonsLinesIncluded () const
 Check whether the peak lists will be included in query sections.
 
bool isValid () const
 Call this function to determine if there have been any errors.
 
void rewind ()
 Rewind to the beginning of the file.
 

Detailed Description

This class converts a Mascot Search Results (MSR) file to legacy .dat format.

Mascot Server 3.0 introduced a new file format, Mascot Search Results (MSR). MSR files are SQLite databases with a formal table structure. Previous Mascot versions saved search results in a plain text file with file extension .dat. The legacy .dat format is frozen and matches the output of Mascot Server 2.8.

ms_msr2dat28 can be used for converting an MSR file into legacy .dat format. This is mainly useful for third-party tools that have a custom .dat parser or tools that use Mascot Parser 2.8 or earlier for reading results. In all other cases, you are better off using the latest version of Mascot Parser to read the MSR file directly, or exporting Mascot results as mzIdentML, mzTab, XML or CSV instead of .dat format.

Overview of conversion:

Some of the data lines can be filtered out. For example, to create a "slim" .dat file without peak lists, call ms_msr2dat28::includeQuerySectionIonsLines(false) before ms_msr2dat28::getNextLine().

Constructor & Destructor Documentation

◆ ms_msr2dat28()

ms_msr2dat28 ( const ms_mascotresfile_msr resfile)
explicit

Create a converter.

The converter defaults to generating all .dat file sections, including peak lists in query sections and the index section.

Parameters
resfileA results file from which data is read.

Member Function Documentation

◆ appendErrors()

void appendErrors ( const ms_errors src)
inherited

Copies all errors from another instance and appends them at the end of own list.

Parameters
srcThe object to copy the errors across from. See Maintaining object references: two rules of thumb.

◆ clearAllErrors()

void clearAllErrors ( )
inherited

Remove all errors from the current list of errors.

The list of 'errors' can include fatal errors, warning messages, information messages and different levels of debugging messages.

All messages are accumulated into a list in this object, until clearAllErrors() is called.

See Error Handling.

See also
isValid(), getLastError(), getLastErrorString(), getErrorHandler()
Examples
common_error.cpp, resfile_error.cpp, and resfile_summary.cpp.

◆ copyFrom()

void copyFrom ( const ms_errors right)
inherited

Use this member to make a copy of another instance.

Parameters
rightis the source to initialise from

◆ getCurrentLineNumber()

int getCurrentLineNumber ( ) const

Get the current line number.

Returns
Current line number, starting from 0.

◆ getErrorHandler()

const ms_errs * getErrorHandler ( ) const
inherited

Retrive the error object using this function to get access to all errors and error parameters.

See Error Handling.

Returns
Constant pointer to the error handler
See also
isValid(), getLastError(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, and http_helper_getstring.cpp.

◆ getLastError()

int getLastError ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

See Error Handling.

See also
isValid(), getLastErrorString(), clearAllErrors(), getErrorHandler()
Returns
the error number of the last error, or 0 if there have been no errors.

◆ getLastErrorString()

std::string getLastErrorString ( ) const
inherited

Return the error description of the last error that occurred.

All errors are accumulated into a list in this object, until clearAllErrors() is called. This function returns the last error that occurred.

Returns
Most recent error, warning, information or debug message

See Error Handling.

See also
isValid(), getLastError(), clearAllErrors(), getErrorHandler()
Examples
common_error.cpp, config_enzymes.cpp, config_fragrules.cpp, config_license.cpp, config_mascotdat.cpp, config_masses.cpp, config_modfile.cpp, config_procs.cpp, config_quantitation.cpp, config_taxonomy.cpp, http_helper_getstring.cpp, and tools_aahelper.cpp.

◆ getNextLine()

std::string getNextLine ( )

Generate the next line of text.

The legacy .dat format is a plain text file with UTF-8 encoding. Data is generated line by line. A line is a non-empty string terminated by LF (Linux) or CRLF (Windows), depending on the platform where the MSR file was created.

If the next line is blank, then the result string contains just the line terminator, which is one or two characters (LF or CRLF).

At end of file, the method returns the empty string (not a blank line!).

If there is a fatal error, the method immediately returns the empty string. Use isValid() and getLastErrorString() to check for errors.

Returns
a line of text if one could be generated, and empty string when you reach end of file or a fatal error.

◆ includeIndexSection()

void includeIndexSection ( bool  maybe)

Enable or disable the index section.

The .dat file ends with an "index" section, which lists the line numbers of all preceding sections. The line numbers are not used by Mascot Parser, but they may be used by third-party programs. If the .dat file will be consumed by Mascot Parser, the index section can be omitted to make the file smaller.

The index section is enabled by default. If set to false, no index section is generated.

The setting takes effect from the next getNextLine() call. If you set it to false and a part of the index section has already been generated, the index section will be truncated.

Parameters
maybeTrue to include the index section lines, false otherwise.

◆ includeQuerySectionIonsLines()

void includeQuerySectionIonsLines ( bool  maybe)

Enable or disable inclusion of peak lists in query sections.

The .dat file query sections store metadata like query title, scan number and peak lists. The peak lists are often the bulk of the .dat file, when measured in number of bytes. Some client programs like Mascot Distiller do not need the peak lists, because they have access to the raw data.

The peak lists (Ions1= lines) are enabled by default. If set to false, an empty "Ions1=" line is generated.

The setting takes effect from the next getNextLine() call.

Parameters
maybeTrue to include peak lists in Ions1= lines, false otherwise.

◆ isConversionSupported()

bool isConversionSupported ( ) const

Check whether this file can be converted.

This version of Parser requires certain legacy data sections to be stored as a binary blob in the MSR file. These blobs are saved by Mascot Server when the file is created.

A future version of Mascot might omit some of the blobs. If the binary blobs are missing or have an unsupported encoding, ms_msr2dat28 cannot convert the file. Please download a later version of Parser to do the conversion.

Returns
true if conversion is supported for this file, false otherwise.

◆ isIndexSectionIncluded()

bool isIndexSectionIncluded ( ) const

Check whether the index section is enabled.

Returns
true if the index section will be included, false otherwise.

◆ isQuerySectionIonsLinesIncluded()

bool isQuerySectionIonsLinesIncluded ( ) const

Check whether the peak lists will be included in query sections.

Returns
true if peak lists will be included in Ions1= lines in query sections, false otherwise.

◆ isValid()

bool isValid ( ) const
inherited

◆ rewind()

void rewind ( )

Rewind to the beginning of the file.

Go back to the beginning of the .dat contents. The next getNextLine() call will start from the first line.

Inclusion filters are not affected by this call.


The documentation for this class was generated from the following files: