Search in sources :

Example 11 with ArchivePath

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

the class Purple method output.

@Override
public PurpleOutput output(final SomaticRunMetadata metadata, final PipelineStatus jobStatus, final RuntimeBucket bucket, final ResultsDirectory resultsDirectory) {
    String purityTsv = purityTsv(metadata.sampleName());
    String qcFile = purpleQC(metadata.sampleName());
    ImmutablePurpleOutputLocations.Builder outputLocationsBuilder = PurpleOutputLocations.builder().outputDirectory(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(), true)).purity(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(purityTsv))).qcFile(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(qcFile)));
    ImmutablePurpleOutput.Builder outputBuilder = PurpleOutput.builder().status(jobStatus).addFailedLogLocations(GoogleStorageLocation.of(bucket.name(), RunLogComponent.LOG_FILE)).addReportComponents(new EntireOutputComponent(bucket, Folder.root(), NAMESPACE, resultsDirectory)).addDatatypes(new AddDatatype(DataType.PURPLE_PURITY, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), purityTsv))).addDatatypes(new AddDatatype(DataType.PURPLE_QC, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), qcFile)));
    metadata.maybeTumor().ifPresent(tumor -> {
        final String tumorSampleName = tumor.sampleName();
        String somaticDriverCatalog = somaticDriverCatalog(tumorSampleName);
        String somaticVcf = somaticVcf(tumorSampleName);
        String svVcf = svVcf(tumorSampleName);
        String geneCopyNumberTsv = geneCopyNumberTsv(tumorSampleName);
        String somaticCopyNumberTsv = somaticCopyNumberTsv(tumorSampleName);
        outputLocationsBuilder.somaticVariants(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(somaticVcf))).structuralVariants(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(svVcf))).geneCopyNumber(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(geneCopyNumberTsv))).somaticCopyNumber(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(somaticCopyNumberTsv))).somaticDriverCatalog(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(somaticDriverCatalog))).circosPlot(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(circosPlot(metadata))));
        outputBuilder.addDatatypes(new AddDatatype(DataType.SOMATIC_VARIANTS_PURPLE, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), somaticVcf))).addDatatypes(new AddDatatype(DataType.STRUCTURAL_VARIANTS_PURPLE, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), svVcf))).addDatatypes(new AddDatatype(DataType.PURPLE_SOMATIC_DRIVER_CATALOG, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), somaticDriverCatalog))).addDatatypes(new AddDatatype(DataType.PURPLE_SOMATIC_COPY_NUMBER, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), somaticCopyNumberTsv))).addDatatypes(new AddDatatype(DataType.PURPLE_CIRCOS_PLOT, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), circosPlot(metadata))));
    });
    metadata.maybeReference().ifPresent(reference -> {
        String germlineDriverCatalog = germlineDriverCatalog(metadata.sampleName());
        String germlineDeletionTsv = germlineDeletionTsv(metadata.sampleName());
        String germlineVcf = germlineVcf(metadata.sampleName());
        outputLocationsBuilder.germlineVariants(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(germlineVcf))).germlineDriverCatalog(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(germlineDriverCatalog(metadata.sampleName())))).germlineDeletions(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(germlineDeletionTsv)));
        outputBuilder.addDatatypes(new AddDatatype(DataType.GERMLINE_VARIANTS_PURPLE, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), germlineVcf))).addDatatypes(new AddDatatype(DataType.PURPLE_GERMLINE_DRIVER_CATALOG, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), germlineDriverCatalog))).addDatatypes(new AddDatatype(DataType.PURPLE_GERMLINE_DELETION, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), germlineDeletionTsv)));
    });
    outputBuilder.maybeOutputLocations(outputLocationsBuilder.build());
    return outputBuilder.build();
}
Also used : ArchivePath(com.hartwig.pipeline.metadata.ArchivePath) EntireOutputComponent(com.hartwig.pipeline.report.EntireOutputComponent) AddDatatype(com.hartwig.pipeline.metadata.AddDatatype)

Example 12 with ArchivePath

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

the class VirusAnalysis method output.

@Override
public VirusOutput output(final SomaticRunMetadata metadata, final PipelineStatus jobStatus, final RuntimeBucket bucket, final ResultsDirectory resultsDirectory) {
    String vcf = vcf(metadata);
    String summary = summary(metadata);
    String annotated = annotatedVirusTsv(metadata);
    return VirusOutput.builder().status(jobStatus).maybeAnnotatedVirusFile(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(annotated))).addFailedLogLocations(GoogleStorageLocation.of(bucket.name(), RunLogComponent.LOG_FILE)).addReportComponents(new SingleFileComponent(bucket, NAMESPACE, Folder.root(), vcf, vcf, resultsDirectory), new SingleFileComponent(bucket, NAMESPACE, Folder.root(), summary, summary, resultsDirectory), new SingleFileComponent(bucket, NAMESPACE, Folder.root(), annotated, annotated, resultsDirectory), new RunLogComponent(bucket, NAMESPACE, Folder.root(), resultsDirectory)).addDatatypes(new AddDatatype(DataType.VIRUSBREAKEND_VARIANTS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), vcf)), new AddDatatype(DataType.VIRUSBREAKEND_SUMMARY, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), summary)), new AddDatatype(DataType.VIRUS_INTERPRETATION, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), annotated))).build();
}
Also used : SingleFileComponent(com.hartwig.pipeline.report.SingleFileComponent) ArchivePath(com.hartwig.pipeline.metadata.ArchivePath) RunLogComponent(com.hartwig.pipeline.report.RunLogComponent) AddDatatype(com.hartwig.pipeline.metadata.AddDatatype)

Example 13 with ArchivePath

use of com.hartwig.pipeline.metadata.ArchivePath 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

AddDatatype (com.hartwig.pipeline.metadata.AddDatatype)13 ArchivePath (com.hartwig.pipeline.metadata.ArchivePath)13 EntireOutputComponent (com.hartwig.pipeline.report.EntireOutputComponent)5 RunLogComponent (com.hartwig.pipeline.report.RunLogComponent)5 SingleFileComponent (com.hartwig.pipeline.report.SingleFileComponent)4 Folder (com.hartwig.pipeline.report.Folder)3 StartupScriptComponent (com.hartwig.pipeline.report.StartupScriptComponent)3 ResultsDirectory (com.hartwig.pipeline.ResultsDirectory)2 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)2 BashStartupScript (com.hartwig.pipeline.execution.vm.BashStartupScript)2 VirtualMachineJobDefinition (com.hartwig.pipeline.execution.vm.VirtualMachineJobDefinition)2 ReportComponent (com.hartwig.pipeline.report.ReportComponent)2 ZippedVcfAndIndexComponent (com.hartwig.pipeline.report.ZippedVcfAndIndexComponent)2 SubStageInputOutput (com.hartwig.pipeline.stages.SubStageInputOutput)2 GoogleStorageLocation (com.hartwig.pipeline.storage.GoogleStorageLocation)2 RuntimeBucket (com.hartwig.pipeline.storage.RuntimeBucket)2 String.format (java.lang.String.format)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Blob (com.google.cloud.storage.Blob)1