@@ -369,22 +369,28 @@ class DownsampleVcfTest extends UnitSpec {
369
369
Metric .write(metadata, Seq (Sample (SAMPLE_NAME = sample, BASE_COUNT = 100 )))
370
370
371
371
" DownsampleVcf" should " write a new vcf with downsampled genotypes when provided a vcf" in {
372
- List (true , false ).foreach(
373
- use_metdata => {
372
+ List (" proportion " , " number " , " metadata " ).foreach(
373
+ kind => {
374
374
// Construct the input VCF
375
375
val outVcf = makeTempFile(" out" , " .vcf.gz" )
376
- if (use_metdata) {
377
- new DownsampleVcf (input= inVcf,
378
- output= outVcf,
379
- metadata= Some (metadata),
380
- downsampleToBases= Some (1 ),
381
- windowSize= 150 ).execute()
382
- } else {
383
- new DownsampleVcf (input= inVcf,
384
- output= outVcf,
385
- originalBases= Some (100 ),
386
- downsampleToBases= Some (1 ),
387
- windowSize= 150 ).execute()
376
+ kind match {
377
+ case " proportion" =>
378
+ new DownsampleVcf (input= inVcf,
379
+ output= outVcf,
380
+ proportion= Some (0.01 ),
381
+ windowSize= 150 ).execute()
382
+ case " number" =>
383
+ new DownsampleVcf (input= inVcf,
384
+ output= outVcf,
385
+ originalBases= Some (100 ),
386
+ downsampleToBases= Some (1 ),
387
+ windowSize= 150 ).execute()
388
+ case " metadata" =>
389
+ new DownsampleVcf (input= inVcf,
390
+ output= outVcf,
391
+ metadata= Some (metadata),
392
+ downsampleToBases= Some (1 ),
393
+ windowSize= 150 ).execute()
388
394
}
389
395
390
396
val vs = readVcfRecs(outVcf)
@@ -428,24 +434,31 @@ class DownsampleVcfTest extends UnitSpec {
428
434
429
435
" DownsampleVcf" should " write a new vcf with downsampled genotypes when provided a vcf, keeping nocalls" in {
430
436
// Construct the input VCF
431
- List (true , false ).foreach(
432
- use_metdata => {
437
+ List (" proportion " , " number " , " metadata " ).foreach(
438
+ kind => {
433
439
// Construct the input VCF
434
440
val outVcf = makeTempFile(" out" , " .vcf.gz" )
435
- if (use_metdata) {
436
- new DownsampleVcf (input= inVcf,
437
- output= outVcf,
438
- metadata= Some (metadata),
439
- downsampleToBases= Some (1 ),
440
- writeNoCall= true ,
441
- windowSize= 150 ).execute()
442
- } else {
443
- new DownsampleVcf (input= inVcf,
444
- output= outVcf,
445
- originalBases= Some (100 ),
446
- downsampleToBases= Some (1 ),
447
- writeNoCall= true ,
448
- windowSize= 150 ).execute()
441
+ kind match {
442
+ case " proportion" =>
443
+ new DownsampleVcf (input= inVcf,
444
+ output= outVcf,
445
+ proportion= Some (0.01 ),
446
+ writeNoCall= true ,
447
+ windowSize= 150 ).execute()
448
+ case " number" =>
449
+ new DownsampleVcf (input= inVcf,
450
+ output= outVcf,
451
+ originalBases= Some (100 ),
452
+ downsampleToBases= Some (1 ),
453
+ writeNoCall= true ,
454
+ windowSize= 150 ).execute()
455
+ case " metadata" =>
456
+ new DownsampleVcf (input= inVcf,
457
+ output= outVcf,
458
+ metadata= Some (metadata),
459
+ downsampleToBases= Some (1 ),
460
+ writeNoCall= true ,
461
+ windowSize= 150 ).execute()
449
462
}
450
463
451
464
val vs = readVcfRecs(outVcf)
0 commit comments