📄 readresult.cpp
字号:
/* * =========================================================================== * PRODUCTION $Log: readresult.cpp,v $ * PRODUCTION Revision 1000.1 2004/06/01 18:09:16 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3 * PRODUCTION * =========================================================================== *//* $Id: readresult.cpp,v 1000.1 2004/06/01 18:09:16 gouriano Exp $* ===========================================================================** PUBLIC DOMAIN NOTICE* National Center for Biotechnology Information** This software/database is a "United States Government Work" under the* terms of the United States Copyright Act. It was written as part of* the author's official duties as a United States Government employee and* thus cannot be copyrighted. This software/database is freely available* to the public for use. The National Library of Medicine and the U.S.* Government have not placed any restriction on its use or reproduction.** Although all reasonable efforts have been taken to ensure the accuracy* and reliability of the software and data, the NLM and the U.S.* Government do not and cannot warrant the performance or results that* may be obtained by using this software or data. The NLM and the U.S.* Government disclaim all warranties, express or implied, including* warranties of performance, merchantability or fitness for any particular* purpose.** Please cite the authors in any work or product based on this material.** ===========================================================================** Author: Lewis Y. Geer* * File Description:* reads in an omssa search result, which is formatted in ASN.1,* iterates through the results and prints them.** ===========================================================================*/#include <ncbi_pch.hpp>#include <corelib/ncbiargs.hpp>#include <corelib/ncbiapp.hpp>#include <corelib/ncbienv.hpp>#include <corelib/ncbistre.hpp>#include <serial/serial.hpp>#include <serial/objistrasn.hpp>#include <serial/objistrasnb.hpp>#include <serial/objostrasn.hpp>#include <serial/objostrasnb.hpp>#include <serial/iterator.hpp>#include <objects/omssa/omssa__.hpp>#include <string>USING_NCBI_SCOPE;USING_SCOPE(objects);// subclass of standard NCBI application classclass CReadresult : public CNcbiApplication {public: virtual int Run(); virtual void Init();};// initialize applicationvoid CReadresult::Init(){ auto_ptr<CArgDescriptions> argDesc(new CArgDescriptions); // set up command line arguments argDesc->AddDefaultKey("o", "omssafile", "file with results from omssa", CArgDescriptions::eString, ""); SetupArgDescriptions(argDesc.release()); SetDiagPostLevel(eDiag_Info);}int main(int argc, const char* argv[]) { CReadresult theTestApp; return theTestApp.AppMain(argc, argv);}// run applicationint CReadresult::Run(){ CArgs args = GetArgs(); try { // read in omssa files if(args["o"].AsString().size() > 0) { // input stream (specialized for ASN.1) auto_ptr<CObjectIStream> in(CObjectIStream::Open(args["o"].AsString().c_str(), eSerial_AsnText)); // object to hold input CMSResponse Response; // read it in in->Read(ObjectInfo(Response)); CMSResponse::THitsets::const_iterator iHits; iHits = Response.GetHitsets().begin(); // iterate through sets of hits, where each set corresponds // to a spectrum for(; iHits != Response.GetHitsets().end(); iHits++) { CRef< CMSHitSet > HitSet = *iHits; // ERR_POST macro writes to error log, which is usually cerr ERR_POST(Info << "Hitset: " << HitSet->GetNumber()); if( HitSet-> CanGetError() && HitSet->GetError() == eMSHitError_notenuffpeaks) { ERR_POST(Info << "Hitset Empty"); continue; } // iterate through peptide hits for each spectrum CMSHitSet::THits::const_iterator iHit; CMSHits::TPephits::const_iterator iPephit; for(iHit = HitSet->GetHits().begin(); iHit != HitSet->GetHits().end(); iHit++) { ERR_POST(Info << (*iHit)->GetPepstring() << ": " << "P = " << (*iHit)->GetPvalue() << " E = " << (*iHit)->GetEvalue()); // iterate through each sequence that contains the peptide hit for(iPephit = (*iHit)->GetPephits().begin(); iPephit != (*iHit)->GetPephits().end(); iPephit++) { ERR_POST(Info << (*iPephit)->GetGi() << ": " << (*iPephit)->GetStart() << "-" << (*iPephit)->GetStop() << ":" << (*iPephit)->GetDefline()); } } } } } catch (exception& e) { ERR_POST(Fatal << e.what()); return 1; } return 0;}/*$Log: readresult.cpp,v $Revision 1000.1 2004/06/01 18:09:16 gourianoPRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.3Revision 1.3 2004/05/21 21:41:03 gorelenkAdded PCH ncbi_pch.hppRevision 1.2 2003/10/29 22:22:50 lewisgadded commentsRevision 1.1 2003/10/27 20:10:56 lewisgdemo program to read out omssa results */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -