19#ifndef MS_MASCOTRESFILE_MSR_HPP 
   20#define MS_MASCOTRESFILE_MSR_HPP 
   30#include <unordered_map> 
   35namespace msparser_internal {
 
   36    class ms_peptidesumsql;
 
   37    class ms_inputquery_msr;
 
   38    class ms_sqlpp11_connection;
 
   41    namespace msr_cached_data
 
   46            static constexpr int CACHE_SIZE = 10;
 
   48            struct SummaryQueryInfoData
 
   59            using SummaryQueryInfoCache = std::map<int, std::array<std::pair<int, std::array<SummaryQueryInfoData, matrix_science::ms_peptide::N_PSM_TYPES>>, CACHE_SIZE>>;
 
   60            thread_local static SummaryQueryInfoCache summaryQueryInfoCache_;
 
   64            struct SummaryQueryInfoHotData
 
   72            using SummaryQueryInfoL2Cache = std::map< int, std::unordered_map<int, std::array<SummaryQueryInfoHotData, matrix_science::ms_peptide::N_PSM_TYPES>> >;
 
   73            thread_local static SummaryQueryInfoL2Cache summaryQueryInfoL2Cache_;
 
   75            using QueryDataCache = std::map< int, std::array<QueryData, CACHE_SIZE> >;
 
   76            thread_local static QueryDataCache queryCache_;
 
   82namespace matrix_science {
 
   83    class ms_umod_configfile;
 
   86    class ms_taxonomyfile;
 
   87    class ms_mascotresults_params;
 
  106        friend class msparser_internal::ms_peptidesumsql;
 
  107        friend class msparser_internal::ms_inputquery_msr;
 
  113                                 const int    keepAliveInterval = 0,
 
  114                                 const char * keepAliveText = 
"<!-- %d seconds -->\n",
 
  115                                 const unsigned int flags = RESFILE_NOFLAG,
 
  116                                 const char * cacheDirectory = 
"../data/cache/%Y/%m",
 
  117                                 const char * XMLschemaDirectory = 0,
 
  126            int appendResfile(
const char * filename,
 
  127                              int flags=RESFILE_USE_PARENT_PARAMS,
 
  128                              const char * cacheDirectory = 0) 
override;  
 
  134            int getNumberOfResfiles() 
const override; 
 
  137            int getJobNumber(
const int resfileID = 1) 
const override;
 
  141            int    getNumQueries(
const int resfileID = 0) 
const override;
 
  144            int getNumSeqs(
const int idx = 0) 
const override;
 
  147            int getNumSeqsAfterTax(
const int idx = 0) 
const override;
 
  150            int getNumEtSeqsSearched(
const int idx = 0) 
const override;
 
  153            int getNumLibraryEntries(
const int idx = 0) 
const override;
 
  156            double getNumResidues(
const int idx = 0) 
const override;
 
  159            bool isDatabaseTypeAvailable() 
const override;
 
  163            int getReferenceDatabaseNumberOfSL(
const int idx) 
const override;
 
  166            std::vector<int> getSLDatabaseNumbersOfReference(
const int idx) 
const override;
 
  169            int getExecTime() 
const override;
 
  172            int getDate() 
const override;
 
  175            std::string getMascotVer()  
const override;
 
  178            std::string getFastaVer(
int idx = 1) 
const override;
 
  181            std::string getFastaPath(
int idx = 1) 
const override;
 
  184            std::string getUniqueTaskID() 
const override;
 
  190            double getSLFragmentTolerance(
int idx = 1) 
const override;
 
  193            std::string getSLFragmentToleranceUnit(
int idx = 1) 
const override;
 
  196            virtual std::string getSLExecCommand(
int idx = 1) 
const override;
 
  199            bool isPMF() 
const override;
 
  202            bool isMSMS() 
const override;
 
  205            bool isSQ() 
const override;
 
  208            bool isErrorTolerant() 
const override;
 
  211            bool anyPMF() 
const override;
 
  214            bool anyMSMS() 
const override;
 
  217            bool anySQ() 
const override;
 
  220            bool anyTag() 
const override;
 
  223            bool anyFastaMatches(
const bool isDecoy=
false) 
const override;
 
  226            bool anySpectralLibraryMatches(
const bool isDecoy=
false) 
const override;
 
  229            bool anyErrorTolerantMatches(
const bool isDecoy=
false) 
const override;
 
  232            bool anyCrosslinkedMatches(
const bool isDecoy=
false) 
const override;
 
  235            double getObservedMass(
const int query) 
const override;
 
  238            int getObservedCharge(
const int query, 
const bool decoy=
false) 
const override;
 
  241            double getObservedMrValue(
const int query, 
const bool decoy=
false) 
const override;
 
  244            double getObservedIntensity(
const int query) 
const override;
 
  247            std::string getRepeatSearchString(
const int query, 
const bool fullQuery = 
false) 
const override;
 
  250            std::string getFileName(
const int id = 1) 
const override;
 
  256            bool getUnimod(
ms_umod_configfile *ufile, 
bool useSchemaFromResfile = 
false) 
const override;
 
  259            bool getUnimodXL(
ms_umod_configfile *ufile, 
bool useSchemaFromResfile = 
false) 
const override;
 
  262            bool getEnzyme(
ms_enzymefile *efile, 
const char * enzymeFileName = 0) 
const override;
 
  268            std::string getCacheDirectory(
bool processed = 
true) 
const override;
 
  271            std::string getCacheFileName() 
const override;
 
  276            bool getSrcQueryAndFileIdForMultiFile(
const int q, 
int & gsqNewQuery, 
int & gsqFileId) 
const override;
 
  278            bool getSrcQueryAndFileIdForMultiFile(
const int q, 
int & OUTPUT, 
int & OUTPUT) 
const override;
 
  281            int getMultiFileQueryNumber(
const int localQuery, 
const int fileId) 
const override;
 
  284            bool hasEnzyme() 
const override;
 
  287            bool hasRT() 
const override;
 
  290            bool hasQuantitation() 
const override;
 
  293            ms_inputquery getInputQuery(
const int queryNum) 
const override;
 
  297            void getHeaderKeyValues(std::vector<std::string> & keys, std::vector<std::string> & values) 
const override;
 
  300            void getSearchParametersKeyValues(std::vector<std::string> & keys, std::vector<std::string> & values) 
const override;
 
  303            void getMassesKeyValues(std::vector<std::string> & keys, std::vector<double> & values) 
const override;
 
  305            void getHeaderKeyValues(std::vector<std::string> & OUTPUT, std::vector<std::string> & OUTPUT) 
const override;
 
  307            void getSearchParametersKeyValues(std::vector<std::string> & OUTPUT, std::vector<std::string> & OUTPUT) 
const override;
 
  309            void getMassesKeyValues(std::vector<std::string> & OUTPUT, std::vector<double> & OUTPUT) 
const override;
 
  313            virtual std::string getHeaderValue(
const std::string& key) 
const override;
 
  316            virtual std::string getSearchParameter(
const std::string& key) 
const override;
 
  319            virtual double getMassValue(
const std::string& key) 
const override;
 
  322            int getLibraryMods(std::vector<std::string> & modNames, std::vector<double> & modDeltas) 
const override;
 
  331            double getFirstPassThreshold() 
const override;
 
  334            msparser_internal::ms_sqlpp11_connection & sqlite3_connection()
 const { 
return db_; }
 
  335            std::shared_ptr<msparser_internal::ms_sqlpp11_connection> sqlite3_connection_ptr()
 const { 
return msDbPtr_; }
 
  336            msparser_internal::ms_sqlpp11_connection & getSrcQueryAndSqlHandleForMultiFile(
const int q, 
int & gsqNewQuery) 
const;
 
  350            void validateResfileVersion() 
override;
 
  352            void propagateKeepAlive(
const int    keepAliveInterval, 
 
  353                                    const char * keepAliveText,
 
  354                                    const bool   propagateToAppended,
 
  355                                    const bool   resetStartTime) 
override;
 
  357            std::string getPepSumCacheFilename(
 
  358                                               const unsigned int flags,
 
  359                                               double             minProbability,
 
  361                                               const char *       unigeneIndexFile,
 
  362                                               double             ignoreIonsScoreBelow,
 
  363                                               int                minPepLenInPepSummary,
 
  364                                               const char *       singleHit,
 
  365                                               const unsigned int flags2) 
const override;
 
  371            bool willCreatePepSumCache(
const unsigned int flags,
 
  372                                       double             minProbability,
 
  374                                       const char *       unigeneIndexFile,
 
  375                                       double             ignoreIonsScoreBelow,
 
  376                                       int                minPepLenInPepSummary,
 
  377                                       const char *       singleHit,
 
  378                                       const unsigned int flags2) 
const override;
 
  384                       std::string             & peptideSummaryCacheFileName,
 
  385                       unsigned int            & cacheStatus) 
const override;
 
  389                                         std::shared_ptr<msparser_internal::ms_mascotresultsbase> & results,
 
  390                                         std::shared_ptr<msparser_internal::ms_peptidesummarybase> & iPepSum) 
