Example program for handling errors in the Mascot results files.
#include "msparser.hpp"
#include <iostream>
#include <time.h>
#include <iomanip>
using namespace matrix_science;
int main(int argc, char * argv[])
{
if (argc == 2)
{
{
checkErrorHandler(file);
}
else
}
else
std::cout << "Must supply the name of a .dat file as a command line argument" << std::endl;
return 0;
}
{
std::cout << "Testing the error handling... " << std::endl;
std::cout << "=========================================" << std::endl;
std::cout <<
"Error number: " << file.
getLastError() << std::endl;
std::cout << "Cleared all errors - should have no errors left: "
<< " errors left"
<< std::endl << std::endl;
for (int x=1; x <= 20; x++)
std::cout << "More errors added - there are now "
<< " errors"
<< std::endl;
{
std::cout << "Error number: "
<< " : "
<< std::endl;
}
std::cout << std::endl;
}
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
void clearAllErrors()
Remove all errors from the current list of errors.
Definition: ms_errors.cpp:1457
Abstract base class of ms_mascotresfile_dat and ms_mascotresfile_msr.
Definition: ms_mascotresfilebase.hpp:72
std::string getLastErrorString() const
Return the last error number - or an empty string.
Definition: ms_mascotresfilebase.cpp:824
virtual int getObservedCharge(const int query, const bool decoy=false) const =0
The 'charge' returned will be 0 for Mr, otherwise it will be 1, -1, 2, -2, 3, -3 etc....
int getErrorNumber(const int num=-1) const
Return a specific error number - or ms_errs::ERR_NO_ERROR.
Definition: ms_mascotresfilebase.cpp:776
int getLastError() const
Return the last error number - or ms_erros::ERR_NO_ERROR.
Definition: ms_mascotresfilebase.cpp:786
std::string getErrorString(const int num) const
Return a specific error as a string.
Definition: ms_mascotresfilebase.cpp:814
virtual int getNumQueries(const int resfileID=0) const =0
Returns the number of queries (peptide masses or ms-ms spectra).
int getNumberOfErrors() const
Return the number of errors since the last call to clearAllErrors.
Definition: ms_mascotresfilebase.cpp:749