Search in sources :

Example 1 with SageSomaticCaller

use of com.hartwig.pipeline.calling.sage.SageSomaticCaller 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;
}
Also used : Cuppa(com.hartwig.pipeline.tertiary.cuppa.Cuppa) Orange(com.hartwig.pipeline.tertiary.orange.Orange) SigsOutput(com.hartwig.pipeline.tertiary.sigs.SigsOutput) LoggerFactory(org.slf4j.LoggerFactory) Cobalt(com.hartwig.pipeline.tertiary.cobalt.Cobalt) CuppaOutput(com.hartwig.pipeline.tertiary.cuppa.CuppaOutput) SageSomaticCaller(com.hartwig.pipeline.calling.sage.SageSomaticCaller) LinxSomaticOutput(com.hartwig.pipeline.tertiary.linx.LinxSomaticOutput) Peach(com.hartwig.pipeline.tertiary.peach.Peach) Future(java.util.concurrent.Future) PurpleOutput(com.hartwig.pipeline.tertiary.purple.PurpleOutput) AlignmentPair(com.hartwig.pipeline.alignment.AlignmentPair) InputMode(com.hartwig.pipeline.metadata.InputMode) ChordOutput(com.hartwig.pipeline.tertiary.chord.ChordOutput) OrangeOutput(com.hartwig.pipeline.tertiary.orange.OrangeOutput) PipelineStatus(com.hartwig.pipeline.execution.PipelineStatus) Lilac(com.hartwig.pipeline.tertiary.lilac.Lilac) PersistedDataset(com.hartwig.pipeline.reruns.PersistedDataset) Sigs(com.hartwig.pipeline.tertiary.sigs.Sigs) PaveGermline(com.hartwig.pipeline.tertiary.pave.PaveGermline) SageGermlineCaller(com.hartwig.pipeline.calling.sage.SageGermlineCaller) GridssOutput(com.hartwig.pipeline.calling.structural.gridss.GridssOutput) VirusAnalysis(com.hartwig.pipeline.tertiary.virus.VirusAnalysis) StageRunner(com.hartwig.pipeline.stages.StageRunner) VirusOutput(com.hartwig.pipeline.tertiary.virus.VirusOutput) ProtectOutput(com.hartwig.pipeline.tertiary.protect.ProtectOutput) FlagstatOutput(com.hartwig.pipeline.flagstat.FlagstatOutput) BlockingQueue(java.util.concurrent.BlockingQueue) GripssOutput(com.hartwig.pipeline.calling.structural.gripss.GripssOutput) SageOutput(com.hartwig.pipeline.calling.sage.SageOutput) Protect(com.hartwig.pipeline.tertiary.protect.Protect) ResourceFilesFactory.buildResourceFiles(com.hartwig.pipeline.resource.ResourceFilesFactory.buildResourceFiles) LinxSomatic(com.hartwig.pipeline.tertiary.linx.LinxSomatic) GripssGermline(com.hartwig.pipeline.calling.structural.gripss.GripssGermline) CobaltOutput(com.hartwig.pipeline.tertiary.cobalt.CobaltOutput) PaveOutput(com.hartwig.pipeline.tertiary.pave.PaveOutput) BamMetricsOutput(com.hartwig.pipeline.metrics.BamMetricsOutput) Chord(com.hartwig.pipeline.tertiary.chord.Chord) AmberOutput(com.hartwig.pipeline.tertiary.amber.AmberOutput) Amber(com.hartwig.pipeline.tertiary.amber.Amber) LinxGermline(com.hartwig.pipeline.tertiary.linx.LinxGermline) Gridss(com.hartwig.pipeline.calling.structural.gridss.Gridss) ExecutorService(java.util.concurrent.ExecutorService) PeachOutput(com.hartwig.pipeline.tertiary.peach.PeachOutput) Logger(org.slf4j.Logger) PaveSomatic(com.hartwig.pipeline.tertiary.pave.PaveSomatic) GripssSomatic(com.hartwig.pipeline.calling.structural.gripss.GripssSomatic) Purple(com.hartwig.pipeline.tertiary.purple.Purple) HealthCheckOutput(com.hartwig.pipeline.tertiary.healthcheck.HealthCheckOutput) LilacOutput(com.hartwig.pipeline.tertiary.lilac.LilacOutput) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) PipelineResults(com.hartwig.pipeline.report.PipelineResults) LinxGermlineOutput(com.hartwig.pipeline.tertiary.linx.LinxGermlineOutput) HealthChecker(com.hartwig.pipeline.tertiary.healthcheck.HealthChecker) SomaticRunMetadata(com.hartwig.pipeline.metadata.SomaticRunMetadata) ResourceFiles(com.hartwig.pipeline.resource.ResourceFiles) Amber(com.hartwig.pipeline.tertiary.amber.Amber) PurpleOutput(com.hartwig.pipeline.tertiary.purple.PurpleOutput) LilacOutput(com.hartwig.pipeline.tertiary.lilac.LilacOutput) VirusOutput(com.hartwig.pipeline.tertiary.virus.VirusOutput) VirusAnalysis(com.hartwig.pipeline.tertiary.virus.VirusAnalysis) HealthCheckOutput(com.hartwig.pipeline.tertiary.healthcheck.HealthCheckOutput) Cobalt(com.hartwig.pipeline.tertiary.cobalt.Cobalt) Orange(com.hartwig.pipeline.tertiary.orange.Orange) CobaltOutput(com.hartwig.pipeline.tertiary.cobalt.CobaltOutput) PaveSomatic(com.hartwig.pipeline.tertiary.pave.PaveSomatic) HealthChecker(com.hartwig.pipeline.tertiary.healthcheck.HealthChecker) PaveGermline(com.hartwig.pipeline.tertiary.pave.PaveGermline) OrangeOutput(com.hartwig.pipeline.tertiary.orange.OrangeOutput) Lilac(com.hartwig.pipeline.tertiary.lilac.Lilac) LinxGermlineOutput(com.hartwig.pipeline.tertiary.linx.LinxGermlineOutput) LinxSomatic(com.hartwig.pipeline.tertiary.linx.LinxSomatic) PeachOutput(com.hartwig.pipeline.tertiary.peach.PeachOutput) GripssOutput(com.hartwig.pipeline.calling.structural.gripss.GripssOutput) Sigs(com.hartwig.pipeline.tertiary.sigs.Sigs) SageSomaticCaller(com.hartwig.pipeline.calling.sage.SageSomaticCaller) Peach(com.hartwig.pipeline.tertiary.peach.Peach) LinxSomaticOutput(com.hartwig.pipeline.tertiary.linx.LinxSomaticOutput) ProtectOutput(com.hartwig.pipeline.tertiary.protect.ProtectOutput) SageOutput(com.hartwig.pipeline.calling.sage.SageOutput) ChordOutput(com.hartwig.pipeline.tertiary.chord.ChordOutput) PaveOutput(com.hartwig.pipeline.tertiary.pave.PaveOutput) Gridss(com.hartwig.pipeline.calling.structural.gridss.Gridss) FlagstatOutput(com.hartwig.pipeline.flagstat.FlagstatOutput) BamMetricsOutput(com.hartwig.pipeline.metrics.BamMetricsOutput) ExecutionException(java.util.concurrent.ExecutionException) Chord(com.hartwig.pipeline.tertiary.chord.Chord) SigsOutput(com.hartwig.pipeline.tertiary.sigs.SigsOutput) CuppaOutput(com.hartwig.pipeline.tertiary.cuppa.CuppaOutput) Protect(com.hartwig.pipeline.tertiary.protect.Protect) LinxGermline(com.hartwig.pipeline.tertiary.linx.LinxGermline) GridssOutput(com.hartwig.pipeline.calling.structural.gridss.GridssOutput) Cuppa(com.hartwig.pipeline.tertiary.cuppa.Cuppa) GripssSomatic(com.hartwig.pipeline.calling.structural.gripss.GripssSomatic) ResourceFilesFactory.buildResourceFiles(com.hartwig.pipeline.resource.ResourceFilesFactory.buildResourceFiles) ResourceFiles(com.hartwig.pipeline.resource.ResourceFiles) Purple(com.hartwig.pipeline.tertiary.purple.Purple) AmberOutput(com.hartwig.pipeline.tertiary.amber.AmberOutput) SageGermlineCaller(com.hartwig.pipeline.calling.sage.SageGermlineCaller) GripssGermline(com.hartwig.pipeline.calling.structural.gripss.GripssGermline)

