Search in sources :

Example 1 with SingleSampleEventListener

use of com.hartwig.pipeline.metadata.SingleSampleEventListener in project pipeline5 by hartwigmedical.

the class FullPipelineTest method setUp.

@Before
public void setUp() throws Exception {
    reference = mock(SingleSamplePipeline.class);
    tumor = mock(SingleSamplePipeline.class);
    somatic = mock(SomaticPipeline.class);
    cleanup = mock(Cleanup.class);
    api = mock(SomaticMetadataApi.class);
    when(api.get()).thenReturn(METADATA);
    referenceListener = new SingleSampleEventListener();
    tumorListener = new SingleSampleEventListener();
    victim = new FullPipeline(reference, tumor, somatic, Executors.newCachedThreadPool(), referenceListener, tumorListener, api, cleanup);
}
Also used : SomaticMetadataApi(com.hartwig.pipeline.metadata.SomaticMetadataApi) SingleSampleEventListener(com.hartwig.pipeline.metadata.SingleSampleEventListener) Cleanup(com.hartwig.pipeline.cleanup.Cleanup) Before(org.junit.Before)

Example 2 with SingleSampleEventListener

use of com.hartwig.pipeline.metadata.SingleSampleEventListener in project pipeline5 by hartwigmedical.

the class PipelineMain method start.

