Search in sources :

Example 6 with PipelineComplete

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

the class StagedOutputPublisherTest method publishesDnaTertiaryAnalysisOnVcf.

@Test
public void publishesDnaTertiaryAnalysisOnVcf() throws Exception {
    when(state.status()).thenReturn(PipelineStatus.SUCCESS);
    Blob vcf = withBucketAndMd5(blob("/sage/" + TestInputs.tumorSample() + ".vcf"));
    Page<Blob> page = pageOf(vcf);
    ArgumentCaptor<PubsubMessage> messageArgumentCaptor = publish(page, TestInputs.defaultSomaticRunMetadata());
    PipelineComplete result = OBJECT_MAPPER.readValue(new String(messageArgumentCaptor.getValue().getData().toByteArray()), PipelineComplete.class);
    assertThat(result.pipeline().analyses().get(1).type()).isEqualTo(Type.SOMATIC);
    assertThat(result.pipeline().analyses().get(1).output()).extracting(AnalysisOutputBlob::filename).containsExactlyInAnyOrder("tumor.vcf");
}
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)

Example 7 with PipelineComplete

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

the class StagedOutputPublisherTest method verifySecondaryAnalysis.

private void verifySecondaryAnalysis(final String extension, final String indexExtension, final String namespace) throws com.fasterxml.jackson.core.JsonProcessingException {
    when(state.status()).thenReturn(PipelineStatus.SUCCESS);
    Blob tumorBamBlob = withBucketAndMd5(blob(TestInputs.tumorSample() + "/" + namespace + "/" + TestInputs.tumorSample() + "." + extension));
    Blob tumorBaiBlob = withBucketAndMd5(blob(TestInputs.tumorSample() + "/" + namespace + "/" + TestInputs.tumorSample() + "." + extension + "." + indexExtension));
    Blob refBamBlob = withBucketAndMd5(blob(TestInputs.tumorSample() + "/" + namespace + "/" + TestInputs.referenceSample() + "." + extension));
    Blob refBaiBlob = withBucketAndMd5(blob(TestInputs.tumorSample() + "/" + namespace + "/" + TestInputs.referenceSample() + "." + extension + "." + indexExtension));
    Page<Blob> page = pageOf(tumorBamBlob, tumorBaiBlob, refBamBlob, refBaiBlob);
    ArgumentCaptor<PubsubMessage> messageArgumentCaptor = publish(page, TestInputs.defaultSomaticRunMetadata());
    PipelineComplete result = OBJECT_MAPPER.readValue(new String(messageArgumentCaptor.getValue().getData().toByteArray()), PipelineComplete.class);
    assertThat(result.pipeline().context()).isEqualTo(Context.DIAGNOSTIC);
    assertThat(result.pipeline().analyses().get(0).type()).isEqualTo(Type.ALIGNMENT);
    assertThat(result.pipeline().analyses().get(0).output()).hasSize(4);
    assertThat(result.pipeline().analyses().get(0).output()).extracting(AnalysisOutputBlob::filename).containsExactlyInAnyOrder(TestInputs.tumorSample() + "." + extension, TestInputs.tumorSample() + "." + extension + "." + indexExtension, TestInputs.referenceSample() + "." + extension, TestInputs.referenceSample() + "." + extension + "." + indexExtension);
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Blob(com.google.cloud.storage.Blob) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage)

Example 8 with PipelineComplete

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

the class StagedOutputPublisherTest method verifyGermline.

public void verifyGermline(final String filename, final String expectedFile, final String namespace) throws com.fasterxml.jackson.core.JsonProcessingException {
    when(state.status()).thenReturn(PipelineStatus.SUCCESS);
    Blob vcf = withBucketAndMd5(blob(namespace + TestInputs.referenceSample() + filename));
    Page<Blob> page = pageOf(vcf);
    ArgumentCaptor<PubsubMessage> messageArgumentCaptor = publish(page, TestInputs.defaultSomaticRunMetadata());
    PipelineComplete result = OBJECT_MAPPER.readValue(new String(messageArgumentCaptor.getValue().getData().toByteArray()), PipelineComplete.class);
    assertThat(result.pipeline().analyses().get(2).type()).isEqualTo(Type.GERMLINE);
    assertThat(result.pipeline().analyses().get(2).output()).extracting(AnalysisOutputBlob::filename).containsExactlyInAnyOrder(expectedFile);
}
Also used : PipelineComplete(com.hartwig.events.PipelineComplete) Blob(com.google.cloud.storage.Blob) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) PubsubMessage(com.google.pubsub.v1.PubsubMessage)

Example 9 with PipelineComplete

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

the class StagedOutputPublisherTest method usesDatatypeAndBarcodeWhenFileMatched.

@Test
public void usesDatatypeAndBarcodeWhenFileMatched() throws Exception {
    when(state.status()).thenReturn(PipelineStatus.SUCCESS);
    String path = TestInputs.referenceSample() + "/germline_caller/reference.germline.vcf.gz";
    Blob vcf = withBucketAndMd5(blob(path));
    Page<Blob> page = pageOf(vcf);
    StageOutput stageOutput = mock(StageOutput.class);
    when(stageOutput.datatypes()).thenReturn(List.of(new AddDatatype(DataType.GERMLINE_VARIANTS, "barcode", new ArchivePath(Folder.from(TestInputs.referenceRunMetadata()), "germline_caller", "reference.germline.vcf.gz"))));
    when(state.stageOutputs()).thenReturn(List.of(stageOutput));
    ArgumentCaptor<PubsubMessage> published = publish(page, TestInputs.defaultSingleSampleRunMetadata());
    PipelineComplete result = OBJECT_MAPPER.readValue(new String(published.getValue().getData().toByteArray()), PipelineComplete.class);
    assertThat(result.pipeline().analyses().get(2).output().get(0).datatype()).hasValue("GERMLINE_VARIANTS");
    assertThat(result.pipeline().analyses().get(2).output().get(0).barcode()).hasValue("barcode");
}
Also used : StageOutput(com.hartwig.pipeline.StageOutput) ArchivePath(com.hartwig.pipeline.metadata.ArchivePath) PipelineComplete(com.hartwig.events.PipelineComplete) Blob(com.google.cloud.storage.Blob) AnalysisOutputBlob(com.hartwig.events.AnalysisOutputBlob) AddDatatype(com.hartwig.pipeline.metadata.AddDatatype) 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