Matrix Science header

ms_mascotresfile.hpp

00001 /*
00002 ##############################################################################
00003 # file: ms_mascotresfile.hpp                                                 #
00004 # 'msparser' toolkit                                                         #
00005 # Encapsulates a  mascot results file                                        #
00006 ##############################################################################
00007 # COPYRIGHT NOTICE                                                           #
00008 # Copyright 1998-2002 Matrix Science Limited  All Rights Reserved.           #
00009 #                                                                            #
00010 ##############################################################################
00011 #    $Archive:: /MowseBranches/ms_mascotresfile_1.2/include/ms_mascotresfi $ #
00012 #     $Author: villek $ #
00013 #       $Date: 2017/04/12 09:57:30 $ #
00014 #   $Revision: 1.99 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_MASCOTRESFILE_HPP
00020 #define MS_MASCOTRESFILE_HPP
00021 
00022 
00023 #ifdef _WIN32
00024 #pragma warning(disable:4251)   // Don't want all classes to be exported
00025 #pragma warning(disable:4786)   // Debug symbols too long
00026 #   ifndef _MATRIX_USE_STATIC_LIB
00027 #       ifdef MS_MASCOTRESFILE_EXPORTS
00028 #           define MS_MASCOTRESFILE_API __declspec(dllexport)
00029 #       else
00030 #           define MS_MASCOTRESFILE_API __declspec(dllimport)
00031 #       endif
00032 #   else
00033 #       define MS_MASCOTRESFILE_API
00034 #   endif
00035 #else
00036 #   define MS_MASCOTRESFILE_API
00037 #endif
00038 
00039 // for the sake of #include <string>
00040 #ifdef __ALPHA_UNIX__
00041 #include <varargs.h>
00042 #else
00043 #include <stdarg.h>
00044 #endif
00045 
00046 
00047 // Includes from the standard template library
00048 #include <time.h>
00049 #include <string>
00050 #include <list>
00051 #include <vector>
00052 #include <set>
00053 
00054 namespace msparser_internal {
00055     class ms_cdb;
00056     class ms_peptidesumcdb;
00057 }
00058 
00059 namespace matrix_science {
00060     class ms_searchparams;
00061     class ms_umod_configfile;
00062     class ms_masses;
00063     class ms_enzymefile;
00064     class ms_taxonomyfile;
00065     class ms_mascotresults_params;
00066 
00072 #ifndef SWIG
00073     class multiBuf {
00074     public:
00075         multiBuf()  {pMem_ = 0; len_ = 0; pEnd_ = 0;}
00076     public :
00077         char *pMem_;  // pointer to first block of memory
00078         int  len_;    // excluding any null terminator
00079         char *pEnd_;  // Pointer to last byte (not the null terminator)
00080     private:
00081     };
00082     typedef std::vector<multiBuf> multiBuf_v;  
00083 
00084     class multiBufMemPtr {
00085     public:
00086         enum MBMP { MBMP_INVALID = -1, MBMP_USING_CDB = -2 };
00087         multiBufMemPtr(int bufNum, char *pMem)
00088             : bufNum_(bufNum), pMem_(pMem) {};
00089         multiBufMemPtr() : bufNum_(MBMP_INVALID), pMem_(0) {};
00090         void decrement(const multiBuf_v & buffers);
00091         void decrementUntil(const multiBuf_v & buffers, const char * chars);
00092         void increment(const multiBuf_v & buffers);
00093         bool isValid() const {return bufNum_ != MBMP_INVALID;}
00094         bool operator<(const multiBufMemPtr & rhs);
00095         bool operator<=(const multiBufMemPtr & rhs);
00096             
00097     public:
00098         int    bufNum_;
00099         char * pMem_;
00100     };
00101 
00102     // ms_sortByKeyCriterion class is used internally in the library
00103     // to give fast access to the keys. Don't use it from outside the DLL
00104     class ms_sortByKeyCriterion
00105     {
00106         public:
00107             enum CMP_MODE {CASE_INSENSITIVE=0x01, CASE_SENSITIVE=0x02, QUOTED=0x04};
00108             ms_sortByKeyCriterion(int m=(int)CASE_INSENSITIVE) : mode_(m) {}
00109             bool operator() (const char * p1, const char * p2) const;
00110 
00111         private:
00112             int mode_;
00113             // Unfortunately, when called from Perl in Windows, 
00114             // the toupper function ends up calling extra functions
00115             // to convert to wide char and back again. We don't
00116             // want language independent conversion here - the
00117             // key names are all single byte.
00118             inline char my_toupper(char ch) const
00119             {
00120                 if (mode_ & CASE_INSENSITIVE && ch >= 'a' && ch <= 'z')
00121                     return 'A' + (ch-'a');
00122                 else
00123                     return ch;
00124             }
00125 
00126     };
00127 #endif
00128 
00130 
00135     class MS_MASCOTRESFILE_API ms_mascotresfile : public ms_errors
00136     {
00137         friend class msparser_internal::ms_peptidesumcdb;
00138         public:
00140 
00143             // Developer note: Add new sections to this enum just before
00144             // SEC_INDEX just in case a perl programmer has used constant
00145             // numbers instead of SEC_ values in their code.
00146             enum section 
00147             { 
00148                 SEC_PARAMETERS,       
00149                 SEC_HEADER,           
00150                 SEC_MASSES,           
00151                 SEC_SUMMARY,          
00152                 SEC_MIXTURE,          
00153                 SEC_PEPTIDES,         
00154                 SEC_PROTEINS,         
00155                 SEC_QUERY1,           
00156                 SEC_QUANTITATION,     
00157                 SEC_UNIMOD,           
00158                 SEC_ENZYME,           
00159                 SEC_TAXONOMY,         
00160                 SEC_DECOYSUMMARY,     
00161                 SEC_DECOYMIXTURE,     
00162                 SEC_DECOYPEPTIDES,    
00163                 SEC_DECOYPROTEINS,    
00164                 SEC_ERRTOLSUMMARY,    
00165                 SEC_ERRTOLPEPTIDES,   
00166                 SEC_SPECTRAL_LIBRARY, 
00167                 SEC_LIBRARYPEPTIDES,  
00168                 SEC_LIBRARYSUMMARY,   
00169                 SEC_INDEX,            
00170                 SEC_NUMSECTIONS       
00171             };
00172 
00174 
00181             enum err
00182             {
00183                 ERR_NO_ERROR                        = 0x0000, 
00184                 ERR_NOMEM                           = 0x0001, 
00185                 ERR_NOSUCHFILE                      = 0x0002, 
00186                 ERR_READINGFILE                     = 0x0003, 
00187                 ERR_QUERYOUTOFRANGE                 = 0x0004, 
00188                 ERR_MISSINGENTRY                    = 0x0005, 
00189                 ERR_PEPSUMMPEPGET                   = 0x0006, 
00190                 ERR_PEPTIDESTR                      = 0x0007, 
00191                 ERR_ACCINPEPTIDESTR                 = 0x0008, 
00192                 ERR_PROTSUMM                        = 0x0009, 
00193                 ERR_PROTSUMMPEP                     = 0x000A, 
00194                 ERR_ADDPEPTIDES                     = 0x000B, 
00195                 ERR_MISSINGHIT                      = 0x000C, 
00196                 ERR_MISSINGSECTION                  = 0x000D, 
00197                 ERR_MISSINGSECTIONEND               = 0x000E, 
00198                 ERR_MALFORMED_ERR_TOL               = 0x000F, 
00199                 ERR_NO_ERR_TOL_PARENT               = 0x0010, 
00200                 ERR_NULL_ACC_PEP_SUM                = 0x0011, 
00201                 ERR_NULL_ACC_PROT_SUM               = 0x0012, 
00202                 ERR_DUPE_ACCESSION                  = 0x0013, 
00203                 ERR_UNASSIGNED_PROG                 = 0x0014, 
00204                 ERR_UNASSIGNED_RANGE                = 0x0015, 
00205                 ERR_UNASSIGNED_UNK                  = 0x0016, 
00206                 ERR_NO_UNIGENE_FILE                 = 0x0017, 
00207                 ERR_DUPLICATE_KEY                   = 0x0018, 
00208                 ERR_OLDRESULTSFILE                  = 0x0019, 
00209                 ERR_MALFORMED_TAG                   = 0x001A, 
00210                 ERR_MALFORMED_DRANGE                = 0x001B, 
00211                 ERR_INVALID_NUMQUERIES              = 0x001C, 
00212                 ERR_MALFORMED_TERMS                 = 0x001D, 
00213                 ERR_INVALID_RESFILE                 = 0x001E, 
00214                 ERR_INVALID_PROTDB                  = 0x001F, 
00215                 ERR_UNIGENE_MULTIDB                 = 0x0020, 
00216                 ERR_INVALID_CACHE_DIR               = 0x0021, 
00217                 ERR_FAIL_OPEN_DAT_FILE              = 0x0022, 
00218                 ERR_MISSING_CDB_FILE                = 0x0023, 
00219                 ERR_FAIL_MK_CACHE_DIR               = 0x0024, 
00220                 ERR_FAIL_MK_CDB_FILE                = 0x0025, 
00221                 ERR_FAIL_CLOSE_FILE                 = 0x0026, 
00222                 ERR_FAIL_CDB_INIT                   = 0x0027, 
00223                 ERR_INVALID_CDB_FILE                = 0x0028, 
00224                 ERR_WRITE_CDB_FILE                  = 0x0029, 
00225                 ERR_CDB_TOO_LARGE                   = 0x002A, 
00226                 ERR_NEED_64_BIT                     = 0x002B, 
00227                 ERR_CDB_64_BIT_REMAKE               = 0x002C, 
00228                 ERR_CDB_OLD_VER_RETRY               = 0x002D, 
00229                 ERR_CDB_OLD_VER_NO_RETRY            = 0x002E, 
00230                 ERR_CDB_INCOMPLETE_RETRY            = 0x002F, 
00231                 ERR_CDB_INCOMPLETE_NO_RETRY         = 0x0030, 
00232                 ERR_CDB_BEING_CREATED               = 0x0031, 
00233                 ERR_CDB_FAIL_REMOVE                 = 0x0032, 
00234                 ERR_CDB_FAIL_LOCK                   = 0x0033, 
00235                 ERR_CDB_FAIL_UNLOCK                 = 0x0034, 
00236                 ERR_CDB_SOURCE_CHANGE_RETRY         = 0x0035, 
00237                 ERR_CDB_SOURCE_CHANGE_NO_RETRY      = 0x0036, 
00238                 ERR_MISSING_PERCOLATOR_FILE         = 0x0037, 
00239                 ERR_CANNOT_APPEND_RESFILE           = 0x0038, 
00240                 ERR_CANNOT_APPEND_RESFILE_NO_FNAMES = 0x0039, 
00241                 ERR_RESULTS_NOT_CREATED             = 0x003A, 
00242                 ERR_LASTONE                         = 0x003B
00243             };
00244             // this list has to be included into ms_errors.hpp file too !!!
00245 
00246             
00248 
00252             enum FLAGS 
00253             { 
00254 
00255                 RESFILE_NOFLAG                 = 0x00000000, 
00256                 RESFILE_USE_CACHE              = 0x00000001, 
00257                 RESFILE_CACHE_IGNORE_ACC_DUPES = 0x00000002, 
00258                 RESFILE_USE_PARENT_PARAMS           = 0x00000004, 
00259                 RESFILE_CACHE_IGNORE_DATE_CHANGE    = 0x00000008  
00260             };
00261 
00263 
00268             enum PERCOLATOR_FILE_NAMES
00269             {
00270                 PERCOLATOR_INPUT_FILE       = 0,  
00271                 PERCOLATOR_OUTPUT_TARGET    = 1,  
00272                 PERCOLATOR_OUTPUT_DECOY     = 2   
00273             };
00274 
00276 
00281             enum KA_TASK
00282             {
00283                 KA_CREATEINDEX_CI    = 0,  
00284                 KA_READFILE_RF       = 1,  
00285                 KA_ASSIGNPROTEINS_AP = 2,  
00286                 KA_GROUPPROTEINS_GP  = 3,  
00287                 KA_UNASSIGNEDLIST_UL = 4,  
00288                 KA_QUANTITATION      = 5,  
00289                 KA_CREATECACHE_CC    = 6,  
00290                 KA_THRESHFORFDR_FDR  = 7,  
00291                 KA_LAST              = 8   
00292             };
00293 
00295 
00297             enum XML_SCHEMA
00298             {
00299                 XML_SCHEMA_QUANTITATION = 0, 
00300                 XML_SCHEMA_UNIMOD       = 1, 
00301                 XML_SCHEMA_DIRECTORY    = 2, 
00302                 XML_SCHEMA_LAST         = 3  
00303 
00304             };
00305 
00307             ms_mascotresfile(const char * szFileName,
00308                              const int    keepAliveInterval = 0,
00309                              const char * keepAliveText = "<!-- %d seconds -->\n",
00310                              const unsigned int flags = RESFILE_NOFLAG,
00311                              const char * cacheDirectory = "../data/cache/%Y/%m",
00312                              const char * XMLschemaDirectory = 0);
00313 
00314             ~ms_mascotresfile();
00315 
00316             // ------------------- Basic generic functions -------------------
00317             
00319             std::string getMSParserVersion() const;
00320             
00322             bool versionGreaterOrEqual(int major, int minor, int revision) const;
00323 
00325             int appendResfile(const char * filename,
00326                               int flags=RESFILE_USE_PARENT_PARAMS,
00327                               const char * cacheDirectory = 0);  // returns 'id' of added file
00328 
00330             const ms_mascotresfile * getResfile(int id) const;
00331 
00333             int getNumberOfResfiles() const; 
00334 
00336             bool doesSectionExist(const section sec) const;
00337 
00339             bool anyPeptideSummaryMatches(const section sec=SEC_PEPTIDES);
00340 
00341             // When calling 'getSectionValue' from outside the dll, be careful
00342             // that enough space is 'reserved' in the string.
00343             // Return value is length of the actual string that it wanted to
00344             // to return, so if this is larger than maxLen, then you are 
00345             // missing some of the string. Best to call getSectionValueStr
00347             int  getSectionValue(const section sec, const char * key, char * str, int maxLen) const;
00348 
00350             int  getSectionValueInt(const section sec, const char * key) const;
00351 
00353             double getSectionValueDouble(const section sec, const char * key) const;
00354 
00356             std::string getSectionValueStr(const section sec, const char * key) const;
00357 
00359             int  getQuerySectionValue(const int query, const char * key, char * str, int maxLen) const;
00360 
00362             int  getQuerySectionValueInt(const int query, const char * key) const;
00363 
00365             double getQuerySectionValueDouble(const int query, const char * key) const;
00366 
00368             std::string getQuerySectionValueStr(const int query, const char * key) const;
00369 
00371             int getJobNumber(const int resfileID = 1) const;
00372 
00374             std::string enumerateSectionKeys(const section sec, 
00375                                              const int num,
00376                                              int        * pPreviousNum    = 0,
00377                                              OFFSET64_T * pPreviousOffset = 0) const;
00378 
00380             std::string enumerateQuerySectionKeys(const int query,
00381                                                   const int num,
00382                                                   int        * pPreviousNum    = 0,
00383                                                   OFFSET64_T * pPreviousOffset = 0) const;
00384 
00385 #ifndef SWIG
00386             // Not used from the outside world...
00387             void setError(int error, ...);
00388 #endif
00389 
00391             int  getNumberOfErrors() const;
00392 
00394             int  getErrorNumber(const int num = -1) const;
00395 
00397             int  getLastError() const;
00398 
00400             std::string getErrorString(const int num) const;
00401 
00403             std::string getLastErrorString() const;
00404 
00406             void resetKeepAlive(const int keepAliveInterval, const char * keepAliveText, 
00407                                 const bool propagateToAppended = true, const bool resetStartTime = false);
00408 
00409 #ifndef SWIG
00410 
00411             bool getNextSubStr(const std::string & input, 
00412                                std::string::size_type & idx,
00413                                std::string & output,
00414                                const char * separator = ",",
00415                                const bool removeQuotes = false) const;
00416 #endif
00417 
00418             // ----------------- Specific results functions ------------------
00420             int    getNumQueries(const int resfileID = 0) const;
00421 
00423             int    getNumHits(const section sec=SEC_SUMMARY) const;
00424 
00426             int getNumSeqs(const int idx = 0) const;
00427 
00429             int getNumSeqsAfterTax(const int idx = 0) const;
00430 
00432             int getNumEtSeqsSearched(const int idx = 0) const;
00433 
00435             int getNumLibraryEntries(const int idx = 0) const;
00436 
00438             double getNumResidues(const int idx = 0) const;
00439 
00441             bool isDatabaseTypeAvailable() const;
00443             DATABASE_TYPE getDatabaseType(const int idx) const;
00445             int getReferenceDatabaseNumberOfSL(const int idx) const;
00446 
00448             std::vector<int> getSLDatabaseNumbersOfReference(const int idx) const;
00449 
00451 
00456             int    getExecTime()        const { return execTime_;             }
00457 
00459 
00465             int    getDate()            const { return searchDate_;           }
00466 
00468 
00475             std::string getMascotVer()  const { return version_;              }
00476 
00478             std::string getFastaVer(int idx = 1) const;
00479 
00481             std::string getFastaPath(int idx = 1) const;
00482 
00484             std::string getUniqueTaskID() const;
00485 
00487             ms_mascotoptions::DECOY_ALGORITHM getDecoyTypeForDB(const int idx = 1) const;
00488             
00490             double getSLFragmentTolerance(int idx = 1) const;
00491             
00493             std::string getSLFragmentToleranceUnit(int idx = 1) const;
00494 
00496             bool isPMF()            const;
00497 
00499             bool isMSMS()           const;
00500 
00502             bool isSQ()             const;
00503 
00505             bool isErrorTolerant()  const;
00506 
00508             bool anyPMF();
00509 
00511             bool anyMSMS();
00512 
00514             bool anySQ();
00515 
00517             bool anyTag();
00518 
00520             double getObservedMass(const int query);
00521 
00523             int    getObservedCharge(const int query, const bool decoy=false);
00524             
00526             double getObservedMrValue(const int query, const bool decoy=false);
00527 
00529             double getObservedIntensity(const int query);
00530 
00532             std::string getRepeatSearchString(const int query, const bool fullQuery = false);
00533 
00535             std::string getFileName(const int id = 1) const;
00536 
00538 
00542             ms_searchparams & params() const { return *params_;              }
00543 
00545             bool getQuantitation(ms_quant_configfile *qfile) const;
00546 
00548             bool getQuantitationMethod(ms_quant_method *qmethod) const;
00549 
00551             bool setXMLschemaFilePath(XML_SCHEMA XMLschema, const char * path);
00552 
00554             std::string getXMLschemaFilePath(XML_SCHEMA XMLschema) const;
00555 
00557             bool getUnimod(ms_umod_configfile *ufile, bool useSchemaFromResfile = false) const;
00558 
00560             bool getMasses(ms_masses  * masses) const;
00561 
00563             bool getEnzyme(ms_enzymefile *efile, const char * enzymeFileName = 0) const;
00564 
00566             bool getTaxonomy(ms_taxonomyfile *tfile) const;
00567 
00569             bool outputKeepAlive() const;
00570 
00572             void getKeepAlive(KA_TASK     & kaTask, 
00573                               int         & kaPercentage, 
00574                               std::string & kaAccession, 
00575                               int         & kaHit, 
00576                               int         & kaQuery,
00577                               std::string & kaText) const;
00578 
00579             // Internal use only
00580             bool outputKeepAlive(KA_TASK kaTask, int percentageComplete, const char * accession, int hit, int query) const;
00581 
00583             std::string getCacheDirectory(bool processed = true) const;
00584 
00586             std::string getCacheFileName() const;
00587 
00588 #ifndef SWIG  // Can't / don't want to allow std::string * as OUTPUT in Java and C#
00589 
00590             static bool willCreateCache(const char * szFileName,
00591                                         const unsigned int flags,
00592                                         const char * cacheDirectory,
00593                                         std::string * cacheFileName);
00594 #endif
00595             static bool willCreateCache(const char * szFileName,
00596                                         const unsigned int flags,
00597                                         const char * cacheDirectory,
00598                                         std::string & cacheFileName) {
00599                 return (ms_mascotresfile::willCreateCache(szFileName, flags, cacheDirectory, &cacheFileName));
00600             }
00601 
00602 
00604             std::string get_ms_mascotresults_params(const ms_mascotoptions & opts,  
00605                                                     unsigned int * gpFlags,                    
00606                                                     double       * gpMinProbability,        
00607                                                     int          * gpMaxHitsToReport,       
00608                                                     double       * gpIgnoreIonsScoreBelow,  
00609                                                     unsigned int * gpMinPepLenInPepSummary,
00610                                                     bool         * gpUsePeptideSummary,
00611                                                     unsigned int * gpFlags2);
00612 
00614             std::string get_ms_mascotresults_params(const ms_mascotoptions          & opts,
00615                                                           ms_mascotresults_params   & params);
00616 
00618             static bool staticGetPercolatorFileNames(const char * szDatFileName,
00619                                                      const char * cacheDirectory,
00620                                                      const char * percolatorFeatures,
00621                                                      const char * additionalFeatures,
00622                                                      const bool   useRetentionTimes,
00623                                                      std::vector<std::string> & filenames,
00624                                                      std::vector<bool> & exists);
00625 
00627             void setPercolatorFeatures(const char * percolatorFeatures,
00628                                        const char * additionalFeatures,
00629                                        const bool   useRetentionTimes);
00630 
00632             std::vector<std::string> getPercolatorFileNames() const;
00633 
00635             bool getSrcQueryAndFileIdForMultiFile(const int q, int & gsqNewQuery, int & gsqFileId) const;
00636 
00638             int getMultiFileQueryNumber(const int localQuery, const int fileId) const;
00639 
00641             void appendErrors(ms_errs & errs);
00642             std::string getEncodedPercolatorFeatures() { return percolatorFeatures_; }
00643 
00644         protected:  
00645 #ifndef SWIG
00646             // Not safe to copy or assign this object.
00647             ms_mascotresfile(const ms_mascotresfile & rhs);
00648             ms_mascotresfile & operator=(const ms_mascotresfile & rhs);
00649 #endif
00650 
00651         private:
00652             std::string  fileName_;
00653             int          numQueries_;              // For multifile, this is the total of all queries for all files.
00654             std::vector<int> multifileNumQueries_; // 0 based vector, with 0 being the primary file
00655             typedef std::vector<ms_mascotresfile *> resfileV_t; // 0 based vector, with 0 being the primary file
00656             resfileV_t   multifileResfiles_;
00657             int          protSummaryHits_;
00658             int          numSequences_;        
00659             int          numSequencesAfterTax_;
00660             double       numResidues_;         
00661             int          numLibraryEntries_;
00662             int          execTime_;            
00663             int          searchDate_;          
00664             std::string  version_;
00665 
00666             std::vector<DATABASE_TYPE> dbType_;
00667             std::vector<int>           slReferenceMap_;
00668 
00669             int  keepAliveInterval_;
00670             std::string  keepAliveTextStr_;
00671             std::string  keepAliveText_[KA_LAST];
00672             time_t       keepAliveStartTime_;
00673             // Following are mutable so outputKeepAlive can be a const function
00674             mutable KA_TASK     keepAliveTask_;
00675             mutable time_t      lastKeepAliveTime_; 
00676             mutable int         keepAlivePercentage_;
00677             mutable std::string keepAliveAccession_;
00678             mutable int         keepAliveHit_;
00679             mutable int         keepAliveQuery_;
00680 
00681             bool         anyMSMS_;
00682             bool         cachedAnyMSMS_;
00683             bool         anyPMF_;
00684             bool         cachedAnyPMF_;
00685             bool         anySQ_;
00686             bool         cachedAnySQ_;
00687             bool         anyTag_;
00688             bool         cachedAnyTag_;
00689             mutable bool isErrorTolerant_;
00690             mutable bool cachedIsErrorTolerant_;
00691 
00692             unsigned int flags_;
00693             msparser_internal::ms_cdb * pIndexFile_;
00694             bool         useIndexFile_;
00695             std::string  cacheDirectory_;
00696             int          hFile_;
00697             mutable char *       readlnBuf_;
00698             mutable unsigned int readlnBufSize_;
00699 
00700             ms_searchparams *params_;
00701 
00702             std::string percolatorFeatures_;       // Encoded string
00703             std::vector<std::string> percolatorFileNames_;
00704 
00705             const char * sectionTitles_[SEC_NUMSECTIONS];
00706 
00707             multiBufMemPtr sectionStart_[SEC_NUMSECTIONS];
00708             multiBufMemPtr sectionEnd_  [SEC_NUMSECTIONS];
00709 
00710             multiBuf_v buffers_;
00711 
00712             std::string endSectionKey_;
00713             std::string lineBasedEndSectionKey_;
00714             std::string genericQuerySectionKey_;
00715             bool   isWinIniFormat_;
00716             std::vector<double> cachedMrValues_;
00717             std::vector<double> cachedExpValues_;
00718             std::vector<short>  cachedCharges_;
00719 
00720             std::vector<std::string> xmlSchemaPath_;
00721             multiBufMemPtr findSectionStart(const char * szSectionName,
00722                                            const multiBufMemPtr * startLookingAt = 0);
00723             multiBufMemPtr findSectionEnd(const multiBufMemPtr sectionStart);
00724 
00725             // Array of maps for each section
00726             typedef std::set<const char *,ms_sortByKeyCriterion> sortedKeys;
00727             sortedKeys sorted_[SEC_NUMSECTIONS];
00728             bool fillUpSortedList(const int section,
00729                                   const multiBufMemPtr sectionStart,
00730                                   const multiBufMemPtr sectionEnd,
00731                                   sortedKeys & sorted_keys);
00732 
00733             // There are an 'unknown' number of query sections
00734             bool hasQuerySectionBeenIndexed;
00735             std::vector<multiBufMemPtr> querySectionStart_;
00736             std::vector<multiBufMemPtr> querySectionEnd_;
00737             std::vector<sortedKeys> sortedQueries_;
00738 
00739             // Private function to get string
00740             bool inDLLgetSectVal(const section sec,
00741                                  const int queryNumber,
00742                                  const multiBufMemPtr sectionStart,
00743                                  const multiBufMemPtr sectionEnd,
00744                                  sortedKeys & sorted_keys,
00745                                  const char * key,
00746                                  std::string & result) const;
00747 
00748             // Private function to get string
00749             bool inDLLgetSectionAsString(const section sec,
00750                                          std::string & result) const;
00751 
00752             bool readFile(const char * szFileName);
00753             bool readLine(char * & buf, unsigned int & bufSize) const;
00754             void getSectionTitles();
00755             void debugCheckReadFileOK();
00756             bool createCDBFile();
00757             void prepareKeepAlive(const char * keepAliveText, const bool resetStartTime);
00758             std::string getKeepAliveString(const double elapsedTime) const;
00759             static std::string getSortedPercolatorFeatures(const char * percolatorFeatures,
00760                                                            const char * additionalFeatures,
00761                                                            const bool   useRetentionTimes);
00762             bool setErrorInfoFromString(const std::string & e);
00763             std::string getErrorInfoAsString(const int num) const;
00764 
00765             int extractObservedCharge(char *szKey, std::string str);
00766             std::string enumerateQuerySection(const int     query,
00767                                               const int     num,
00768                                               int         * pPreviousNum,
00769                                               OFFSET64_T  * pPreviousOffset,
00770                                               OFFSET64_T  * pSectionEnd,
00771                                               std::string & value) const;
00772             
00773             void getSLFragmentToleranceAndUnit_Value(int idx, double & tolerance, std::string & toleranceUnit) const;
00774 
00775             std::map<section, bool> mapSectionAnyMatch_;
00776 
00777     }; // end of resfile_group
00779 }   // matrix_science namespace
00780 #endif // MS_MASCOTRESFILE_HPP
00781 
00782 /*------------------------------- End of File -------------------------------*/
Copyright © 2016 Matrix Science Ltd.  All Rights Reserved. Generated on Fri Jun 2 2017 01:44:51