public PipelineState start(final Arguments arguments) {
    LOGGER.info("Arguments are [{}]", arguments);
    Versions.printAll();
    try {
        GoogleCredentials credentials = CredentialProvider.from(arguments).get();
        Storage storage = StorageProvider.from(arguments, credentials).get();
        Publisher turquoisePublisher = PublisherProvider.from(arguments, credentials).get("turquoise.events");
        Publisher pipelinePublisher = PublisherProvider.from(arguments, credentials).get(PipelineComplete.TOPIC);
        SomaticMetadataApi somaticMetadataApi = SomaticMetadataApiProvider.from(arguments, storage, pipelinePublisher).get();
        SingleSampleEventListener referenceEventListener = new SingleSampleEventListener();
        SingleSampleEventListener tumorEventListener = new SingleSampleEventListener();
        SomaticRunMetadata somaticRunMetadata = somaticMetadataApi.get();
        InputMode mode = new ModeResolver().apply(somaticRunMetadata);
        LOGGER.info("Starting pipeline in [{}] mode", mode);
        String ini = somaticRunMetadata.isSingleSample() ? "single_sample" : arguments.shallow() ? "shallow" : "somatic";
        PipelineProperties eventSubjects = PipelineProperties.builder().sample(somaticRunMetadata.maybeTumor().map(SingleSampleRunMetadata::sampleName).orElseGet(() -> somaticRunMetadata.reference().sampleName())).runId(arguments.sbpApiRunId()).set(somaticRunMetadata.set()).referenceBarcode(somaticRunMetadata.maybeReference().map(SingleSampleRunMetadata::barcode)).tumorBarcode(somaticRunMetadata.maybeTumor().map(SingleSampleRunMetadata::barcode)).type(ini).build();
        somaticMetadataApi.start();
        startedEvent(eventSubjects, turquoisePublisher, arguments.publishToTurquoise());
        BlockingQueue<BamMetricsOutput> referenceBamMetricsOutputQueue = new ArrayBlockingQueue<>(1);
        BlockingQueue<BamMetricsOutput> tumorBamMetricsOutputQueue = new ArrayBlockingQueue<>(1);
        BlockingQueue<FlagstatOutput> referenceFlagstatOutputQueue = new ArrayBlockingQueue<>(1);
        BlockingQueue<FlagstatOutput> tumorFlagstatOutputQueue = new ArrayBlockingQueue<>(1);
        BlockingQueue<GermlineCallerOutput> germlineCallerOutputQueue = new ArrayBlockingQueue<>(1);
        StartingPoint startingPoint = new StartingPoint(arguments);
        PersistedDataset persistedDataset = arguments.biopsy().<PersistedDataset>map(b -> new ApiPersistedDataset(SbpRestApi.newInstance(arguments.sbpApiUrl()), ObjectMappers.get(), b, arguments.project())).orElse(new NoopPersistedDataset());
        PipelineState state = new FullPipeline(singleSamplePipeline(arguments, credentials, storage, referenceEventListener, somaticRunMetadata, referenceBamMetricsOutputQueue, germlineCallerOutputQueue, referenceFlagstatOutputQueue, startingPoint, persistedDataset, mode), singleSamplePipeline(arguments, credentials, storage, tumorEventListener, somaticRunMetadata, tumorBamMetricsOutputQueue, germlineCallerOutputQueue, tumorFlagstatOutputQueue, startingPoint, persistedDataset, mode), somaticPipeline(arguments, credentials, storage, somaticRunMetadata, referenceBamMetricsOutputQueue, tumorBamMetricsOutputQueue, referenceFlagstatOutputQueue, tumorFlagstatOutputQueue, startingPoint, persistedDataset, mode), Executors.newCachedThreadPool(), referenceEventListener, tumorEventListener, somaticMetadataApi, CleanupProvider.from(arguments, storage).get()).run();
        completedEvent(eventSubjects, turquoisePublisher, state.status().toString(), arguments.publishToTurquoise());
        VmExecutionLogSummary.ofFailedStages(storage, state);
        return state;
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : InputMode(com.hartwig.pipeline.metadata.InputMode) PublisherProvider(com.hartwig.pipeline.pubsub.PublisherProvider) PipelineProperties(com.hartwig.pipeline.turquoise.PipelineProperties) StorageProvider(com.hartwig.pipeline.storage.StorageProvider) SbpRestApi(com.hartwig.pipeline.sbpapi.SbpRestApi) LoggerFactory(org.slf4j.LoggerFactory) SomaticMetadataApiProvider(com.hartwig.pipeline.metadata.SomaticMetadataApiProvider) PipelineResultsProvider(com.hartwig.pipeline.report.PipelineResultsProvider) Versions(com.hartwig.pipeline.tools.Versions) PipelineCompleted(com.hartwig.pipeline.turquoise.PipelineCompleted) ApiPersistedDataset(com.hartwig.pipeline.reruns.ApiPersistedDataset) Publisher(com.google.cloud.pubsub.v1.Publisher) InputMode(com.hartwig.pipeline.metadata.InputMode) PipelineStatus(com.hartwig.pipeline.execution.PipelineStatus) CleanupProvider(com.hartwig.pipeline.cleanup.CleanupProvider) ModeResolver(com.hartwig.pipeline.metadata.ModeResolver) PersistedDataset(com.hartwig.pipeline.reruns.PersistedDataset) TurquoiseEvent(com.hartwig.pipeline.turquoise.TurquoiseEvent) SomaticMetadataApi(com.hartwig.pipeline.metadata.SomaticMetadataApi) Logger(org.slf4j.Logger) GoogleCredentials(com.google.auth.oauth2.GoogleCredentials) StageRunner(com.hartwig.pipeline.stages.StageRunner) StartingPoint(com.hartwig.pipeline.reruns.StartingPoint) FlagstatOutput(com.hartwig.pipeline.flagstat.FlagstatOutput) PipelineComplete(com.hartwig.events.PipelineComplete) GoogleComputeEngine(com.hartwig.pipeline.execution.vm.GoogleComputeEngine) BlockingQueue(java.util.concurrent.BlockingQueue) NoopPersistedDataset(com.hartwig.pipeline.reruns.NoopPersistedDataset) AlignerProvider(com.hartwig.pipeline.alignment.AlignerProvider) SingleSampleEventListener(com.hartwig.pipeline.metadata.SingleSampleEventListener) Executors(java.util.concurrent.Executors) PipelineStarted(com.hartwig.pipeline.turquoise.PipelineStarted) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) GermlineCallerOutput(com.hartwig.pipeline.calling.germline.GermlineCallerOutput) BamMetricsOutput(com.hartwig.pipeline.metrics.BamMetricsOutput) SomaticRunMetadata(com.hartwig.pipeline.metadata.SomaticRunMetadata) VmExecutionLogSummary(com.hartwig.pipeline.report.VmExecutionLogSummary) ObjectMappers(com.hartwig.pipeline.jackson.ObjectMappers) ParseException(org.apache.commons.cli.ParseException) SingleSampleRunMetadata(com.hartwig.pipeline.metadata.SingleSampleRunMetadata) Storage(com.google.cloud.storage.Storage) CredentialProvider(com.hartwig.pipeline.credentials.CredentialProvider) Labels(com.hartwig.pipeline.labels.Labels) ApiPersistedDataset(com.hartwig.pipeline.reruns.ApiPersistedDataset) GermlineCallerOutput(com.hartwig.pipeline.calling.germline.GermlineCallerOutput) SingleSampleEventListener(com.hartwig.pipeline.metadata.SingleSampleEventListener) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) SingleSampleRunMetadata(com.hartwig.pipeline.metadata.SingleSampleRunMetadata) GoogleCredentials(com.google.auth.oauth2.GoogleCredentials) FlagstatOutput(com.hartwig.pipeline.flagstat.FlagstatOutput) BamMetricsOutput(com.hartwig.pipeline.metrics.BamMetricsOutput) SomaticRunMetadata(com.hartwig.pipeline.metadata.SomaticRunMetadata) ModeResolver(com.hartwig.pipeline.metadata.ModeResolver) Publisher(com.google.cloud.pubsub.v1.Publisher) ParseException(org.apache.commons.cli.ParseException) StartingPoint(com.hartwig.pipeline.reruns.StartingPoint) Storage(com.google.cloud.storage.Storage) SomaticMetadataApi(com.hartwig.pipeline.metadata.SomaticMetadataApi) PipelineProperties(com.hartwig.pipeline.turquoise.PipelineProperties) ApiPersistedDataset(com.hartwig.pipeline.reruns.ApiPersistedDataset) PersistedDataset(com.hartwig.pipeline.reruns.PersistedDataset) NoopPersistedDataset(com.hartwig.pipeline.reruns.NoopPersistedDataset) NoopPersistedDataset(com.hartwig.pipeline.reruns.NoopPersistedDataset)

