Search in sources :

Example 11 with BashCommand

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

the class SageCommandBuilder method build.

public List<BashCommand> build(final String outputVcf) {
    List<BashCommand> result = Lists.newArrayList();
    if (shallowSomaticMode && !somaticMode) {
        throw new IllegalStateException("Shallow somatic mode enabled while not in shallow mode");
    }
    if (tumorBam.isEmpty() && referenceBam.isEmpty()) {
        throw new IllegalStateException("Must be at least one tumor or reference");
    }
    final List<String> arguments = Lists.newArrayList();
    final String tumorBamFiles = tumor.length() > 0 ? String.join(",", tumorBam) : "";
    final String referenceBamFiles = reference.length() > 0 ? String.join(",", referenceBam) : "";
    if (somaticMode) {
        arguments.add(String.format("-tumor %s", tumor.toString()));
        arguments.add(String.format("-tumor_bam %s", tumorBamFiles));
        if (reference.length() > 0) {
            arguments.add(String.format("-reference %s", reference.toString()));
            arguments.add(String.format("-reference_bam %s", referenceBamFiles));
        }
        arguments.add(String.format("-hotspots %s", resourceFiles.sageSomaticHotspots()));
        arguments.add(String.format("-panel_bed %s", resourceFiles.sageSomaticCodingPanel()));
        if (shallowSomaticMode) {
            arguments.add("-hotspot_min_tumor_qual 40");
        }
    } else if (germlineMode) {
        arguments.add(String.format("-tumor %s", reference.toString()));
        arguments.add(String.format("-tumor_bam %s", referenceBamFiles));
        if (tumor.length() > 0) {
            arguments.add(String.format("-reference %s", tumor.toString()));
            arguments.add(String.format("-reference_bam %s", tumorBamFiles));
        }
        arguments.add(String.format("-hotspots %s", resourceFiles.sageGermlineHotspots()));
        arguments.add(String.format("-panel_bed %s", resourceFiles.sageGermlineCodingPanel()));
        arguments.add("-hotspot_min_tumor_qual 50");
        arguments.add("-panel_min_tumor_qual 75");
        arguments.add("-hotspot_max_germline_vaf 100");
        arguments.add("-hotspot_max_germline_rel_raw_base_qual 100");
        arguments.add("-panel_max_germline_vaf 100");
        arguments.add("-panel_max_germline_rel_raw_base_qual 100");
        arguments.add("-mnv_filter_enabled false");
        arguments.add("-panel_only");
    }
    if (coverage) {
        if (germlineMode) {
            arguments.add(String.format("-coverage_bed %s", resourceFiles.sageGermlineCoveragePanel()));
        } else {
            arguments.add(String.format("-coverage_bed %s", resourceFiles.sageSomaticCodingPanel()));
        }
    }
    if (targetRegions) {
        arguments.add("-hotspot_min_tumor_qual 100");
        arguments.add("-panel_min_tumor_qual 200");
        arguments.add("-high_confidence_min_tumor_qual 200");
        arguments.add("-low_confidence_min_tumor_qual 300");
    }
    arguments.add(String.format("-high_confidence_bed %s", resourceFiles.giabHighConfidenceBed()));
    arguments.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
    arguments.add(String.format("-ref_genome_version %s", resourceFiles.version().toString()));
    arguments.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
    arguments.add("-write_bqr_data");
    arguments.add("-write_bqr_plot");
    arguments.add(String.format("-out %s", outputVcf));
    arguments.add(String.format("-threads %s", Bash.allCpus()));
    result.add(new JavaJarCommand("sage", Versions.SAGE, "sage.jar", wgsMaxHeap, arguments));
    return result;
}
Also used : BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) JavaJarCommand(com.hartwig.pipeline.execution.vm.java.JavaJarCommand)

Example 12 with BashCommand

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

the class Gridss method gridssCommands.

private List<BashCommand> gridssCommands(final Driver driver, final String sampleName) {
    SubStageInputOutput unfilteredVcfOutput = driver.andThen(new RepeatMasker()).andThen(new GridssAnnotation(resourceFiles, false)).apply(SubStageInputOutput.empty(sampleName));
    unfilteredVcf = unfilteredVcfOutput.outputFile().path();
    List<BashCommand> commands = new ArrayList<>();
    commands.add(new ExportPathCommand(new BwaCommand()));
    commands.add(new ExportPathCommand(new SamtoolsCommand()));
    commands.addAll(unfilteredVcfOutput.bash());
    return commands;
}
Also used : BwaCommand(com.hartwig.pipeline.calling.command.BwaCommand) ExportPathCommand(com.hartwig.pipeline.execution.vm.unix.ExportPathCommand) SamtoolsCommand(com.hartwig.pipeline.calling.command.SamtoolsCommand) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) ArrayList(java.util.ArrayList) SubStageInputOutput(com.hartwig.pipeline.stages.SubStageInputOutput) RepeatMasker(com.hartwig.pipeline.calling.structural.gridss.stage.RepeatMasker) GridssAnnotation(com.hartwig.pipeline.calling.structural.gridss.stage.GridssAnnotation)

Example 13 with BashCommand

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

the class ExportPathCommandTest method shouldTakePathOfCommand.

@Test
public void shouldTakePathOfCommand() {
    BashCommand command = new ExportPathCommand(new BwaCommand());
    assertThat(command.asBash()).isEqualTo("export PATH=\"${PATH}:/opt/tools/bwa/0.7.17\"");
}
Also used : BwaCommand(com.hartwig.pipeline.calling.command.BwaCommand) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) Test(org.junit.Test)

Example 14 with BashCommand

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

the class Gripss method formCommand.

protected List<BashCommand> formCommand(final List<String> arguments) {
    List<BashCommand> commands = Lists.newArrayList();
    commands.add(new JavaJarCommand("gripss", Versions.GRIPSS, "gripss.jar", "16G", arguments));
    return commands;
}
Also used : BashCommand(com.hartwig.pipeline.execution.vm.BashCommand) JavaJarCommand(com.hartwig.pipeline.execution.vm.java.JavaJarCommand)

Example 15 with BashCommand

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

the class SageGermlinePostProcess method bash.

@Override
public List<BashCommand> bash(final OutputFile input, final OutputFile output) {
    final List<BashCommand> result = Lists.newArrayList();
    SubStage passFilter = new PassFilter();
    OutputFile finalOutputFile = OutputFile.of(sampleName.sampleName(), SAGE_GERMLINE_FILTERED, FileTypes.GZIPPED_VCF);
    result.addAll(passFilter.bash(input, finalOutputFile));
    return result;
}
Also used : OutputFile(com.hartwig.pipeline.execution.vm.OutputFile) SubStage(com.hartwig.pipeline.stages.SubStage) BashCommand(com.hartwig.pipeline.execution.vm.BashCommand)

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