diff --git a/CometSearch/CometFragmentIndex.cpp b/CometSearch/CometFragmentIndex.cpp index 459febb9..9793c810 100644 --- a/CometSearch/CometFragmentIndex.cpp +++ b/CometSearch/CometFragmentIndex.cpp @@ -229,7 +229,7 @@ void CometFragmentIndex::GenerateFragmentIndex(ThreadPool *tp) // sort list of peptides at each fragment bin by peptide mass for (int iWhichThread = 0; iWhichThread < iNumIndexingThreads; ++iWhichThread) - pFragmentIndexPool->doJob(std::bind(SortFragmentThreadProc, iWhichThread, iNumIndexingThreads, pFragmentIndexPool)); + pFragmentIndexPool->doJob(std::bind(SortFragmentThreadProc, iWhichThread, pFragmentIndexPool)); pFragmentIndexPool->wait_on_threads(); @@ -372,7 +372,6 @@ void CometFragmentIndex::AddFragmentsThreadProc(int iWhichThread, void CometFragmentIndex::SortFragmentThreadProc(int iWhichThread, - int iNumIndexingThreads, ThreadPool *tp) { for (int iPrecursorBin = 0; iPrecursorBin < FRAGINDEX_PRECURSORBINS; ++iPrecursorBin) @@ -1019,26 +1018,26 @@ bool CometFragmentIndex::ReadPlainPeptideIndex(void) comet_fileoffset_t clPermutationsFilePos; // file position of permutations variables comet_fseek(fp, -clSizeCometFileOffset*3, SEEK_END); - fread(&clPeptidesFilePos, clSizeCometFileOffset, 1, fp); - fread(&clProteinsFilePos, clSizeCometFileOffset, 1, fp); - fread(&clPermutationsFilePos, clSizeCometFileOffset, 1, fp); + tTmp = fread(&clPeptidesFilePos, clSizeCometFileOffset, 1, fp); + tTmp = fread(&clProteinsFilePos, clSizeCometFileOffset, 1, fp); + tTmp = fread(&clPermutationsFilePos, clSizeCometFileOffset, 1, fp); comet_fseek(fp, clPeptidesFilePos, SEEK_SET); size_t tNumPeptides; - fread(&tNumPeptides, sizeof(size_t), 1, fp); // read # of peptides + tTmp = fread(&tNumPeptides, sizeof(size_t), 1, fp); // read # of peptides struct PlainPeptideIndex sTmp; int iLen; char szPeptide[MAX_PEPTIDE_LEN]; for (size_t it = 0; it < tNumPeptides; ++it) { - fread(&iLen, sizeof(int), 1, fp); - fread(szPeptide, sizeof(char), iLen, fp); + tTmp = fread(&iLen, sizeof(int), 1, fp); + tTmp = fread(szPeptide, sizeof(char), iLen, fp); szPeptide[iLen] = '\0'; sTmp.sPeptide = szPeptide; - fread(&(sTmp.dPepMass), sizeof(double), 1, fp); - fread(&(sTmp.lIndexProteinFilePosition), clSizeCometFileOffset, 1, fp); + tTmp = fread(&(sTmp.dPepMass), sizeof(double), 1, fp); + tTmp = fread(&(sTmp.lIndexProteinFilePosition), clSizeCometFileOffset, 1, fp); g_vRawPeptides.push_back(sTmp); } @@ -1047,7 +1046,7 @@ bool CometFragmentIndex::ReadPlainPeptideIndex(void) // now read in: vector> g_pvProteinsList size_t tSize; - fread(&tSize, clSizeCometFileOffset, 1, fp); + tTmp = fread(&tSize, clSizeCometFileOffset, 1, fp); vector vTmp; g_pvProteinsList.clear(); @@ -1055,12 +1054,13 @@ bool CometFragmentIndex::ReadPlainPeptideIndex(void) for (size_t it = 0; it < tSize; ++it) { - fread(&tTmp, clSizeCometFileOffset, 1, fp); + size_t tNumProteinOffsets; + tTmp = fread(&tNumProteinOffsets, clSizeCometFileOffset, 1, fp); vTmp.clear(); - for (size_t it2 = 0; it2 < tTmp; ++it2) + for (size_t it2 = 0; it2 < tNumProteinOffsets; ++it2) { - fread(&clTmp, clSizeCometFileOffset, 1, fp); + tTmp = fread(&clTmp, clSizeCometFileOffset, 1, fp); vTmp.push_back(clTmp); } g_pvProteinsList.push_back(vTmp); @@ -1072,31 +1072,32 @@ bool CometFragmentIndex::ReadPlainPeptideIndex(void) unsigned long ulSizevRawPeptides; // size of g_vRawPeptides unsigned long ulModNumSize; // size of MOD_NUMBERS - fread(&ulSizeModSeqs, sizeof(unsigned long), 1, fp); - fread(&ulSizevRawPeptides, sizeof(unsigned long), 1, fp); - fread(&ulModNumSize, sizeof(unsigned long), 1, fp); + tTmp = fread(&ulSizeModSeqs, sizeof(unsigned long), 1, fp); + tTmp = fread(&ulSizevRawPeptides, sizeof(unsigned long), 1, fp); + tTmp = fread(&ulModNumSize, sizeof(unsigned long), 1, fp); MOD_SEQ_MOD_NUM_START = new int[ulSizeModSeqs]; MOD_SEQ_MOD_NUM_CNT = new int[ulSizeModSeqs]; PEPTIDE_MOD_SEQ_IDXS = new int[ulSizevRawPeptides]; - fread(MOD_SEQ_MOD_NUM_START, sizeof(int), ulSizeModSeqs, fp); - fread(MOD_SEQ_MOD_NUM_CNT, sizeof(int), ulSizeModSeqs, fp); - fread(PEPTIDE_MOD_SEQ_IDXS, sizeof(int), ulSizevRawPeptides, fp); //FIX + tTmp = fread(MOD_SEQ_MOD_NUM_START, sizeof(int), ulSizeModSeqs, fp); + tTmp = fread(MOD_SEQ_MOD_NUM_CNT, sizeof(int), ulSizeModSeqs, fp); + tTmp = fread(PEPTIDE_MOD_SEQ_IDXS, sizeof(int), ulSizevRawPeptides, fp); //FIX + int iTmp; char szTmp[MAX_PEPTIDE_LEN]; for (unsigned long i = 0; i < ulSizeModSeqs; ++i) { - fread(&iTmp, sizeof(int), 1, fp); // read length - fread(szTmp, 1, iTmp, fp); + tTmp = fread(&iTmp, sizeof(int), 1, fp); // read length + tTmp = fread(szTmp, 1, iTmp, fp); szTmp[iTmp]='\0'; MOD_SEQS.push_back(szTmp); } for (unsigned long i = 0; i < ulModNumSize; ++i) { ModificationNumber sTmp; - fread(&iTmp, sizeof(int), 1, fp); // read length - fread(szTmp, 1, iTmp, fp); + tTmp = fread(&iTmp, sizeof(int), 1, fp); // read length + tTmp = fread(szTmp, 1, iTmp, fp); szTmp[iTmp]='\0'; sTmp.modStringLen = iTmp; sTmp.modifications = new char[iTmp]; diff --git a/CometSearch/CometFragmentIndex.h b/CometSearch/CometFragmentIndex.h index 0278a56d..eb94de7f 100644 --- a/CometSearch/CometFragmentIndex.h +++ b/CometSearch/CometFragmentIndex.h @@ -51,7 +51,6 @@ class CometFragmentIndex static bool SortFragmentsByPepMass(unsigned int x, unsigned int y); static void SortFragmentThreadProc(int iWhichThread, - int iNumIndexingThreads, ThreadPool* tp); static bool CompareByPeptide(const DBIndex &lhs, const DBIndex &rhs); diff --git a/CometSearch/CometMassSpecUtils.cpp b/CometSearch/CometMassSpecUtils.cpp index a18ebd30..f9ce6f27 100644 --- a/CometSearch/CometMassSpecUtils.cpp +++ b/CometSearch/CometMassSpecUtils.cpp @@ -133,25 +133,27 @@ void CometMassSpecUtils::GetProteinName(FILE *fpdb, comet_fileoffset_t lFilePosition, char *szProteinName) { + size_t tTmp; + comet_fseek(fpdb, lFilePosition, SEEK_SET); if (g_staticParams.bIndexDb) //index database { long lSize; - fread(&lSize, sizeof(long), 1, fpdb); + tTmp = fread(&lSize, sizeof(long), 1, fpdb); vector vOffsets; for (long x = 0; x < lSize; ++x) // read file offsets { comet_fileoffset_t tmpoffset; - fread(&tmpoffset, sizeof(comet_fileoffset_t), 1, fpdb); + tTmp = fread(&tmpoffset, sizeof(comet_fileoffset_t), 1, fpdb); vOffsets.push_back(tmpoffset); } for (long x = 0; x < lSize; ++x) // read name from fasta { char szTmp[WIDTH_REFERENCE]; comet_fseek(fpdb, vOffsets.at(x), SEEK_SET); - fread(szTmp, sizeof(char)*WIDTH_REFERENCE, 1, fpdb); + tTmp = fread(szTmp, sizeof(char)*WIDTH_REFERENCE, 1, fpdb); sscanf(szTmp, "%511s", szProteinName); // WIDTH_REFERENCE-1 break; //break here to only get first protein reference (out of lSize) } diff --git a/CometSearch/CometPostAnalysis.cpp b/CometSearch/CometPostAnalysis.cpp index 3e874168..4640e951 100644 --- a/CometSearch/CometPostAnalysis.cpp +++ b/CometSearch/CometPostAnalysis.cpp @@ -328,7 +328,7 @@ void CometPostAnalysis::CalculateSP(Results *pOutput, int _iSizepiVarModSites = sizeof(int)*MAX_PEPTIDE_LEN_P2; - for (i=0; iaccessMutex); diff --git a/CometSearch/CometSearchManager.cpp b/CometSearch/CometSearchManager.cpp index 8419003a..5d1702ed 100644 --- a/CometSearch/CometSearchManager.cpp +++ b/CometSearch/CometSearchManager.cpp @@ -3487,13 +3487,14 @@ bool CometSearchManager::DoSingleSpectrumSearchMultiResults(const int topN, if (!bSucceeded) goto cleanup_results; - g_massRange.dMinMass = g_pvQuery.at(0)->_pepMassInfo.dPeptideMassToleranceMinus; + g_massRange.dMinMass = g_pvQuery.at(0)->_pepMassInfo.dPeptideMassToleranceMinus; g_massRange.dMaxMass = g_pvQuery.at(g_pvQuery.size() - 1)->_pepMassInfo.dPeptideMassTolerancePlus; if (g_massRange.dMaxMass - g_massRange.dMinMass > g_massRange.dMinMass) g_massRange.bNarrowMassRange = true; // unused in this context but setting here anyways else g_massRange.bNarrowMassRange = false; + g_sCometVersion = comet_version; // Now that spectra are loaded to memory and sorted, do search. diff --git a/CometSearch/CometWritePepXML.cpp b/CometSearch/CometWritePepXML.cpp index e76ce1e6..814ee105 100644 --- a/CometSearch/CometWritePepXML.cpp +++ b/CometSearch/CometWritePepXML.cpp @@ -89,8 +89,7 @@ bool CometWritePepXML::WritePepXMLHeader(FILE *fpout, strcpy(szResolvedInputBaseName, g_staticParams.inputFile.szFileName); // now remove extension from szRunSummaryResolvedPath to leave just the base name - int iLen = (int)strlen(szResolvedInputBaseName); - if ( (pStr = strrchr(szResolvedInputBaseName, '.'))) + if ((pStr = strrchr(szResolvedInputBaseName, '.'))) *pStr = '\0'; if (g_staticParams.options.bResolveFullPaths)