const override;
 
  394                                         std::shared_ptr<msparser_internal::ms_mascotresultsbase> & results,
 
  395                                         std::shared_ptr<msparser_internal::ms_proteinsummarybase> & iProtSum) 
const override;
 
  397            std::shared_ptr<msparser_internal::ms_inputquerybase> buildInputQueryImpl(
const int q) 
const override;
 
  399            std::shared_ptr<msparser_internal::ms_searchparamsbase> buildSearchParamsImpl() 
const override;
 
  404            std::vector<int> cumNumQueries_;
 
  406            std::list<ms_mascotresfile_msr> appendedFiles_;
 
  408            std::vector<ms_mascotresfile_msr*> allFilesPtr_;
 
  410            std::shared_ptr<msparser_internal::ms_sqlpp11_connection> msDbPtr_;
 
  411            msparser_internal::ms_sqlpp11_connection & db_;
 
  412            std::unordered_map<std::string, std::string> mapHeader_;
 
  422                      nSequencesAfterTax(-1),
 
  427                std::string fastaFile,
 
  444                std::map<int, DbMetadata> data;
 
  446            mutable DbDataCache dbDataCache_;
 
  448            void _cacheQueryInfoData(
const int q) 
const;
 
  449            void _cacheDbData() 
const;
 
  452            mutable char anyPMFCache_;
 
  453            mutable char anyMSMSCache_;
 
  454            mutable char anySQCache_;
 
  455            mutable char anyTagCache_;
 
  457            mutable std::array<char, ms_peptide::N_PSM_TYPES> hasAnyPepSumMatchesCache_;
 
  460            int _cacheQueryData(
const int q) 
const;
 
  461            int _cacheQuerySeq(
const int q) 
const;
 
  462            int _cacheQueryComp(
const int q) 
const;
 
  463            int _cacheQuerySeqTag(
const int q) 
const;
 
  465            std::string processedCacheDir_;
 
  466            std::string fileBaseName_; 
 
  469            static std::atomic<int> resfileCounter_;
 
  472            msparser_internal::msr_cached_data::ResfileCaches caches_;
 
