@@ -36,18 +36,19 @@ bool CometWritePercolator::WritePercolator(FILE *fpout,
36
36
FILE *fpdb)
37
37
{
38
38
int i;
39
+ int iLenDecoyPrefix = strlen (g_staticParams.szDecoyPrefix );
39
40
40
41
// Print results.
41
42
for (i=0 ; i<(int )g_pvQuery.size (); i++)
42
43
{
43
44
if (g_pvQuery.at (i)->_pResults [0 ].fXcorr > g_staticParams.options .dMinimumXcorr )
44
45
{
45
- PrintResults (i, fpout, fpdb, 0 ); // print search hit (could be decoy if g_staticParams.options.iDecoySearch=1)
46
+ PrintResults (i, fpout, fpdb, 0 , iLenDecoyPrefix ); // print search hit (could be decoy if g_staticParams.options.iDecoySearch=1)
46
47
}
47
48
48
49
if (g_staticParams.options .iDecoySearch == 2 && g_pvQuery.at (i)->_pDecoys [0 ].fXcorr > g_staticParams.options .dMinimumXcorr )
49
50
{
50
- PrintResults (i, fpout, fpdb, 2 ); // print decoy hit
51
+ PrintResults (i, fpout, fpdb, 2 , iLenDecoyPrefix ); // print decoy hit
51
52
}
52
53
}
53
54
@@ -92,7 +93,8 @@ void CometWritePercolator::WritePercolatorHeader(FILE *fpout)
92
93
bool CometWritePercolator::PrintResults (int iWhichQuery,
93
94
FILE *fpout,
94
95
FILE *fpdb,
95
- int iPrintTargetDecoy)
96
+ int iPrintTargetDecoy,
97
+ int iLenDecoyPrefix)
96
98
{
97
99
int i,
98
100
iNumPrintLines,
@@ -132,11 +134,36 @@ bool CometWritePercolator::PrintResults(int iWhichQuery,
132
134
133
135
CometMassSpecUtils::GetProteinNameString (fpdb, iWhichQuery, iWhichResult, iPrintTargetDecoy, vProteinTargets, vProteinDecoys);
134
136
135
- if (vProteinTargets.size () > 0 )
136
- fprintf (fpout, " 1\t " ); // target label
137
+ if (g_staticParams.options .iDecoySearch > 0 ) // using Comet's internal decoys
138
+ {
139
+ if (vProteinTargets.size () > 0 )
140
+ fprintf (fpout, " 1\t " ); // target label
141
+ else
142
+ fprintf (fpout, " -1\t " ); // decoy label
143
+ }
137
144
else
138
- fprintf (fpout, " -1\t " ); // decoy label
145
+ {
146
+ // Standard database search with possible user supplied decoys in the fasta.
147
+ // So compare the protein string to see if any match g_staticParams.szDecoyPrefix.
148
+ // If so, annotate those with a decoy label.
149
+ bool bTarget = false ;
150
+ std::vector<string>::iterator it;
151
+
152
+ for (it = vProteinTargets.begin (); it != vProteinTargets.end (); it++)
153
+ {
154
+ if (strncmp ((*it).c_str (), g_staticParams.szDecoyPrefix , iLenDecoyPrefix))
155
+ {
156
+ // if any protein string does not match the decoy prefix then it's a target
157
+ bTarget = true ;
158
+ break ;
159
+ }
160
+ }
139
161
162
+ if (bTarget)
163
+ fprintf (fpout, " 1\t " ); // target label
164
+ else
165
+ fprintf (fpout, " -1\t " ); // decoy label
166
+ }
140
167
141
168
fprintf (fpout, " %d\t " , pQuery->_spectrumInfoInternal .iScanNumber );
142
169
fprintf (fpout, " %0.6f\t " , pQuery->_pepMassInfo .dExpPepMass ); // ExpMass
0 commit comments