Example program for retrieving general search information.
/* ############################################################################## # file: resfile_info.cpp # # 'msparser' toolkit example code # ############################################################################## # COPYRIGHT NOTICE # # Copyright 1998-2005 Matrix Science Limited All Rights Reserved. # # # ############################################################################## # $Source: parser/examples/test_cxx/resfile_info.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; /*****************************************************************************/ /* Local functions */ /* (This test harness is 'C' and not C++) */ /*****************************************************************************/ static void searchInformation(ms_mascotresfile & file); /*****************************************************************************/ /* main */ /* Call this program with a single argument - the name of the .dat file */ /*****************************************************************************/ int main(int argc, char * argv[]) { if (argc == 2) { ms_mascotresfile file(argv[1]); if (file.isValid()) { searchInformation(file); } else std::cout << "Error: " << file.getLastErrorString() << std::endl; } else std::cout << "Must supply the name of a .dat file as a command line argument" << std::endl; return 0; } /*****************************************************************************/ /* searchInformation */ /* Display parameters from the ms_mascotresfile object. The functions */ /* anyPMF, anyMSMS, anySQ should normally be used in preference to isPMF */ /* etc. because some people submit MSMS though the sequence query window. */ /*****************************************************************************/ static void searchInformation(ms_mascotresfile & file) { time_t t = (time_t)file.getDate(); struct tm * t1 = localtime(&t); std::cout << "Search information from ms_mascotresfile" << std::endl; std::cout << "========================================" << std::endl; std::cout << "Number of queries : " << file.getNumQueries() << std::endl; std::cout << "Number of hits : " << file.getNumHits() << std::endl; std::cout << "Number of sequences : " << file.getNumSeqs() << std::endl; std::cout << "Sequences after tax : " << file.getNumSeqsAfterTax() << std::endl; std::cout << "Number of residues : " << file.getNumResidues() << std::endl; std::cout << "Execution time : " << file.getExecTime() << std::endl; std::cout << "Date (seconds) : " << file.getDate() << std::endl; std::cout << "Date : " << asctime(t1); std::cout << "Mascot version : " << file.getMascotVer() << std::endl; std::cout << "Fasta version : " << file.getFastaVer() << std::endl; std::cout << "Is PMF? : " << file.isPMF() << std::endl; std::cout << "Is MSMS? : " << file.isMSMS() << std::endl; std::cout << "Is SQ? : " << file.isSQ() << std::endl; std::cout << "Is Error tolerant : " << file.isErrorTolerant()<< std::endl; std::cout << "Any PMF? : " << file.anyPMF() << std::endl; std::cout << "Any MSMS? : " << file.anyMSMS() << std::endl; std::cout << "Any SQ? : " << file.anySQ() << std::endl; std::cout << "Any peptides section: " << file.doesSectionExist(ms_mascotresfile::SEC_PEPTIDES) << std::endl; std::cout << "Any peptide matches : " << file.anyPeptideSummaryMatches() << std::endl; std::cout << std::endl; } /* will give the output: # test.exe F981123.dat Search information from ms_mascotresfile ======================================== Number of queries : 4 Number of hits : 50 Number of sequences : 820227 Sequences after tax : 820227 Number of residues : 2.55697e+008 Execution time : 14 Date (seconds) : 1014568786 Date : Sun Feb 24 16:39:46 2002 Mascot version : 1.7.17 Fasta version : MSDB_20020121.fasta Is PMF? : 0 Is MSMS? : 1 Is SQ? : 0 Is Error tolerant : 0 Any PMF? : 0 Any MSMS? : 1 Any SQ? : 0 Any peptides section: 1 Any peptide matches : 1 */
Copyright © 2022 Matrix Science Ltd. All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29 |