Search in sources :

Example 1 with PipelineComplete

use of com.hartwig.events.PipelineComplete in project pipeline5 by hartwigmedical.

the class ResearchMetadataApiTest method publishesPipelineStagedEventOnCompletionSingleSampleFile.

@Test
public void publishesPipelineStagedEventOnCompletionSingleSampleFile() throws Exception {
    ArgumentCaptor<PubsubMessage> pubsubMessageArgumentCaptor = pipelineCompleteWithFile("set/reference/aligner/reference.bam", TestOutput.builder().status(PipelineStatus.SUCCESS).build());
    PipelineComplete result = ObjectMappers.get().readValue(pubsubMessageArgumentCaptor.getValue().getData().toByteArray(), PipelineComplete.class);
    Analysis analysis = result.pipeline().analyses().get(0);
    assertThat(analysis.molecule()).isEqualTo(Molecule.DNA);
    AnalysisOutputBlob blobResult = analysis.output().get(0);
    assertThat(blobResult.datatype()).isEmpty();
    assertThat(blobResult.root()).isEqualTo("set");
    assertThat(blobResult.sampleSubdir()).hasValue("reference");
    assertThat(blobResult.namespace()).hasValue("aligner");
    assertThat(blobResult.filename()).isEqualTo("reference.bam");
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Analysis(com.hartwig.events.Analysis) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage) Test(org.junit.Test)

Example 2 with PipelineComplete

use of com.hartwig.events.PipelineComplete in project pipeline5 by hartwigmedical.

the class ResearchMetadataApiTest method publishesPipelineStagedEventOnCompletionWithDataType.

@Test
public void publishesPipelineStagedEventOnCompletionWithDataType() throws Exception {
    ArgumentCaptor<PubsubMessage> pubsubMessageArgumentCaptor = pipelineCompleteWithFile("set/purple/tumor.purple.somatic.vcf.gz", TestOutput.builder().status(PipelineStatus.SUCCESS).addDatatypes(new AddDatatype(DataType.SOMATIC_VARIANTS_PURPLE, "tumor", new ArchivePath(Folder.root(), "purple", "tumor.purple.somatic.vcf.gz"))).build());
    PipelineComplete result = ObjectMappers.get().readValue(pubsubMessageArgumentCaptor.getValue().getData().toByteArray(), PipelineComplete.class);
    AnalysisOutputBlob blobResult = result.pipeline().analyses().get(1).output().get(0);
    assertThat(blobResult.datatype()).hasValue("SOMATIC_VARIANTS_PURPLE");
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage) Test(org.junit.Test)

Example 3 with PipelineComplete

use of com.hartwig.events.PipelineComplete in project pipeline5 by hartwigmedical.

the class ResearchMetadataApiTest method publishesPipelineStagedEventOnCompletionRootFile.

@Test
public void publishesPipelineStagedEventOnCompletionRootFile() throws Exception {
    ArgumentCaptor<PubsubMessage> pubsubMessageArgumentCaptor = pipelineCompleteWithFile("set/run.log", TestOutput.builder().status(PipelineStatus.SUCCESS).build());
    PipelineComplete result = ObjectMappers.get().readValue(pubsubMessageArgumentCaptor.getValue().getData().toByteArray(), PipelineComplete.class);
    Analysis analysis = result.pipeline().analyses().get(1);
    assertThat(analysis.molecule()).isEqualTo(Molecule.DNA);
    AnalysisOutputBlob blobResult = analysis.output().get(0);
    assertThat(blobResult.datatype()).isEmpty();
    assertThat(blobResult.root()).isEqualTo("set");
    assertThat(blobResult.sampleSubdir()).isEmpty();
    assertThat(blobResult.namespace()).isEmpty();
    assertThat(blobResult.filename()).isEqualTo("run.log");
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Analysis(com.hartwig.events.Analysis) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage) Test(org.junit.Test)

Example 4 with PipelineComplete

use of com.hartwig.events.PipelineComplete in project pipeline5 by hartwigmedical.

the class ResearchMetadataApiTest method publishesPipelineStagedEventOnCompletion.

@Test
public void publishesPipelineStagedEventOnCompletion() throws Exception {
    ArgumentCaptor<PubsubMessage> pubsubMessageArgumentCaptor = pipelineCompleteWithFile("set/purple/tumor.purple.somatic.vcf.gz", TestOutput.builder().status(PipelineStatus.SUCCESS).build());
    PipelineComplete result = ObjectMappers.get().readValue(pubsubMessageArgumentCaptor.getValue().getData().toByteArray(), PipelineComplete.class);
    assertThat(result.pipeline().runId()).isEqualTo(1);
    assertThat(result.pipeline().setId()).isEqualTo(SET_ID);
    assertThat(result.pipeline().sample()).isEqualTo("tumor");
    assertThat(result.pipeline().version()).isEqualTo(Versions.pipelineMajorMinorVersion());
    Analysis analysis = result.pipeline().analyses().get(1);
    assertThat(analysis.molecule()).isEqualTo(Molecule.DNA);
    AnalysisOutputBlob blobResult = analysis.output().get(0);
    assertThat(blobResult.barcode()).isEmpty();
    assertThat(blobResult.bucket()).isEqualTo("bucket");
    assertThat(blobResult.datatype()).isEmpty();
    assertThat(blobResult.root()).isEqualTo("set");
    assertThat(blobResult.sampleSubdir()).isEmpty();
    assertThat(blobResult.namespace()).hasValue("purple");
    assertThat(blobResult.filename()).isEqualTo("tumor.purple.somatic.vcf.gz");
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Analysis(com.hartwig.events.Analysis) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage) Test(org.junit.Test)

Example 5 with PipelineComplete

use of com.hartwig.events.PipelineComplete in project pipeline5 by hartwigmedical.

the class StagedOutputPublisherTest method usesReferenceSampleWhenNoTumor.

@Test
public void usesReferenceSampleWhenNoTumor() throws Exception {
    when(state.status()).thenReturn(PipelineStatus.SUCCESS);
    Blob vcf = withBucketAndMd5(blob("/germline_caller/" + TestInputs.referenceSample() + "reference.germline.vcf.gz"));
    Page<Blob> page = pageOf(vcf);
    ArgumentCaptor<PubsubMessage> published = publish(page, TestInputs.defaultSingleSampleRunMetadata());
    PipelineComplete result = OBJECT_MAPPER.readValue(new String(published.getValue().getData().toByteArray()), PipelineComplete.class);
    assertThat(result.pipeline().sample()).isEqualTo("reference");
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Blob(com.google.cloud.storage.Blob) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage) Test(org.junit.Test)

Aggregations

PubsubMessage (com.google.pubsub.v1.PubsubMessage)9 AnalysisOutputBlob (com.hartwig.events.AnalysisOutputBlob)9 PipelineComplete (com.hartwig.events.PipelineComplete)9 Test (org.junit.Test)7 Blob (com.google.cloud.storage.Blob)5 Analysis (com.hartwig.events.Analysis)3 StageOutput (com.hartwig.pipeline.StageOutput)1 AddDatatype (com.hartwig.pipeline.metadata.AddDatatype)1 ArchivePath (com.hartwig.pipeline.metadata.ArchivePath)1