use of com.hartwig.pipeline.flagstat.Flagstat 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;
}
Aggregations