|
45 | 45 | import org.labkey.api.util.StringUtilsLabKey; |
46 | 46 | import org.labkey.api.writer.PrintWriters; |
47 | 47 | import org.labkey.sequenceanalysis.run.util.BgzipRunner; |
| 48 | +import org.labkey.sequenceanalysis.run.variant.GatherVcfsCloudWrapper; |
48 | 49 |
|
49 | 50 | import java.io.BufferedReader; |
50 | 51 | import java.io.File; |
@@ -466,6 +467,33 @@ public static File combineVcfs(List<File> files, ReferenceGenome genome, File ou |
466 | 467 | } |
467 | 468 |
|
468 | 469 | public static File combineVcfs(List<File> files, ReferenceGenome genome, File outputGzip, Logger log, boolean multiThreaded, @Nullable Integer compressionLevel, boolean showTotals, boolean sortAfterMerge) throws PipelineJobException |
| 470 | + { |
| 471 | + if (sortAfterMerge) |
| 472 | + { |
| 473 | + return combineVcfsUsingZcat(files, genome, outputGzip, log, multiThreaded, compressionLevel, showTotals, sortAfterMerge); |
| 474 | + } |
| 475 | + else |
| 476 | + { |
| 477 | + log.info("Combining VCFs using GatherVcfsCloudWrapper"); |
| 478 | + new GatherVcfsCloudWrapper(log).gatherVcfs(outputGzip, files); |
| 479 | + |
| 480 | + File idx = new File(outputGzip.getPath() + ".tbi"); |
| 481 | + if (!idx.exists()) |
| 482 | + { |
| 483 | + throw new PipelineJobException("Unable to find output: " + idx.getPath()); |
| 484 | + } |
| 485 | + |
| 486 | + if (showTotals) |
| 487 | + { |
| 488 | + log.info("total variants: " + SequenceAnalysisService.get().getVCFLineCount(outputGzip, log, false)); |
| 489 | + log.info("passing variants: " + SequenceAnalysisService.get().getVCFLineCount(outputGzip, log, true)); |
| 490 | + } |
| 491 | + |
| 492 | + return outputGzip; |
| 493 | + } |
| 494 | + } |
| 495 | + |
| 496 | + private static File combineVcfsUsingZcat(List<File> files, ReferenceGenome genome, File outputGzip, Logger log, boolean multiThreaded, @Nullable Integer compressionLevel, boolean showTotals, boolean sortAfterMerge) throws PipelineJobException |
469 | 497 | { |
470 | 498 | log.info("combining VCFs: "); |
471 | 499 |
|
|
0 commit comments