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();
}
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();
}
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");
}
Aggregations