Skip to content

Commit

Permalink
revert to wait_on_threads to limit fasta parsing as sleep in the whil…
Browse files Browse the repository at this point in the history
…e loop was causing a stall (issue 62); add logic to handle strcmp return value 0 when one of the strings are empty (issue 63)
  • Loading branch information
jke000 committed Jul 9, 2024
1 parent ce24c60 commit e5cf236
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions CometSearch/CometSearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -796,12 +796,14 @@ bool CometSearch::RunSearch(int iPercentStart,
// a memory issue for extremely large fasta files
while (pSearchThreadPool->jobs_.size() >= 500)
{
/*
#ifdef _WIN32
Sleep(10);
#else
usleep(10);
#endif
// pSearchThreadPool->wait_on_threads();
*/
pSearchThreadPool->wait_on_threads();
}

// Now search sequence entry; add threading here so that
Expand Down Expand Up @@ -4002,7 +4004,12 @@ void CometSearch::StorePeptide(int iWhichQuery,
}
else if (iCmp == 0) // same sequence, compare mod state
{
if (g_staticParams.variableModParameters.bVarModSearch)
if (strlen(pQuery->_pDecoys[siA].szPeptide) == 0)
{
siLowestDecoyXcorrScoreIndex = siA;
break;
}
else if (g_staticParams.variableModParameters.bVarModSearch)
{
// different peptides with same mod state; replace last mod state
for (int x = 0; x < pQuery->_pDecoys[siA].iLenPeptide + 2; ++x)
Expand All @@ -4024,7 +4031,7 @@ void CometSearch::StorePeptide(int iWhichQuery,
{
// should not have gotten here; duplicate unmodified peptide would get
// flagged in CheckDuplicates
printf("\n Error in StorePeptides. %s stored twice: %d %lf, %d %lf\n",
printf("\n Error in StorePeptides (decoys). %s stored twice: %d %lf, %d %lf\n",
pQuery->_pDecoys[siA].szPeptide,
siA,
pQuery->_pDecoys[siA].fXcorr,
Expand Down Expand Up @@ -4196,7 +4203,12 @@ void CometSearch::StorePeptide(int iWhichQuery,
}
else if (iCmp == 0) // same sequence, compare mod state
{
if (g_staticParams.variableModParameters.bVarModSearch)
if (strlen(pQuery->_pResults[siA].szPeptide) == 0)
{
siLowestXcorrScoreIndex = siA;
break;
}
else if (g_staticParams.variableModParameters.bVarModSearch)
{
// same peptides with different mod state; replace last mod state
for (int x = 0; x < pQuery->_pResults[siA].iLenPeptide + 2; ++x)
Expand Down

0 comments on commit e5cf236

Please sign in to comment.