Search in sources :

Example 11 with AddDatatype

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

the class LinxSomatic method output.

@Override
public LinxSomaticOutput output(final SomaticRunMetadata metadata, final PipelineStatus jobStatus, final RuntimeBucket bucket, final ResultsDirectory resultsDirectory) {
    String breakendTsv = metadata.tumor().sampleName() + BREAKEND_TSV;
    String driverCatalogTsv = metadata.tumor().sampleName() + DRIVER_CATALOG_TSV;
    String fusionsTsv = metadata.tumor().sampleName() + FUSION_TSV;
    String driversTsv = metadata.tumor().sampleName() + DRIVERS_TSV;
    String clustersTsv = metadata.tumor().sampleName() + CLUSTERS_TSV;
    String svAnnotationsTsv = metadata.tumor().sampleName() + SV_ANNOTATIONS_TSV;
    return LinxSomaticOutput.builder().status(jobStatus).maybeLinxOutputLocations(LinxSomaticOutputLocations.builder().breakends(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(breakendTsv))).drivers(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(driversTsv))).driverCatalog(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(driverCatalogTsv))).fusions(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(fusionsTsv))).svAnnotations(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(svAnnotationsTsv))).clusters(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(clustersTsv))).outputDirectory(GoogleStorageLocation.of(bucket.name(), resultsDirectory.path(), true)).build()).addFailedLogLocations(GoogleStorageLocation.of(bucket.name(), RunLogComponent.LOG_FILE)).addReportComponents(new EntireOutputComponent(bucket, Folder.root(), NAMESPACE, resultsDirectory)).addDatatypes(new AddDatatype(DataType.LINX, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), driversTsv))).addDatatypes(new AddDatatype(DataType.LINX_BREAKENDS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), breakendTsv))).addDatatypes(new AddDatatype(DataType.LINX_DRIVER_CATALOG, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), driverCatalogTsv))).addDatatypes(new AddDatatype(DataType.LINX_DRIVERS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), driversTsv))).addDatatypes(new AddDatatype(DataType.LINX_FUSIONS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), fusionsTsv))).addDatatypes(new AddDatatype(DataType.LINX_CLUSTERS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), clustersTsv))).addDatatypes(new AddDatatype(DataType.LINX_SV_ANNOTATIONS, metadata.barcode(), new ArchivePath(Folder.root(), namespace(), svAnnotationsTsv))).build();
}
Also used : ArchivePath(com.hartwig.pipeline.metadata.ArchivePath) EntireOutputComponent(com.hartwig.pipeline.report.EntireOutputComponent) AddDatatype(com.hartwig.pipeline.metadata.AddDatatype)

Example 12 with AddDatatype

use of com.hartwig.pipeline.metadata.AddDatatype 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 13 with AddDatatype

use of com.hartwig.pipeline.metadata.AddDatatype 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 14 with AddDatatype

use of com.hartwig.pipeline.metadata.AddDatatype 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)14 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 PipelineStatus (com.hartwig.pipeline.execution.PipelineStatus)3 Folder (com.hartwig.pipeline.report.Folder)3 StartupScriptComponent (com.hartwig.pipeline.report.StartupScriptComponent)3 List (java.util.List)3 Collectors (java.util.stream.Collectors)3 Blob (com.google.cloud.storage.Blob)2 AnalysisOutputBlob (com.hartwig.events.AnalysisOutputBlob)2 PipelineComplete (com.hartwig.events.PipelineComplete)2 ResultsDirectory (com.hartwig.pipeline.ResultsDirectory)2 Aligner (com.hartwig.pipeline.alignment.Aligner)2 BashStartupScript (com.hartwig.pipeline.execution.vm.BashStartupScript)2 VirtualMachineJobDefinition (com.hartwig.pipeline.execution.vm.VirtualMachineJobDefinition)2 SingleSampleRunMetadata (com.hartwig.pipeline.metadata.SingleSampleRunMetadata)2 SomaticRunMetadata (com.hartwig.pipeline.metadata.SomaticRunMetadata)2 ReportComponent (com.hartwig.pipeline.report.ReportComponent)2