Search in sources :

Example 1 with BashCommand

use of com.hartwig.pipeline.execution.vm.BashCommand 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 BashCommand

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

the class PurpleRerun method bashCommands.

public List<BashCommand> bashCommands(RemoteLocations locations) {
    final LocalLocations batchInput = new LocalLocations(locations);
    final List<BashCommand> commands = Lists.newArrayList();
    final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
    final String tumorSampleName = batchInput.getTumor();
    final String referenceSampleName = batchInput.getReference();
    final String amberLocation = batchInput.getAmber();
    final String cobaltLocation = batchInput.getCobalt();
    final String sageSomaticLocation = batchInput.getSomaticVariantsSage();
    final String sageGermlineLocation = batchInput.getGermlineVariantsSage();
    final String gripssLocation = batchInput.getStructuralVariantsGripss();
    final String gripssRecoveryLocation = batchInput.getStructuralVariantsGripssRecovery();
    commands.addAll(batchInput.generateDownloadCommands());
    PurpleCommandBuilder builder = new PurpleCommandBuilder(resourceFiles, amberLocation, cobaltLocation, tumorSampleName, gripssLocation, gripssRecoveryLocation, sageSomaticLocation).addGermline(sageGermlineLocation);
    commands.add(builder.build());
    return commands;
}
Also used : ResourceFiles(com.hartwig.pipeline.resource.ResourceFiles) LocalLocations(com.hartwig.batch.api.LocalLocations) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) PurpleCommandBuilder(com.hartwig.pipeline.tertiary.purple.PurpleCommandBuilder)

Example 3 with BashCommand

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

the class LocalLocationsTest method testSelectFileAfterDownload.

@Test(expected = IllegalStateException.class)
public void testSelectFileAfterDownload() {
    LocalLocations local = new LocalLocations(remoteLocations);
    List<BashCommand> commands = local.generateDownloadCommands();
    String alignment = local.getTumorAlignment();
}
Also used : LocalLocations(com.hartwig.batch.api.LocalLocations) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) Test(org.junit.Test)

Example 4 with BashCommand

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

the class PurpleRerunTest method testCommands.

@Test
public void testCommands() {
    RemoteLocations locations = new RemoteLocationsTestImpl();
    List<BashCommand> commands = victim.bashCommands(locations);
    assertEquals(commands.get(0).asBash(), "mkdir -p /data/input/amber");
    assertEquals(commands.get(1).asBash(), inputDownload("cp -r -n gs://amber/171006_COLO829/* /data/input/amber/"));
    assertEquals(commands.get(2).asBash(), "mkdir -p /data/input/cobalt");
    assertEquals(commands.get(3).asBash(), inputDownload("cp -r -n gs://cobalt/171006_COLO829/* /data/input/cobalt/"));
    assertEquals(commands.get(4).asBash(), inputDownload("cp -r -n gs://sage/171006_COLO829/COLO929v003T.sage.somatic.vcf.gz /data/input/COLO929v003T.sage.somatic.vcf.gz"));
    assertEquals(commands.get(5).asBash(), inputDownload("cp -r -n gs://sage/171006_COLO829/COLO929v003T.sage.germline.vcf.gz /data/input/COLO929v003T.sage.germline.vcf.gz"));
    assertEquals(commands.get(6).asBash(), inputDownload("cp -r -n gs://gripss/171006_COLO829/COLO929v003T.gripss.somatic.filtered.vcf.gz /data/input/COLO929v003T.gripss.somatic.filtered.vcf.gz"));
    assertEquals(commands.get(7).asBash(), inputDownload("cp -r -n gs://gripss/171006_COLO829/COLO929v003T.gripss.somatic.vcf.gz /data/input/COLO929v003T.gripss.somatic.vcf.gz"));
    assertEquals(commands.get(8).asBash(), inputDownload("cp -r -n gs://gripss/171006_COLO829/COLO929v003T.gripss.somatic.vcf.gz.tbi /data/input/COLO929v003T.gripss.somatic.vcf.gz.tbi"));
    assertEquals(commands.get(9).asBash().substring(0, 36), "java -Xmx12G -jar /opt/tools/purple/");
}
Also used : RemoteLocations(com.hartwig.batch.api.RemoteLocations) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) Test(org.junit.Test)

Example 5 with BashCommand

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

the class SageCreatePonData method cramToBam.

private List<BashCommand> cramToBam(String cram) {
    final String output = cram.replace("cram", "bam");
    final BashCommand toBam = new VersionedToolCommand("samtools", "samtools", Versions.SAMTOOLS, "view", "-o", output, "-O", "bam", "-@", Bash.allCpus(), cram);
    final BashCommand index = new VersionedToolCommand("samtools", "samtools", Versions.SAMTOOLS, "index", "-@", Bash.allCpus(), output);
    return Lists.newArrayList(toBam, index);
}
Also used : BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) VersionedToolCommand(com.hartwig.pipeline.calling.command.VersionedToolCommand)

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