Matrix Science header

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: /vol/cvsroot/parser/examples/test_cxx/config_masses.cpp,v $ #
#     $Author: davidc $                                                      #
#       $Date: 2005/03/07 10:59:20 $                                         #
#   $Revision: 1.5 $                                                         #
# $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
    ms_connection_settings cs;
    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

*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:50