This class represents the file crosslinking.xml.
Definition: ms_crosslinking_configfile.hpp:49
Reads and parses the enzymes file that contains multiple enzyme definitions.
Definition: ms_enzyme.hpp:194
An instance of this class represents all the parameters specified in the Options section of mascot....
Definition: ms_mascotoptions.hpp:91
DECOY_ALGORITHM
Definitions for how the decoy sequences are generated.
Definition: ms_mascotoptions.hpp:156
Class for parsing and reading files in MSR format.
Definition: ms_mascotresfile_msr.hpp:105
Abstract base class of ms_mascotresfile_dat and ms_mascotresfile_msr.
Definition: ms_mascotresfilebase.hpp:72
Class which provides constructor parameters for either ms_peptidesummary or ms_proteinsummary.
Definition: ms_mascotresults_params.hpp:32
PSM_TYPE
Specifies the search pass and origin of the peptide match.
Definition: ms_peptide.hpp:107
Use this class to get peptide summary results.
Definition: ms_peptidesummary.hpp:51
Contains information of the current progress of a task being performed.
Definition: ms_progress_info.hpp:40
Definition: ms_proteinsummary.hpp:45
Use this class in order to read/write quantitation.xml.
Definition: ms_quant_configfile.hpp:52
Use this class in order to read in a taxonomy file.
Definition: ms_taxonomyfile.hpp:145
This class represents the file unimod.xml.
Definition: ms_umod_configfile.hpp:54
DATABASE_TYPE
Definition: ms_databaseoptions.hpp:39