Read in the enzymes file.
/* ############################################################################## # file: config_enzymes.cpp # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2005 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_cxx/config_enzymes.cpp $ # # $Author: villek@matrixscience.com $ # # $Date: 2018-07-30 16:23:53 +0100 $ # # $Revision: 1b450440f9c97e1e41d0fc6016a27d68951d4532 | MSPARSER_REL_2_8_1-0-gea32989045 $ # # $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 enzymes file has to be specified as a parameter" << std::endl; std::cout << "The location should either be the full path to the enzymes 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_enzymefile 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; } // how many do we have in total? int n = file.getNumberOfEnzymes(); std::cout << "There are " << n << " enzymes definitions available" << std::endl; // now get them all! int i; for(i=0; i < n ; i++) { const ms_enzyme * enzyme = file.getEnzymeByNumber(i); std::cout << enzyme->getTitle() << ": "; for (int c=0; c < enzyme->getNumberOfCutters(); c++) { if (enzyme->getCutterType(c) == matrix_science::ms_enzyme::NTERM_CUTTER) { std::cout << "nTerm - "; } else { std::cout << "cTerm - "; } std::cout << enzyme->getCleave(c) << "!" << enzyme->getRestrict(c); std::cout << "; "; } std::cout << std::endl; } // Now try updating the first one in the list to semi-specific ms_enzyme enzyme = *file.getEnzymeByNumber(0); enzyme.setSemiSpecific(true); file.updateEnzymeByNumber(0, enzyme); // And delete V8-DE if (file.deleteEnzymeByName("V8-DE")) { std::cout << "Deleted the enzyme V8-DE " << std::endl; } //Finally, save the file under a new name - but only if not http: if (strncmp("http:", argv[1], 5) != 0) { std::string filename = argv[1]; filename += ".new"; file.setFileName(filename.c_str()); file.save_file(); } std::cout << "There are now " << file.getNumberOfEnzymes() << " enzymes definitions available" << std::endl; return 0; } /* will give the output: # test.exe ../config/enzymes There are 19 enzymes definitions available Trypsin: cTerm - KR!P; Arg-C: cTerm - R!P; Asp-N: nTerm - BD!; Asp-N_ambic: nTerm - DE!; Chymotrypsin: cTerm - FLWY!P; CNBr: cTerm - M!; CNBr+Trypsin: cTerm - M!; cTerm - KR!P; Formic_acid: cTerm - D!; Lys-C: cTerm - K!P; Lys-C/P: cTerm - K!; PepsinA: cTerm - FL!; Tryp-CNBr: cTerm - KMR!P; TrypChymo: cTerm - FKLRWY!P; Trypsin/P: cTerm - KR!; V8-DE: cTerm - BDEZ!P; V8-E: cTerm - EZ!P; semiTrypsin: cTerm - KR!P; LysC+AspN: nTerm - BD!; cTerm - K!P; None: cTerm - KR!P; There are now 18 enzymes definitions available */
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |