This class converts a Mascot Search Results (MSR) file to legacy .dat format. More...
#include <ms_msr2dat28.hpp>
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_errs * | getErrorHandler () 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. | |
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().
|
explicit |
Create a converter.
The converter defaults to generating all .dat file sections, including peak lists in query sections and the index section.
resfile | A results file from which data is read. |
|
inherited |
Copies all errors from another instance and appends them at the end of own list.
src | The object to copy the errors across from. See Maintaining object references: two rules of thumb. |
|
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.
|
inherited |
Use this member to make a copy of another instance.
right | is the source to initialise from |
int getCurrentLineNumber | ( | ) | const |
Get the current line number.
|
inherited |
Retrive the error object using this function to get access to all errors and error parameters.
See Error Handling.
|
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.
|
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.
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.
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.
maybe | True to include the index section lines, false otherwise. |
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.
maybe | True to include peak lists in Ions1= lines, false otherwise. |
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.
bool isIndexSectionIncluded | ( | ) | const |
Check whether the index section is enabled.
bool isQuerySectionIonsLinesIncluded | ( | ) | const |
Check whether the peak lists will be included in query sections.
|
inherited |
Call this function to determine if there have been any errors.
This will return true unless there have been any fatal errors.
See Error Handling.
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.