Aggregations

SingleSampleEventListener (com.hartwig.pipeline.metadata.SingleSampleEventListener)2 SomaticMetadataApi (com.hartwig.pipeline.metadata.SomaticMetadataApi)2 GoogleCredentials (com.google.auth.oauth2.GoogleCredentials)1 Publisher (com.google.cloud.pubsub.v1.Publisher)1 Storage (com.google.cloud.storage.Storage)1 PipelineComplete (com.hartwig.events.PipelineComplete)1 AlignerProvider (com.hartwig.pipeline.alignment.AlignerProvider)1 GermlineCallerOutput (com.hartwig.pipeline.calling.germline.GermlineCallerOutput)1 Cleanup (com.hartwig.pipeline.cleanup.Cleanup)1 CleanupProvider (com.hartwig.pipeline.cleanup.CleanupProvider)1 CredentialProvider (com.hartwig.pipeline.credentials.CredentialProvider)1 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)1 GoogleComputeEngine (com.hartwig.pipeline.execution.vm.GoogleComputeEngine)1 FlagstatOutput (com.hartwig.pipeline.flagstat.FlagstatOutput)1 ObjectMappers (com.hartwig.pipeline.jackson.ObjectMappers)1 Labels (com.hartwig.pipeline.labels.Labels)1 InputMode (com.hartwig.pipeline.metadata.InputMode)1 ModeResolver (com.hartwig.pipeline.metadata.ModeResolver)1 SingleSampleRunMetadata (com.hartwig.pipeline.metadata.SingleSampleRunMetadata)1 SomaticMetadataApiProvider (com.hartwig.pipeline.metadata.SomaticMetadataApiProvider)1