Search in sources :

Example 21 with BashCommand

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

the class SageCreatePon method execute.

@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket runtimeBucket, final BashStartupScript startupScript, final RuntimeFiles executionFlags) {
    final String output = String.format("%s/SAGE.pon.vcf.gz", VmDirectories.OUTPUT);
    final BashCommand sageCommand = new SageCommand("com.hartwig.hmftools.sage.pon.PonApplication", "100G", "-in", VmDirectories.INPUT, "-out", output, "-threads", Bash.allCpus());
    // Download required resources
    // startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s %s",
    // "gs://batch-sage-validation/resources/sage.jar",
    // "/opt/tools/sage/" + Versions.SAGE + "/sage.jar"));
    // Download germline VCFS (and indexes)
    startupScript.addCommand(() -> format("gsutil -u hmf-crunch -m cp %s %s", "gs://batch-sage/*/sage/*.sage.somatic.vcf.gz", VmDirectories.INPUT));
    startupScript.addCommand(() -> format("gsutil -u hmf-crunch -m cp %s %s", "gs://batch-sage/*/sage/*.sage.somatic.vcf.gz.tbi", VmDirectories.INPUT));
    // Run Pon Generator
    startupScript.addCommand(sageCommand);
    // Store output
    startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(runtimeBucket.name(), "sage"), executionFlags));
    return VirtualMachineJobDefinition.sageSomaticCalling(startupScript, ResultsDirectory.defaultDirectory());
}
Also used : OutputUpload(com.hartwig.pipeline.execution.vm.OutputUpload) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) SageCommand(com.hartwig.pipeline.calling.sage.SageCommand)

Example 22 with BashCommand

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

the class PurpleGermline method bashCommands.

public List<BashCommand> bashCommands(final InputBundle inputs) {
    final List<BashCommand> commands = Lists.newArrayList();
    final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
    final String set = inputs.get("set").inputValue();
    final String tumorSampleName = inputs.get("tumor_sample").inputValue();
    final String referenceSampleName = inputs.get("ref_sample").inputValue();
    final GoogleStorageLocation sageVcfStorage = sageSomaticFilteredFile(set, tumorSampleName);
    final GoogleStorageLocation sageIndexStorage = index(sageVcfStorage);
    // gripssSomaticFilteredFile(set, tumorSampleName);
    final GoogleStorageLocation gripssVcfStorage = null;
    // index(gripssVcfStorage);
    final GoogleStorageLocation gripssVcfIndexStorage = null;
    // gripssRecoveryFile(set, tumorSampleName);
    final GoogleStorageLocation gripssRecoveryVcfStorage = null;
    final GoogleStorageLocation gripssRecoveryVcfIndexStorage = index(gripssRecoveryVcfStorage);
    final String amberInputDir = VmDirectories.INPUT + "/amber";
    final String cobaltInputDir = VmDirectories.INPUT + "/cobalt";
    final InputDownload amberLocation = new InputDownload(amberArchiveDirectory(set), amberInputDir);
    final InputDownload cobaltLocation = new InputDownload(cobaltArchiveDirectory(set), cobaltInputDir);
    final InputDownload sageLocation = new InputDownload(sageVcfStorage);
    final InputDownload sageLocationIndex = new InputDownload(sageIndexStorage);
    final InputDownload gripssLocation = new InputDownload(gripssVcfStorage);
    final InputDownload gripssLocationIndex = new InputDownload(gripssVcfIndexStorage);
    final InputDownload gripssRecoveryLocation = new InputDownload(gripssRecoveryVcfStorage);
    final InputDownload gripssRecoveryLocationIndex = new InputDownload(gripssRecoveryVcfIndexStorage);
    final String germlineVcf = VmDirectories.INPUT + "/" + tumorSampleName + ".sage.germline.filtered.vcf.gz";
    // gsutil ls gs://batch-sage-germline/*/sage/WIDE01010012T*germline.filtered.vcf.gz*
    commands.add(() -> String.format("gsutil -m cp gs://batch-sage-germline/*/sage/%s*germline.filtered.vcf.gz* %s/", tumorSampleName, VmDirectories.INPUT));
    commands.add(() -> "mkdir -p " + amberInputDir);
    commands.add(() -> "mkdir -p " + cobaltInputDir);
    // commands.add(downloadExperimentalVersion());
    commands.add(amberLocation);
    commands.add(cobaltLocation);
    commands.add(sageLocation);
    commands.add(sageLocationIndex);
    commands.add(gripssLocation);
    commands.add(gripssLocationIndex);
    commands.add(gripssRecoveryLocation);
    commands.add(gripssRecoveryLocationIndex);
    BashCommand purpleCommand = new PurpleCommandBuilder(resourceFiles, amberLocation.getLocalTargetPath(), cobaltLocation.getLocalTargetPath(), tumorSampleName, gripssLocation.getLocalTargetPath(), gripssRecoveryLocation.getLocalTargetPath(), sageLocation.getLocalTargetPath()).addGermline(germlineVcf).build();
    commands.add(purpleCommand);
    return commands;
}
Also used : ResourceFiles(com.hartwig.pipeline.resource.ResourceFiles) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) InputDownload(com.hartwig.pipeline.execution.vm.InputDownload) ImmutableGoogleStorageLocation(com.hartwig.pipeline.storage.ImmutableGoogleStorageLocation) GoogleStorageLocation(com.hartwig.pipeline.storage.GoogleStorageLocation) PurpleCommandBuilder(com.hartwig.pipeline.tertiary.purple.PurpleCommandBuilder)

Aggregations

BashCommand (com.hartwig.pipeline.execution.vm.BashCommand)22 Test (org.junit.Test)5 LocalLocations (com.hartwig.batch.api.LocalLocations)4 JavaJarCommand (com.hartwig.pipeline.execution.vm.java.JavaJarCommand)4 OutputFile (com.hartwig.pipeline.execution.vm.OutputFile)3 SubStage (com.hartwig.pipeline.stages.SubStage)3 SubStageInputOutput (com.hartwig.pipeline.stages.SubStageInputOutput)3 BwaCommand (com.hartwig.pipeline.calling.command.BwaCommand)2 VersionedToolCommand (com.hartwig.pipeline.calling.command.VersionedToolCommand)2 OutputUpload (com.hartwig.pipeline.execution.vm.OutputUpload)2 MvCommand (com.hartwig.pipeline.execution.vm.unix.MvCommand)2 ResourceFiles (com.hartwig.pipeline.resource.ResourceFiles)2 PurpleCommandBuilder (com.hartwig.pipeline.tertiary.purple.PurpleCommandBuilder)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 RemoteLocations (com.hartwig.batch.api.RemoteLocations)1 SamtoolsCommand (com.hartwig.pipeline.calling.command.SamtoolsCommand)1 SageCommand (com.hartwig.pipeline.calling.sage.SageCommand)1 GridssAnnotation (com.hartwig.pipeline.calling.structural.gridss.stage.GridssAnnotation)1 RepeatMasker (com.hartwig.pipeline.calling.structural.gridss.stage.RepeatMasker)1 FileTypes (com.hartwig.pipeline.datatypes.FileTypes)1