@@ -37,7 +37,7 @@ int execute(int argc, char **argv) {
37
37
std::string RefVCF (" Empty" );
38
38
std::string fixPC (" Empty" );
39
39
double fixAlpha (-1 .),epsilon (1e-8 );
40
- bool withinAncestry (false ),outputPileup (false ),verbose (false );
40
+ bool withinAncestry (false ),outputPileup (false ),verbose (false ), disableSanityCheck ( false ) ;
41
41
int nfiles (0 ),seed (12345 ),nPC (2 ),nthread (4 );
42
42
paramList pl;
43
43
BEGIN_LONG_PARAMS (longParameters)
@@ -59,6 +59,8 @@ int execute(int argc, char **argv) {
59
59
" Options to adjust model selection and parameters" )
60
60
LONG_PARAM (" WithinAncestry" , &withinAncestry,
61
61
" [Bool] Enabling withinAncestry assume target sample and contamination source are from the same populations,[default:BetweenAncestry] otherwise" )
62
+ LONG_PARAM (" DisableSanityCheck" , &disableSanityCheck,
63
+ " [Bool] Disable marker quality sanity check(no marker filtering)[default:false]" )
62
64
LONG_INT_PARAM (" NumPC" , &nPC,
63
65
" [Int] Set number of PCs to infer Allele Frequency[optional]" )
64
66
LONG_STRING_PARAM (" FixPC" , &fixPC, " [String] Input fixed PCs to estimate Alpha[format PC1:PC2:PC3...]" )
@@ -210,13 +212,16 @@ int execute(int argc, char **argv) {
210
212
else if (Estimator.viewer .posIndex [item.chr ].find (item.end )==Estimator.viewer .posIndex [item.chr ].end ())
211
213
continue ;
212
214
213
- fout<<item.chr <<" \t " <<item.end <<" \t " <<Estimator.ChooseBed [item.chr ][item.end ].first <<" \t " <<Estimator.viewer .GetBaseInfoAt (item.chr ,item.end ).size ()<<" \t " ;
214
- for (auto base:Estimator.viewer .GetBaseInfoAt (item.chr ,item.end ))
215
- fout<<base;
216
- fout<<" \t " ;
217
- for (auto qual:Estimator.viewer .GetQualInfoAt (item.chr ,item.end ))
218
- fout<<qual;
219
- fout<<std::endl;
215
+ if (Estimator.viewer .GetBaseInfoAt (item.chr ,item.end ).size () > 0 ) {
216
+ fout << item.chr << " \t " << item.end << " \t " << Estimator.ChooseBed [item.chr ][item.end ].first << " \t "
217
+ << Estimator.viewer .GetBaseInfoAt (item.chr , item.end ).size () << " \t " ;
218
+ for (auto base:Estimator.viewer .GetBaseInfoAt (item.chr , item.end ))
219
+ fout << base;
220
+ fout << " \t " ;
221
+ for (auto qual:Estimator.viewer .GetQualInfoAt (item.chr , item.end ))
222
+ fout << qual;
223
+ fout << std::endl;
224
+ }
220
225
}
221
226
fout.close ();
222
227
if (!fout)
@@ -226,11 +231,13 @@ int execute(int argc, char **argv) {
226
231
}
227
232
}
228
233
229
- if (Estimator.IsSanityCheckOK ())
230
- notice (" Passing Marker Sanity Check..." );
231
- else {
232
- warning (" Insufficient Available markers, check input bam depth distribution in output pileup file after specifying --OutputPileup" );
233
- exit (EXIT_FAILURE);
234
+ if (!disableSanityCheck) {
235
+ if (Estimator.IsSanityCheckOK ())
236
+ notice (" Passing Marker Sanity Check..." );
237
+ else {
238
+ warning (" Insufficient Available markers, check input bam depth distribution in output pileup file after specifying --OutputPileup" );
239
+ exit (EXIT_FAILURE);
240
+ }
234
241
}
235
242
236
243
Estimator.OptimizeLLK (outputPrefix);
@@ -245,8 +252,11 @@ int execute(int argc, char **argv) {
245
252
exit (EXIT_FAILURE);
246
253
}
247
254
fout << headers << std::endl;
248
- fout << Estimator.viewer .SEQ_SM << " \t NA\t NA\t " << Estimator.NumMarker << " \t " << floor ((double )Estimator.viewer .numBases /Estimator.NumMarker +0.5 )
249
- << " \t " << Estimator.viewer .avgDepth << " \t "
255
+ fout << Estimator.viewer .SEQ_SM << " \t NA\t NA\t " << Estimator.NumMarker << " \t " ;
256
+ if (Estimator.isPileupInput )
257
+ fout <<" NA" ;
258
+ else fout<<Estimator.viewer .numBases ;
259
+ fout << " \t " << Estimator.viewer .avgDepth << " \t "
250
260
<< ((Estimator.fn .globalAlpha < 0.5 ) ? Estimator.fn .globalAlpha : (1 .f - Estimator.fn .globalAlpha )) << " \t "
251
261
<< -Estimator.fn .llk1 << " \t " << -Estimator.fn .llk0 << " \t " << " NA\t NA\t "
252
262
<< " NA\t NA\t NA\t NA\t NA\t "
@@ -284,6 +294,14 @@ int main(int argc, char** argv) {
284
294
std::cerr << errorMsg << std::endl;
285
295
return returnVal;
286
296
}
297
+ catch (std::exception & e)
298
+ {
299
+ returnVal = -1 ;
300
+ std::string errorMsg = " Exiting due to ERROR:\n\t " ;
301
+ errorMsg += e.what ();
302
+ std::cerr << errorMsg << std::endl;
303
+ return returnVal;
304
+ }
287
305
compStatus = returnVal;
288
306
PhoneHome::completionStatus (compStatus.c_str ()," VerifyBamID2" );
289
307
return (returnVal);
0 commit comments