Matrix Science Mascot Parser toolkit
 
Loading...
Searching...
No Matches
config_masses.cpp

Read in the masses file.

/*
##############################################################################
# file: config_masses.cpp #
# 'msparser' toolkit example code #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1998-2005 Matrix Science Limited All Rights Reserved. #
# #
##############################################################################
# $Source: parser/examples/test_cxx/config_masses.cpp $ #
# $Author: villek@matrixscience.com $ #
# $Date: 2018-07-30 16:23:53 +0100 $ #
# $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_3_0_0-2024-09-24-0-g93ebaeb4f4 $ #
# $NoKeywords:: $ #
##############################################################################
*/
#include "msparser.hpp"
#include <iostream>
// All the classes are part of the matrix_science namespace
using namespace matrix_science;
int main(int argc, char * argv[])
{
if ( argc < 2 )
{
std::cout << "The location of masses file has to be specified as a parameter" << std::endl;
std::cout << "The location should either be the full path to the masses file" << std::endl;
std::cout << "or a URL to a Mascot server - e.g. http://mascot-server/mascot/cgi" << std::endl;
return 1;
}
// A sessionID can optionally be passed as the second parameter
// This will only be required if the 'file' is a URL
if (argc > 2)
{
cs.setSessionID(argv[2]);
}
ms_masses file(argv[1], &cs);
if ( !file.isValid() )
{
std::cout << "There are errors. Cannot continue. The last error description:" << std::endl;
std::cout << file.getLastErrorString() << std::endl;
return 1;
}
std::cout << "Average amino acid masses as read from 'masses' file:" << std::endl;
int i;
for(i='A'; i <= 'Z'; i++)
{
std::cout << (char)i << ": " << file.getResidueMass(MASS_TYPE_AVE, i) << std::endl;
}
return 0;
}
/*
will give the output, for instance:
# config_masses ../config/masses
Average amino acid masses as read from 'masses' file:
A: 71.0788
B: 114.596
C: 103.139
D: 115.089
E: 129.116
F: 147.177
G: 57.052
H: 137.141
I: 113.159
J: 0
K: 128.172
L: 113.159
M: 131.193
N: 114.104
O: 0
P: 97.1167
Q: 128.131
R: 156.188
S: 87.0782
T: 101.105
U: 150.034
V: 99.1326
W: 186.213
X: 111
Y: 163.176
Z: 128.623
*/
Settings required to make an HTTP connection to a Mascot server.
Definition: ms_connection_settings.hpp:54
void setSessionID(const std::string sessionID)
Sets the Mascot security sessionID to be used for the connection.
Definition: ms_connection_settings.cpp:242
std::string getLastErrorString() const
Return the error description of the last error that occurred.
Definition: ms_errors.cpp:1488
bool isValid() const
Call this function to determine if there have been any errors.
Definition: ms_errors.cpp:1472
Reads and parses the masses file with residue and atom masses.
Definition: ms_masses.hpp:48
double getResidueMass(const matrix_science::MASS_TYPE massType, const char residue) const
Returns a mass for a given amino acid.
Definition: ms_masses.cpp:872