Search in sources :

Example 1 with BamMetrics

use of com.hartwig.pipeline.metrics.BamMetrics in project pipeline5 by hartwigmedical.

the class SingleSamplePipeline method run.

public PipelineState run(final SingleSampleRunMetadata metadata) throws Exception {
    LOGGER.info("Pipeline5 single sample pipeline starting for sample name [{}] with id [{}] {}", metadata.sampleName(), metadata.barcode(), arguments.runId().map(runId -> String.format("using run tag [%s]", runId)).orElse(""));
    PipelineState state = new PipelineState();
    final ResourceFiles resourceFiles = buildResourceFiles(arguments);
    AlignmentOutput alignmentOutput = convertCramsIfNecessary(arguments, metadata, state);
    eventListener.alignmentComplete(alignmentOutput);
    if (state.shouldProceed()) {
        Future<BamMetricsOutput> bamMetricsFuture = executorService.submit(() -> stageRunner.run(metadata, new BamMetrics(resourceFiles, alignmentOutput, persistedDataset, arguments)));
        Future<SnpGenotypeOutput> unifiedGenotyperFuture = executorService.submit(() -> stageRunner.run(metadata, new SnpGenotype(resourceFiles, alignmentOutput)));
        Future<FlagstatOutput> flagstatOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new Flagstat(alignmentOutput, persistedDataset)));
        Future<CramOutput> cramOutputFuture = executorService.submit(() -> stageRunner.run(metadata, new CramConversion(alignmentOutput, metadata.type(), resourceFiles)));
        if (metadata.type().equals(SingleSampleRunMetadata.SampleType.REFERENCE)) {
            Future<GermlineCallerOutput> germlineCallerFuture = executorService.submit(() -> stageRunner.run(metadata, new GermlineCaller(alignmentOutput, resourceFiles, persistedDataset)));
            GermlineCallerOutput germlineCallerOutput = futurePayload(germlineCallerFuture);
            germlineCallerOutputQueue.put(germlineCallerOutput);
            report.add(state.add(germlineCallerOutput));
        }
        BamMetricsOutput bamMetricsOutput = futurePayload(bamMetricsFuture);
        metricsOutputQueue.put(bamMetricsOutput);
        FlagstatOutput flagstatOutput = futurePayload(flagstatOutputFuture);
        flagstatOutputQueue.put(flagstatOutput);
        report.add(state.add(bamMetricsOutput));
        report.add(state.add(futurePayload(unifiedGenotyperFuture)));
        report.add(state.add(flagstatOutput));
        report.add(state.add(futurePayload(cramOutputFuture)));
        report.compose(metadata, "SingleSample");
        eventListener.complete(state);
    }
    return state;
}
Also used : GermlineCallerOutput(com.hartwig.pipeline.calling.germline.GermlineCallerOutput) GermlineCaller(com.hartwig.pipeline.calling.germline.GermlineCaller) SnpGenotypeOutput(com.hartwig.pipeline.snpgenotype.SnpGenotypeOutput) ResourceFilesFactory.buildResourceFiles(com.hartwig.pipeline.resource.ResourceFilesFactory.buildResourceFiles) ResourceFiles(com.hartwig.pipeline.resource.ResourceFiles) AlignmentOutput(com.hartwig.pipeline.alignment.AlignmentOutput) Flagstat(com.hartwig.pipeline.flagstat.Flagstat) BamMetrics(com.hartwig.pipeline.metrics.BamMetrics) SnpGenotype(com.hartwig.pipeline.snpgenotype.SnpGenotype) FlagstatOutput(com.hartwig.pipeline.flagstat.FlagstatOutput) BamMetricsOutput(com.hartwig.pipeline.metrics.BamMetricsOutput) CramOutput(com.hartwig.pipeline.cram.CramOutput) CramConversion(com.hartwig.pipeline.cram.CramConversion)

Aggregations

AlignmentOutput (com.hartwig.pipeline.alignment.AlignmentOutput)1 GermlineCaller (com.hartwig.pipeline.calling.germline.GermlineCaller)1 GermlineCallerOutput (com.hartwig.pipeline.calling.germline.GermlineCallerOutput)1 CramConversion (com.hartwig.pipeline.cram.CramConversion)1 CramOutput (com.hartwig.pipeline.cram.CramOutput)1 Flagstat (com.hartwig.pipeline.flagstat.Flagstat)1 FlagstatOutput (com.hartwig.pipeline.flagstat.FlagstatOutput)1 BamMetrics (com.hartwig.pipeline.metrics.BamMetrics)1 BamMetricsOutput (com.hartwig.pipeline.metrics.BamMetricsOutput)1 ResourceFiles (com.hartwig.pipeline.resource.ResourceFiles)1 ResourceFilesFactory.buildResourceFiles (com.hartwig.pipeline.resource.ResourceFilesFactory.buildResourceFiles)1 SnpGenotype (com.hartwig.pipeline.snpgenotype.SnpGenotype)1 SnpGenotypeOutput (com.hartwig.pipeline.snpgenotype.SnpGenotypeOutput)1