Search in sources :

Example 1 with MvCommand

use of com.hartwig.pipeline.execution.vm.unix.MvCommand in project pipeline5 by hartwigmedical.

the class GermlineCaller method commands.

@Override
public List<BashCommand> commands(final SingleSampleRunMetadata metadata) {
    String referenceFasta = resourceFiles.refGenomeFile();
    SubStageInputOutput callerOutput = new GatkGermlineCaller(bamDownload.getLocalTargetPath(), referenceFasta).andThen(new GenotypeGVCFs(referenceFasta)).apply(SubStageInputOutput.empty(metadata.sampleName()));
    SubStageInputOutput snpFilterOutput = new SelectVariants("snp", Lists.newArrayList("SNP", "NO_VARIATION"), referenceFasta).andThen(new VariantFiltration("snp", SNP_FILTER_EXPRESSION, referenceFasta)).apply(callerOutput);
    SubStageInputOutput indelFilterOutput = new SelectVariants("indels", Lists.newArrayList("INDEL", "MIXED"), referenceFasta).andThen(new VariantFiltration("indels", INDEL_FILTER_EXPRESSION, referenceFasta)).apply(SubStageInputOutput.of(metadata.sampleName(), callerOutput.outputFile(), Collections.emptyList()));
    SubStageInputOutput combinedFilters = snpFilterOutput.combine(indelFilterOutput);
    SubStageInputOutput finalOutput = new CombineFilteredVariants(indelFilterOutput.outputFile().path(), referenceFasta).andThen(new GermlineZipIndex()).apply(combinedFilters);
    return ImmutableList.<BashCommand>builder().addAll(finalOutput.bash()).add(new MvCommand(finalOutput.outputFile().path(), outputFile.path())).add(new MvCommand(finalOutput.outputFile().path() + ".tbi", outputFile.path() + ".tbi")).build();
}
Also used : BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) SubStageInputOutput(com.hartwig.pipeline.stages.SubStageInputOutput) MvCommand(com.hartwig.pipeline.execution.vm.unix.MvCommand)

Example 2 with MvCommand

use of com.hartwig.pipeline.execution.vm.unix.MvCommand in project pipeline5 by hartwigmedical.

the class GermlineCaller method germlineCallerCommands.

public List<BashCommand> germlineCallerCommands(final SingleSampleRunMetadata metadata) {
    String referenceFasta = resourceFiles.refGenomeFile();
    SubStageInputOutput callerOutput = new GatkGermlineCaller(bamDownload.getLocalTargetPath(), referenceFasta).andThen(new GenotypeGVCFs(referenceFasta)).apply(SubStageInputOutput.empty(metadata.sampleName()));
    SubStageInputOutput snpFilterOutput = new SelectVariants("snp", Lists.newArrayList("SNP", "NO_VARIATION"), referenceFasta).andThen(new VariantFiltration("snp", SNP_FILTER_EXPRESSION, referenceFasta)).apply(callerOutput);
    SubStageInputOutput indelFilterOutput = new SelectVariants("indels", Lists.newArrayList("INDEL", "MIXED"), referenceFasta).andThen(new VariantFiltration("indels", INDEL_FILTER_EXPRESSION, referenceFasta)).apply(SubStageInputOutput.of(metadata.sampleName(), callerOutput.outputFile(), Collections.emptyList()));
    SubStageInputOutput combinedFilters = snpFilterOutput.combine(indelFilterOutput);
    SubStageInputOutput finalOutput = new CombineFilteredVariants(indelFilterOutput.outputFile().path(), referenceFasta).andThen(new GermlineZipIndex()).apply(combinedFilters);
    return ImmutableList.<BashCommand>builder().addAll(finalOutput.bash()).add(new MvCommand(finalOutput.outputFile().path(), outputFile.path())).add(new MvCommand(finalOutput.outputFile().path() + ".tbi", outputFile.path() + ".tbi")).build();
}
Also used : BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) SubStageInputOutput(com.hartwig.pipeline.stages.SubStageInputOutput) MvCommand(com.hartwig.pipeline.execution.vm.unix.MvCommand)

Example 3 with MvCommand

use of com.hartwig.pipeline.execution.vm.unix.MvCommand in project pipeline5 by hartwigmedical.

the class SamtoolsBamToCram method execute.

@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket bucket, final BashStartupScript startupScript, final RuntimeFiles executionFlags) {
    InputFileDescriptor input = inputs.get();
    String outputFile = VmDirectories.outputFile(new File(input.inputValue()).getName().replaceAll("\\.bam$", ".cram"));
    String localInput = format("%s/%s", VmDirectories.INPUT, new File(input.inputValue()).getName());
    startupScript.addCommand(() -> input.toCommandForm(localInput));
    startupScript.addCommands(new CramAndValidateCommands(localInput, outputFile, new RefGenome37ResourceFiles()).commands());
    startupScript.addCommand(new MvCommand("/data/output/*.bam", "/data/tmp"));
    startupScript.addCommand(new MvCommand("/data/output/*.bam.flagstat", "/data/tmp"));
    startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(bucket.name(), "samtools"), executionFlags));
    return VirtualMachineJobDefinition.builder().name("samtoolscram").startupCommand(startupScript).namespacedResults(ResultsDirectory.defaultDirectory()).workingDiskSpaceGb(650).performanceProfile(VirtualMachinePerformanceProfile.custom(6, 6)).build();
}
Also used : CramAndValidateCommands(com.hartwig.pipeline.cram.CramAndValidateCommands) OutputUpload(com.hartwig.pipeline.execution.vm.OutputUpload) InputFileDescriptor(com.hartwig.batch.input.InputFileDescriptor) RefGenome37ResourceFiles(com.hartwig.pipeline.resource.RefGenome37ResourceFiles) MvCommand(com.hartwig.pipeline.execution.vm.unix.MvCommand) File(java.io.File)

Aggregations

MvCommand (com.hartwig.pipeline.execution.vm.unix.MvCommand)3 BashCommand (com.hartwig.pipeline.execution.vm.BashCommand)2 SubStageInputOutput (com.hartwig.pipeline.stages.SubStageInputOutput)2 InputFileDescriptor (com.hartwig.batch.input.InputFileDescriptor)1 CramAndValidateCommands (com.hartwig.pipeline.cram.CramAndValidateCommands)1 OutputUpload (com.hartwig.pipeline.execution.vm.OutputUpload)1 RefGenome37ResourceFiles (com.hartwig.pipeline.resource.RefGenome37ResourceFiles)1 File (java.io.File)1