Search in sources :

Example 1 with AnalysisOutputBlob

use of com.hartwig.events.AnalysisOutputBlob 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 AnalysisOutputBlob

use of com.hartwig.events.AnalysisOutputBlob 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 AnalysisOutputBlob

use of com.hartwig.events.AnalysisOutputBlob 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 AnalysisOutputBlob

use of com.hartwig.events.AnalysisOutputBlob 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 AnalysisOutputBlob

use of com.hartwig.events.AnalysisOutputBlob 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)

Aggregations

PubsubMessage (com.google.pubsub.v1.PubsubMessage)7 AnalysisOutputBlob (com.hartwig.events.AnalysisOutputBlob)7 PipelineComplete (com.hartwig.events.PipelineComplete)7 Test (org.junit.Test)5 Blob (com.google.cloud.storage.Blob)3 Analysis (com.hartwig.events.Analysis)3