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@matrixscience.com $ #
00013 #       $Date: 2021-07-08 14:45:37 +0100 $ #
00014 #   $Revision: 1c420cd7e2bac7ee9d3dec2956a84cc96c80d860 | MSPARSER_REL_2_8_1-0-gea32989045 $ #
00015 # $NoKeywords::                                                            $ #
00016 ##############################################################################
00017 */
00018 
00019 #ifndef MS_MASCOTRESFILE_HPP
00020 #define MS_MASCOTRESFILE_HPP
00021 
00022 
00023 
00024 // Includes from the standard template library
00025 #include <stdarg.h>
00026 #include <time.h>
00027 #include <string>
00028 #include <list>
00029 #include <vector>
00030 #include <set>
00031 
00032 namespace msparser_internal {
00033     class ms_cdb;
00034     class ms_peptidesumcdb;
00035 }
00036 
00037 namespace matrix_science {
00038     class ms_searchparams;
00039     class ms_umod_configfile;
00040     class ms_masses;
00041     class ms_enzymefile;
00042     class ms_taxonomyfile;
00043     class ms_mascotresults_params;
00044 
00050 #ifndef SWIG
00051     class multiBuf {
00052     public:
00053         multiBuf()  {pMem_ = 0; len_ = 0; pEnd_ = 0;}
00054     public :
00055         char *pMem_;  // pointer to first block of memory
00056         int  len_;    // excluding any null terminator
00057         char *pEnd_;  // Pointer to last byte (not the null terminator)
00058     private:
00059     };
00060     typedef std::vector<multiBuf> multiBuf_v;  
00061 
00062     class multiBufMemPtr {
00063     public:
00064         enum MBMP { MBMP_INVALID = -1, MBMP_USING_CDB = -2 };
00065         multiBufMemPtr(int bufNum, char *pMem)
00066             : bufNum_(bufNum), pMem_(pMem) {};
00067         multiBufMemPtr() : bufNum_(MBMP_INVALID), pMem_(0) {};
00068         void decrement(const multiBuf_v & buffers);
00069         void decrementUntil(const multiBuf_v & buffers, const char * chars);
00070         void increment(const multiBuf_v & buffers);
00071         bool isValid() const {return bufNum_ != MBMP_INVALID;}
00072         bool operator<(const multiBufMemPtr & rhs);
00073         bool operator<=(const multiBufMemPtr & rhs);
00074             
00075     public:
00076         int    bufNum_;
00077         char * pMem_;
00078     };
00079 
00080     // ms_sortByKeyCriterion class is used internally in the library
00081     // to give fast access to the keys. Don't use it from outside the DLL
00082     class ms_sortByKeyCriterion
00083     {
00084         public:
00085             enum CMP_MODE {CASE_INSENSITIVE=0x01, CASE_SENSITIVE=0x02, QUOTED=0x04};
00086             ms_sortByKeyCriterion(int m=(int)CASE_INSENSITIVE) : mode_(m) {}
00087             bool operator() (const char * p1, const char * p2) const;
00088 
00089         private:
00090             int mode_;
00091             // Unfortunately, when called from Perl in Windows, 
00092             // the toupper function ends up calling extra functions
00093             // to convert to wide char and back again. We don't
00094             // want language independent conversion here - the
00095             // key names are all single byte.
00096             inline char my_toupper(char ch) const
00097             {
00098                 if ((mode_ & CASE_INSENSITIVE) && ch >= 'a' && ch <= 'z')
00099                     return static_cast<char>('A' + (ch-'a'));
00100                 else
00101                     return ch;
00102             }
00103 
00104     };
00105 #endif
00106 
00108 
00113     class MS_MASCOTRESFILE_API ms_mascotresfile : public ms_errors
00114     {
00115         friend class msparser_internal::ms_peptidesumcdb;
00116         public:
00118 
00121             // Developer note: Add new sections to this enum just before
00122             // SEC_INDEX, so that existing values are not changed.
00123             enum section 
00124             { 
00125                 SEC_PARAMETERS,       
00126                 SEC_HEADER,           
00127                 SEC_MASSES,           
00128                 SEC_SUMMARY,          
00129                 SEC_MIXTURE,          
00130                 SEC_PEPTIDES,         
00131                 SEC_PROTEINS,         
00132                 SEC_QUERY1,           
00133                 SEC_QUANTITATION,     
00134                 SEC_UNIMOD,           
00135                 SEC_ENZYME,           
00136                 SEC_TAXONOMY,         
00137                 SEC_DECOYSUMMARY,     
00138                 SEC_DECOYMIXTURE,     
00139                 SEC_DECOYPEPTIDES,    
00140                 SEC_DECOYPROTEINS,    
00141                 SEC_ERRTOLSUMMARY,    
00142                 SEC_ERRTOLPEPTIDES,   
00143                 SEC_SPECTRAL_LIBRARY, 
00144                 SEC_LIBRARYPEPTIDES,  
00145                 SEC_LIBRARYSUMMARY,   
00146                 SEC_CROSSLINK_SUMMARY, 
00147                 SEC_CROSSLINK_PEPTIDES, 
00148                 SEC_CROSSLINKING,     
00149                 SEC_UNIMOD_XL,        
00150                 SEC_ERRTOLDECOYSUMMARY,  
00151                 SEC_ERRTOLDECOYPEPTIDES, 
00152                 SEC_INDEX,            
00153                 SEC_NUMSECTIONS       
00154             };
00155 
00157             static const char *getSectionName(const section sec);
00158 
00160 
00167             enum err
00168             {
00169                 ERR_NO_ERROR                        = 0x0000, 
00170                 ERR_NOMEM                           = 0x0001, 
00171                 ERR_NOSUCHFILE                      = 0x0002, 
00172                 ERR_READINGFILE                     = 0x0003, 
00173                 ERR_QUERYOUTOFRANGE                 = 0x0004, 
00174                 ERR_MISSINGENTRY                    = 0x0005, 
00175                 ERR_PEPSUMMPEPGET                   = 0x0006, 
00176                 ERR_PEPTIDESTR                      = 0x0007, 
00177                 ERR_ACCINPEPTIDESTR                 = 0x0008, 
00178                 ERR_PROTSUMM                        = 0x0009, 
00179                 ERR_PROTSUMMPEP                     = 0x000A, 
00180                 ERR_ADDPEPTIDES                     = 0x000B, 
00181                 ERR_MISSINGHIT                      = 0x000C, 
00182                 ERR_MISSINGSECTION                  = 0x000D, 
00183                 ERR_MISSINGSECTIONEND               = 0x000E, 
00184                 ERR_MALFORMED_ERR_TOL               = 0x000F, 
00185                 ERR_NO_ERR_TOL_PARENT               = 0x0010, 
00186                 ERR_NULL_ACC_PEP_SUM                = 0x0011, 
00187                 ERR_NULL_ACC_PROT_SUM               = 0x0012, 
00188                 ERR_DUPE_ACCESSION                  = 0x0013, 
00189                 ERR_UNASSIGNED_PROG                 = 0x0014, 
00190                 ERR_UNASSIGNED_RANGE                = 0x0015, 
00191                 ERR_UNASSIGNED_UNK                  = 0x0016, 
00192                 ERR_NO_UNIGENE_FILE                 = 0x0017, 
00193                 ERR_DUPLICATE_KEY                   = 0x0018, 
00194                 ERR_OLDRESULTSFILE                  = 0x0019, 
00195                 ERR_MALFORMED_TAG                   = 0x001A, 
00196                 ERR_MALFORMED_DRANGE                = 0x001B, 
00197                 ERR_INVALID_NUMQUERIES              = 0x001C, 
00198                 ERR_MALFORMED_TERMS                 = 0x001D, 
00199                 ERR_INVALID_RESFILE                 = 0x001E, 
00200                 ERR_INVALID_PROTDB                  = 0x001F, 
00201                 ERR_UNIGENE_MULTIDB                 = 0x0020, 
00202                 ERR_INVALID_CACHE_DIR               = 0x0021, 
00203                 ERR_FAIL_OPEN_DAT_FILE              = 0x0022, 
00204                 ERR_MISSING_CDB_FILE                = 0x0023, 
00205                 ERR_FAIL_MK_CACHE_DIR               = 0x0024, 
00206                 ERR_FAIL_MK_CDB_FILE                = 0x0025, 
00207                 ERR_FAIL_CLOSE_FILE                 = 0x0026, 
00208                 ERR_FAIL_CDB_INIT                   = 0x0027, 
00209                 ERR_INVALID_CDB_FILE                = 0x0028, 
00210                 ERR_WRITE_CDB_FILE                  = 0x0029, 
00211                 ERR_CDB_TOO_LARGE                   = 0x002A, 
00212                 ERR_NEED_64_BIT                     = 0x002B, 
00213                 ERR_CDB_64_BIT_REMAKE               = 0x002C, 
00214                 ERR_CDB_OLD_VER_RETRY               = 0x002D, 
00215                 ERR_CDB_OLD_VER_NO_RETRY            = 0x002E, 
00216                 ERR_CDB_INCOMPLETE_RETRY            = 0x002F, 
00217                 ERR_CDB_INCOMPLETE_NO_RETRY         = 0x0030, 
00218                 ERR_CDB_BEING_CREATED               = 0x0031, 
00219                 ERR_CDB_FAIL_REMOVE                 = 0x0032, 
00220                 ERR_CDB_FAIL_LOCK                   = 0x0033, 
00221                 ERR_CDB_FAIL_UNLOCK                 = 0x0034, 
00222                 ERR_CDB_SOURCE_CHANGE_RETRY         = 0x0035, 
00223                 ERR_CDB_SOURCE_CHANGE_NO_RETRY      = 0x0036, 
00224                 ERR_MISSING_PERCOLATOR_FILE         = 0x0037, 
00225                 ERR_CANNOT_APPEND_RESFILE           = 0x0038, 
00226                 ERR_CANNOT_APPEND_RESFILE_NO_FNAMES = 0x0039, 
00227                 ERR_RESULTS_NOT_CREATED             = 0x003A, 
00228                 ERR_LASTONE                         = 0x003B
00229             };
00230             // this list has to be included into ms_errors.hpp file too !!!
00231 
00232             
00234 
00238             enum FLAGS 
00239             { 
00240 
00241                 RESFILE_NOFLAG                 = 0x00000000, 
00242                 RESFILE_USE_CACHE              = 0x00000001, 
00243                 RESFILE_CACHE_IGNORE_ACC_DUPES = 0x00000002, 
00244                 RESFILE_USE_PARENT_PARAMS           = 0x00000004, 
00245                 RESFILE_CACHE_IGNORE_DATE_CHANGE    = 0x00000008  
00246             };
00247 
00249 
00254             enum PERCOLATOR_FILE_NAMES
00255             {
00256                 PERCOLATOR_INPUT_FILE       = 0,  
00257                 PERCOLATOR_OUTPUT_TARGET    = 1,  
00258                 PERCOLATOR_OUTPUT_DECOY     = 2   
00259             };
00260 
00262 
00267             enum KA_TASK
00268             {
00269                 KA_CREATEINDEX_CI    = 0,  
00270                 KA_READFILE_RF       = 1,  
00271                 KA_ASSIGNPROTEINS_AP = 2,  
00272                 KA_GROUPPROTEINS_GP  = 3,  
00273                 KA_UNASSIGNEDLIST_UL = 4,  
00274                 KA_QUANTITATION      = 5,  
00275                 KA_CREATECACHE_CC    = 6,  
00276                 KA_THRESHFORFDR_FDR  = 7,  
00277                 KA_LAST              = 8   
00278             };
00279 
00281 
00283             enum XML_SCHEMA
00284             {
00285                 XML_SCHEMA_QUANTITATION = 0, 
00286                 XML_SCHEMA_UNIMOD       = 1, 
00287                 XML_SCHEMA_DIRECTORY    = 2, 
00288                 XML_SCHEMA_CROSSLINKING = 3, 
00289                 XML_SCHEMA_LAST         = 4  
00290             };
00291 
00293             ms_mascotresfile(const char * szFileName,
00294                              const int    keepAliveInterval = 0,
00295                              const char * keepAliveText = "<!-- %d seconds -->\n",
00296                              const unsigned int flags = RESFILE_NOFLAG,
00297                              const char * cacheDirectory = "../data/cache/%Y/%m",
00298                              const char * XMLschemaDirectory = 0,
00299                              ms_progress_info * progressMonitor = 0);
00300 
00301             ~ms_mascotresfile();
00302 
00303             // ------------------- Basic generic functions -------------------
00304             
00306             std::string getMSParserVersion() const;
00307             
00309             bool versionGreaterOrEqual(int major, int minor, int revision) const;
00310 
00312             int appendResfile(const char * filename,
00313                               int flags=RESFILE_USE_PARENT_PARAMS,
00314                               const char * cacheDirectory = 0);  // returns 'id' of added file
00315 
00317             const ms_mascotresfile * getResfile(int id) const;
00318 
00320             int getNumberOfResfiles() const; 
00321 
00323             bool doesSectionExist(const section sec) const;
00324 
00326             bool anyPeptideSummaryMatches(const section sec=SEC_PEPTIDES) const;
00327 
00328             // When calling 'getSectionValue' from outside the dll, be careful
00329             // that enough space is 'reserved' in the string.
00330             // Return value is length of the actual string that it wanted to
00331             // to return, so if this is larger than maxLen, then you are 
00332             // missing some of the string. Best to call getSectionValueStr
00334             int  getSectionValue(const section sec, const char * key, char * str, int maxLen) const;
00335 
00337             int  getSectionValueInt(const section sec, const char * key) const;
00338 
00340             double getSectionValueDouble(const section sec, const char * key) const;
00341 
00343             std::string getSectionValueStr(const section sec, const char * key) const;
00344 
00346             int  getQuerySectionValue(const int query, const char * key, char * str, int maxLen) const;
00347 
00349             int  getQuerySectionValueInt(const int query, const char * key) const;
00350 
00352             double getQuerySectionValueDouble(const int query, const char * key) const;
00353 
00355             std::string getQuerySectionValueStr(const int query, const char * key) const;
00356 
00358             int getJobNumber(const int resfileID = 1) const;
00359 
00361             std::string enumerateSectionKeys(const section sec, 
00362                                              const int num,
00363                                              int        * pPreviousNum    = 0,
00364                                              OFFSET64_T * pPreviousOffset = 0) const;
00365 
00367             std::string enumerateQuerySectionKeys(const int query,
00368                                                   const int num,
00369                                                   int        * pPreviousNum    = 0,
00370                                                   OFFSET64_T * pPreviousOffset = 0) const;
00371 
00372 #ifndef SWIG
00373             // Not used from the outside world...
00374             void setError(int error, ...);
00375             void vsetError(int error, va_list arg);
00376 #endif
00377 
00379             int  getNumberOfErrors() const;
00380 
00382             int  getErrorNumber(const int num = -1) const;
00383 
00385             int  getLastError() const;
00386 
00388             std::string getErrorString(const int num) const;
00389 
00391             std::string getLastErrorString() const;
00392 
00394             void resetKeepAlive(const int keepAliveInterval, const char * keepAliveText, 
00395                                 const bool propagateToAppended = true, const bool resetStartTime = false);
00396 
00397 #ifndef SWIG
00398 
00399             bool getNextSubStr(const std::string & input, 
00400                                std::string::size_type & idx,
00401                                std::string & output,
00402                                const char * separator = ",",
00403                                const bool removeQuotes = false) const;
00404 #endif
00405 
00406             // ----------------- Specific results functions ------------------
00408             int    getNumQueries(const int resfileID = 0) const;
00409 
00411             int    getNumHits(const section sec=SEC_SUMMARY) const;
00412 
00414             int getNumSeqs(const int idx = 0) const;
00415 
00417             int getNumSeqsAfterTax(const int idx = 0) const;
00418 
00420             int getNumEtSeqsSearched(const int idx = 0) const;
00421 
00423             int getNumLibraryEntries(const int idx = 0) const;
00424 
00426             double getNumResidues(const int idx = 0) const;
00427 
00429             bool isDatabaseTypeAvailable() const;
00431             DATABASE_TYPE getDatabaseType(const int idx) const;
00433             int getReferenceDatabaseNumberOfSL(const int idx) const;
00434 
00436             std::vector<int> getSLDatabaseNumbersOfReference(const int idx) const;
00437 
00439 
00444             int    getExecTime()        const { return execTime_;             }
00445 
00447 
00453             int    getDate()            const { return searchDate_;           }
00454 
00456 
00463             std::string getMascotVer()  const { return version_;              }
00464 
00466             std::string getFastaVer(int idx = 1) const;
00467 
00469             std::string getFastaPath(int idx = 1) const;
00470 
00472             std::string getUniqueTaskID() const;
00473 
00475             ms_mascotoptions::DECOY_ALGORITHM getDecoyTypeForDB(const int idx = 1) const;
00476             
00478             double getSLFragmentTolerance(int idx = 1) const;
00479             
00481             std::string getSLFragmentToleranceUnit(int idx = 1) const;
00482 
00484             bool isPMF()            const;
00485 
00487             bool isMSMS()           const;
00488 
00490             bool isSQ()             const;
00491 
00493             bool isErrorTolerant()  const;
00494 
00496             bool anyPMF() const;
00497 
00499             bool anyMSMS() const;
00500 
00502             bool anySQ() const;
00503 
00505             bool anyTag() const;
00506 
00508             double getObservedMass(const int query) const;
00509 
00511             int    getObservedCharge(const int query, const bool decoy=false) const;
00512             
00514             double getObservedMrValue(const int query, const bool decoy=false) const;
00515 
00517             double getObservedIntensity(const int query) const;
00518 
00520             std::string getRepeatSearchString(const int query, const bool fullQuery = false) const;
00521 
00523             std::string getFileName(const int id = 1) const;
00524 
00526 
00530             ms_searchparams & params() const { return *params_;              }
00531 
00533             bool getQuantitation(ms_quant_configfile *qfile) const;
00534 
00536             bool getQuantitationMethod(ms_quant_method *qmethod) const;
00537 
00539             bool getCrosslinkingMethod(ms_crosslinking_method *method) const;
00540 
00542             bool setXMLschemaFilePath(XML_SCHEMA XMLschema, const char * path);
00543 
00545             std::string getXMLschemaFilePath(XML_SCHEMA XMLschema) const;
00546 
00548             bool getUnimod(ms_umod_configfile *ufile, bool useSchemaFromResfile = false) const;
00549 
00551             bool getUnimodXL(ms_umod_configfile *ufile, bool useSchemaFromResfile = false) const;
00552 
00554             const ms_modification* getMonoLinkModification(const int modNum, const int monoLink) const;
00555 
00557             bool getMasses(ms_masses  * masses) const;
00558 
00560             bool getEnzyme(ms_enzymefile *efile, const char * enzymeFileName = 0) const;
00561 
00563             bool getTaxonomy(ms_taxonomyfile *tfile) const;
00564 
00566             bool outputKeepAlive() const;
00567 
00568 #ifndef SWIG
00569 
00570             void getKeepAlive(KA_TASK     & kaTask, 
00571                               int         & kaPercentage, 
00572                               std::string & kaAccession, 
00573                               int         & kaHit, 
00574                               int         & kaQuery,
00575                               std::string & kaText) const;
00576 #else // SWIG Multiple return values
00577             void getKeepAlive(KA_TASK     & OUTPUT,
00578                               int         & OUTPUT,
00579                               std::string & OUTPUT,
00580                               int         & OUTPUT,
00581                               int         & OUTPUT,
00582                               std::string & OUTPUT) const;
00583 #endif 
00584             // \internal Internal use only
00585             bool outputKeepAlive(KA_TASK kaTask, int percentageComplete, const char * accession, int hit, int query) const;
00586 
00588             ms_progress_info * getProgressInfo(bool forPeptideSummary = false) const;
00589 
00591             std::string getCacheDirectory(bool processed = true) const;
00592 
00594             std::string getCacheFileName() const;
00595 
00596 #ifndef SWIG
00597 
00598             static bool willCreateCache(const char * szFileName,
00599                                         const unsigned int flags,
00600                                         const char * cacheDirectory,
00601                                         std::string * cacheFileName);
00602             // Can't / don't want to allow std::string * as OUTPUT in Java and C#
00603             static bool willCreateCache(const char * szFileName,
00604                                         const unsigned int flags,
00605                                         const char * cacheDirectory,
00606                                         std::string & cacheFileName) {
00607                 return (ms_mascotresfile::willCreateCache(szFileName, flags, cacheDirectory, &cacheFileName));
00608             }
00609 
00611             static bool willCreateCache(const char             * szFileName,
00612                                         const ms_mascotoptions & opts,
00613                                         const char             * applicationName,
00614                                               std::string      & resfileCacheFileName,
00615                                               unsigned int     & cacheStatus);
00616 
00618             std::string get_ms_mascotresults_params(const ms_mascotoptions & opts,
00619                 unsigned int * gpFlags,
00620                 double       * gpMinProbability,
00621                 int          * gpMaxHitsToReport,
00622                 double       * gpIgnoreIonsScoreBelow,
00623                 unsigned int * gpMinPepLenInPepSummary,
00624                 bool         * gpUsePeptideSummary,
00625                 unsigned int * gpFlags2) const;
00626 #else // SWIG Multiple return values
00627             static bool willCreateCache(const char * szFileName,
00628                                         const unsigned int flags,
00629                                         const char * cacheDirectory,
00630                                         std::string & OUTPUT);
00631 
00632             static bool willCreateCache(const char             * szFileName,
00633                                         const ms_mascotoptions & opts,
00634                                         const char             * applicationName,
00635                                               std::string      & OUTPUT,
00636                                               unsigned int     & OUTPUT);
00637 
00638             std::string get_ms_mascotresults_params(const ms_mascotoptions & opts,
00639                 unsigned int * OUTPUT,
00640                 double       * OUTPUT,
00641                 int          * OUTPUT,
00642                 double       * OUTPUT,
00643                 unsigned int * OUTPUT,
00644                 bool         * OUTPUT,
00645                 unsigned int * OUTPUT) const;
00646 #endif
00647 
00649             std::string get_ms_mascotresults_params(const ms_mascotoptions          & opts,
00650                                                           ms_mascotresults_params   & params) const;
00651 
00653             static bool staticGetPercolatorFileNames(const char * szDatFileName,
00654                                                      const char * cacheDirectory,
00655                                                      const char * percolatorFeatures,
00656                                                      const char * additionalFeatures,
00657                                                      const bool   useRetentionTimes,
00658                                                      std::vector<std::string> & filenames,
00659                                                      std::vector<bool> & exists);
00660 
00662             static bool staticGetPercolatorFileNames(const char * szDatFileName,
00663                                                     const char * cacheDirectory,
00664                                                     const ms_mascotoptions &  options,
00665                                                     const char * additionalFeatures,
00666                                                     std::vector<std::string> & filenames,
00667                                                      std::vector<bool> & exists);
00668 
00670             void setPercolatorFeatures(const char * percolatorFeatures,
00671                                        const char * additionalFeatures,
00672                                        const bool   useRetentionTimes);
00673 
00675             void setPercolatorFeatures(const ms_mascotoptions & options,
00676                                        const char * additionalFeatures);
00677 
00679             std::vector<std::string> getPercolatorFileNames() const;
00680 
00681 #ifndef SWIG
00682 
00683             bool getSrcQueryAndFileIdForMultiFile(const int q, int & gsqNewQuery, int & gsqFileId) const;
00684 #else // SWIG Multiple return values
00685             bool getSrcQueryAndFileIdForMultiFile(const int q, int & OUTPUT, int & OUTPUT) const;
00686 #endif
00687 
00688             int getMultiFileQueryNumber(const int localQuery, const int fileId) const;
00689 
00691             void appendErrors(ms_errs & errs);
00692             std::string getEncodedPercolatorFeatures() const { return percolatorFeatures_; }
00693 
00694         protected:  
00695 #ifndef SWIG
00696             // Not safe to copy or assign this object.
00697             ms_mascotresfile(const ms_mascotresfile & rhs);
00698             ms_mascotresfile & operator=(const ms_mascotresfile & rhs);
00699 #endif
00700 
00701         private:
00702             std::string  fileName_;
00703             int          numQueries_;              // For multifile, this is the total of all queries for all files.
00704             std::vector<int> multifileNumQueries_; // 0 based vector, with 0 being the primary file
00705             typedef std::vector<ms_mascotresfile *> resfileV_t; // 0 based vector, with 0 being the primary file
00706             resfileV_t   multifileResfiles_;
00707             int          protSummaryHits_;
00708             int          numSequences_;        
00709             int          numSequencesAfterTax_;
00710             double       numResidues_;         
00711             int          numLibraryEntries_;
00712             int          execTime_;            
00713             int          searchDate_;          
00714             std::string  version_;
00715 
00716             std::vector<DATABASE_TYPE> dbType_;
00717             std::vector<int>           slReferenceMap_;
00718 
00719             int  keepAliveInterval_;
00720             std::string  keepAliveTextStr_;
00721             std::string  keepAliveText_[KA_LAST];
00722             time_t       keepAliveStartTime_;
00723             // Following are mutable so outputKeepAlive can be a const function
00724             mutable KA_TASK     keepAliveTask_;
00725             mutable time_t      lastKeepAliveTime_; 
00726             mutable int         keepAlivePercentage_;
00727             mutable std::string keepAliveAccession_;
00728             mutable int         keepAliveHit_;
00729             mutable int         keepAliveQuery_;
00730 
00731             bool         anyMSMS_;
00732             bool         cachedAnyMSMS_;
00733             bool         anyPMF_;
00734             bool         cachedAnyPMF_;
00735             bool         anySQ_;
00736             bool         cachedAnySQ_;
00737             bool         anyTag_;
00738             bool         cachedAnyTag_;
00739             mutable bool isErrorTolerant_;
00740             mutable bool cachedIsErrorTolerant_;
00741 
00742             unsigned int flags_;
00743             msparser_internal::ms_cdb * pIndexFile_;
00744             bool         useIndexFile_;
00745             std::string  cacheDirectory_;
00746             int          hFile_;
00747             mutable char *       readlnBuf_;
00748             mutable unsigned int readlnBufSize_;
00749 
00750             ms_searchparams *params_;
00751 
00752             std::string percolatorFeatures_;       // Encoded string
00753             std::vector<std::string> percolatorFileNames_;
00754 
00755             const char * sectionTitles_[SEC_NUMSECTIONS];
00756 
00757             multiBufMemPtr sectionStart_[SEC_NUMSECTIONS];
00758             multiBufMemPtr sectionEnd_  [SEC_NUMSECTIONS];
00759 
00760             multiBuf_v buffers_;
00761 
00762             std::string endSectionKey_;
00763             std::string lineBasedEndSectionKey_;
00764             std::string genericQuerySectionKey_;
00765             bool   isWinIniFormat_;
00766             std::vector<double> cachedMrValues_;
00767             std::vector<double> cachedExpValues_;
00768             std::vector<short>  cachedCharges_;
00769 
00770             std::vector<std::string> xmlSchemaPath_;
00771             ms_progress_info * progressMonitor_;
00772             mutable ms_progress_info * pepSummaryProgressMonitor_;
00773 
00774             multiBufMemPtr findSectionStart(const char * szSectionName,
00775                                            const multiBufMemPtr * startLookingAt = 0) const;
00776             multiBufMemPtr findSectionEnd(const multiBufMemPtr sectionStart) const;
00777 
00778             // Array of maps for each section
00779             typedef std::set<const char *,ms_sortByKeyCriterion> sortedKeys;
00780             sortedKeys sorted_[SEC_NUMSECTIONS];
00781             bool fillUpSortedList(const int section,
00782                                   const multiBufMemPtr sectionStart,
00783                                   const multiBufMemPtr sectionEnd,
00784                                   sortedKeys & sorted_keys) const;
00785 
00786             // There are an 'unknown' number of query sections
00787             bool hasQuerySectionBeenIndexed;
00788             std::vector<multiBufMemPtr> querySectionStart_;
00789             std::vector<multiBufMemPtr> querySectionEnd_;
00790             std::vector<sortedKeys> sortedQueries_;
00791 
00792             // Private function to get string
00793             bool inDLLgetSectVal(const section sec,
00794                                  const int queryNumber,
00795                                  const multiBufMemPtr sectionStart,
00796                                  const multiBufMemPtr sectionEnd,
00797                                  sortedKeys & sorted_keys,
00798                                  const char * key,
00799                                  std::string & result) const;
00800 
00801             // Private function to get string
00802             bool inDLLgetSectionAsString(const section sec,
00803                                          std::string & result) const;
00804 
00805             bool readFile(const char * szFileName);
00806             bool readLine(char * & buf, unsigned int & bufSize) const;
00807             void getSectionTitles();
00808             void debugCheckReadFileOK();
00809             bool getCrosslinking(ms_crosslinking_configfile *crosslinkingFile) const;
00810             bool createCDBFile();
00811             void prepareKeepAlive(const char * keepAliveText, const bool resetStartTime);
00812             std::string getKeepAliveString(const double elapsedTime) const;
00813             static std::string getSortedPercolatorFeatures(const ms_mascotoptions & options,
00814                                                            const char * additionalFeatures);
00815             static std::string getSortedPercolatorFeatures(const char * percolatorFeatures,
00816                                                            const char * additionalFeatures,
00817                                                            const bool   useRetentionTimes);
00818 
00819             void setError(int error, ...) const;
00820             bool setErrorInfoFromString(const std::string & e);
00821             std::string getErrorInfoAsString(const int num) const;
00822 
00823             int extractObservedCharge(char *szKey, std::string str) const;
00824             std::string enumerateQuerySection(const int     query,
00825                                               const int     num,
00826                                               int         * pPreviousNum,
00827                                               OFFSET64_T  * pPreviousOffset,
00828                                               OFFSET64_T  * pSectionEnd,
00829                                               std::string & value) const;
00830             
00831             void getSLFragmentToleranceAndUnit_Value(int idx, double & tolerance, std::string & toleranceUnit) const;
00832 
00833             std::map<section, bool> mapSectionAnyMatch_;
00834 
00835             void cacheMonoLinkModifications() const;
00836             mutable std::map< std::pair<int, int>, ms_modification > monoLinkCache_;
00837             mutable bool monoLinksCached_;
00838 
00839     }; // end of resfile_group
00841 }   // matrix_science namespace
00842 #endif // MS_MASCOTRESFILE_HPP
00843 
00844 /*------------------------------- End of File -------------------------------*/

Copyright © 2022 Matrix Science Ltd.  All Rights Reserved. Generated on Thu Mar 31 2022 01:12:29