Aggregations

AlignmentPair (com.hartwig.pipeline.alignment.AlignmentPair)1 SageGermlineCaller (com.hartwig.pipeline.calling.sage.SageGermlineCaller)1 SageOutput (com.hartwig.pipeline.calling.sage.SageOutput)1 SageSomaticCaller (com.hartwig.pipeline.calling.sage.SageSomaticCaller)1 Gridss (com.hartwig.pipeline.calling.structural.gridss.Gridss)1 GridssOutput (com.hartwig.pipeline.calling.structural.gridss.GridssOutput)1 GripssGermline (com.hartwig.pipeline.calling.structural.gripss.GripssGermline)1 GripssOutput (com.hartwig.pipeline.calling.structural.gripss.GripssOutput)1 GripssSomatic (com.hartwig.pipeline.calling.structural.gripss.GripssSomatic)1 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)1 FlagstatOutput (com.hartwig.pipeline.flagstat.FlagstatOutput)1 InputMode (com.hartwig.pipeline.metadata.InputMode)1 SomaticRunMetadata (com.hartwig.pipeline.metadata.SomaticRunMetadata)1 BamMetricsOutput (com.hartwig.pipeline.metrics.BamMetricsOutput)1 PipelineResults (com.hartwig.pipeline.report.PipelineResults)1 PersistedDataset (com.hartwig.pipeline.reruns.PersistedDataset)1 ResourceFiles (com.hartwig.pipeline.resource.ResourceFiles)1 ResourceFilesFactory.buildResourceFiles (com.hartwig.pipeline.resource.ResourceFilesFactory.buildResourceFiles)1 StageRunner (com.hartwig.pipeline.stages.StageRunner)1 Amber (com.hartwig.pipeline.tertiary.amber.Amber)1