use of com.hartwig.pipeline.calling.sage.SageGermlineCaller in project pipeline5 by hartwigmedical.
the class SomaticPipeline method run.
public PipelineState run(final AlignmentPair pair) {
PipelineState state = new PipelineState();
LOGGER.info("Pipeline5 somatic pipeline starting for set [{}]", metadata.set());
final ResourceFiles resourceFiles = buildResourceFiles(arguments);
try {
Future<AmberOutput> amberOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Amber(pair, resourceFiles, persistedDataset, arguments)));
Future<CobaltOutput> cobaltOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Cobalt(pair, resourceFiles, persistedDataset, arguments)));
Future<SageOutput> sageSomaticOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new SageSomaticCaller(pair, persistedDataset, resourceFiles, arguments)));
Future<SageOutput> sageGermlineOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new SageGermlineCaller(pair, persistedDataset, resourceFiles)));
Future<GridssOutput> structuralCallerOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Gridss(pair, resourceFiles, persistedDataset)));
SageOutput sageSomaticOutput = pipelineResults.add(state.add(sageSomaticOutputFuture.get()));
SageOutput sageGermlineOutput = pipelineResults.add(state.add(sageGermlineOutputFuture.get()));
AmberOutput amberOutput = pipelineResults.add(state.add(amberOutputFuture.get()));
CobaltOutput cobaltOutput = pipelineResults.add(state.add(cobaltOutputFuture.get()));
GridssOutput structuralCallerOutput = pipelineResults.add(state.add(structuralCallerOutputFuture.get()));
if (state.shouldProceed()) {
Future<PaveOutput> paveSomaticOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new PaveSomatic(resourceFiles, sageSomaticOutput, persistedDataset)));
Future<PaveOutput> paveGermlineOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new PaveGermline(resourceFiles, sageGermlineOutput, persistedDataset)));
PaveOutput paveSomaticOutput = pipelineResults.add(state.add(paveSomaticOutputFuture.get()));
PaveOutput paveGermlineOutput = pipelineResults.add(state.add(paveGermlineOutputFuture.get()));
Future<GripssOutput> gripssSomaticOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new GripssSomatic(structuralCallerOutput, persistedDataset, resourceFiles)));
Future<GripssOutput> gripssGermlineOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new GripssGermline(structuralCallerOutput, persistedDataset, resourceFiles)));
GripssOutput gripssSomaticProcessOutput = pipelineResults.add(state.add(gripssSomaticOutputFuture.get()));
GripssOutput gripssGermlineProcessOutput = pipelineResults.add(state.add(gripssGermlineOutputFuture.get()));
if (state.shouldProceed()) {
Future<PurpleOutput> purpleOutputFuture = executorService.submit(() -> pipelineResults.add(state.add(stageRunner.run(metadata, new Purple(resourceFiles, paveSomaticOutput, paveGermlineOutput, metadata.maybeTumor().map(t -> gripssSomaticProcessOutput).orElse(gripssGermlineProcessOutput), amberOutput, cobaltOutput, persistedDataset, arguments)))));
PurpleOutput purpleOutput = purpleOutputFuture.get();
if (state.shouldProceed()) {
BamMetricsOutput tumorMetrics = metadata.maybeTumor().map(t -> pollOrThrow(tumorBamMetricsOutputQueue, "tumor metrics")).orElse(skippedMetrics(metadata.sampleName()));
BamMetricsOutput referenceMetrics = metadata.maybeReference().map(t -> pollOrThrow(referenceBamMetricsOutputQueue, "reference metrics")).orElse(skippedMetrics(metadata.sampleName()));
FlagstatOutput tumorFlagstat = metadata.maybeTumor().map(t -> pollOrThrow(tumorFlagstatOutputQueue, "tumor flagstat")).orElse(skippedFlagstat(metadata.sampleName()));
FlagstatOutput referenceFlagstat = metadata.maybeReference().map(t -> pollOrThrow(referenceFlagstatOutputQueue, "reference flagstat")).orElse(skippedFlagstat(metadata.sampleName()));
Future<VirusOutput> virusOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new VirusAnalysis(pair, resourceFiles, persistedDataset, purpleOutput, tumorMetrics)));
Future<HealthCheckOutput> healthCheckOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new HealthChecker(referenceMetrics, tumorMetrics, referenceFlagstat, tumorFlagstat, purpleOutput)));
Future<LinxSomaticOutput> linxSomaticOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new LinxSomatic(purpleOutput, resourceFiles, persistedDataset)));
Future<LinxGermlineOutput> linxGermlineOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new LinxGermline(gripssGermlineProcessOutput, resourceFiles, persistedDataset)));
Future<LilacOutput> lilacOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Lilac(pair, resourceFiles, purpleOutput)));
Future<SigsOutput> signatureOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Sigs(purpleOutput, resourceFiles)));
Future<ChordOutput> chordOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Chord(arguments.refGenomeVersion(), purpleOutput, persistedDataset)));
pipelineResults.add(state.add(healthCheckOutputFuture.get()));
LinxSomaticOutput linxSomaticOutput = pipelineResults.add(state.add(linxSomaticOutputFuture.get()));
pipelineResults.add(state.add(linxGermlineOutputFuture.get()));
pipelineResults.add(state.add(lilacOutputFuture.get()));
Future<CuppaOutput> cuppaOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Cuppa(purpleOutput, linxSomaticOutput, resourceFiles, persistedDataset)));
Future<PeachOutput> peachOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Peach(purpleOutput, resourceFiles, persistedDataset)));
VirusOutput virusOutput = pipelineResults.add(state.add(virusOutputFuture.get()));
ChordOutput chordOutput = pipelineResults.add(state.add(chordOutputFuture.get()));
CuppaOutput cuppaOutput = pipelineResults.add(state.add(cuppaOutputFuture.get()));
PeachOutput peachOutput = pipelineResults.add(state.add(peachOutputFuture.get()));
ProtectOutput protectOutput = pipelineResults.add(state.add(executorService.submit(() -> stageRunner.run(metadata, new Protect(purpleOutput, linxSomaticOutput, virusOutput, chordOutput, resourceFiles, persistedDataset))).get()));
Future<OrangeOutput> orangeOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Orange(tumorMetrics, referenceMetrics, tumorFlagstat, referenceFlagstat, sageSomaticOutput, sageGermlineOutput, purpleOutput, chordOutput, linxSomaticOutput, cuppaOutput, virusOutput, protectOutput, peachOutput, resourceFiles)));
pipelineResults.add(state.add(signatureOutputFuture.get()));
pipelineResults.add(state.add(orangeOutputFuture.get()));
pipelineResults.compose(metadata, "Somatic");
}
}
}
} catch (InterruptedException | ExecutionException e) {
throw new RuntimeException(e);
}
return state;
}
Aggregations