Search in sources :

Example 1 with JavaJarCommand

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

the class Orange method commands.

@Override
public List<BashCommand> commands(final SomaticRunMetadata metadata) {
    final String pipelineVersionFilePath = VmDirectories.INPUT + "/orange_pipeline.version.txt";
    final String pipelineVersion = Versions.pipelineMajorMinorVersion();
    final List<String> primaryTumorDoids = metadata.tumor().primaryTumorDoids();
    String linxPlotDir = linxOutputDir.getLocalTargetPath() + "/plot";
    return List.of(new MkDirCommand(linxPlotDir), () -> "echo '" + pipelineVersion + "' | tee " + pipelineVersionFilePath, new JavaJarCommand("orange", Versions.ORANGE, "orange.jar", "16G", List.of("-output_dir", VmDirectories.OUTPUT, "-doid_json", resourceFiles.doidJson(), "-primary_tumor_doids", primaryTumorDoids.isEmpty() ? "\"\"" : "\"" + String.join(";", primaryTumorDoids) + "\"", "-max_evidence_level", MAX_EVIDENCE_LEVEL, "-tumor_sample_id", metadata.tumor().sampleName(), "-reference_sample_id", metadata.reference().sampleName(), "-ref_sample_wgs_metrics_file", refMetrics.getLocalTargetPath(), "-tumor_sample_wgs_metrics_file", tumMetrics.getLocalTargetPath(), "-ref_sample_flagstat_file", refFlagstat.getLocalTargetPath(), "-tumor_sample_flagstat_file", tumFlagstat.getLocalTargetPath(), "-sage_germline_gene_coverage_tsv", sageGermlineGeneCoverageTsv.getLocalTargetPath(), "-sage_somatic_ref_sample_bqr_plot", sageSomaticRefSampleBqrPlot.getLocalTargetPath(), "-sage_somatic_tumor_sample_bqr_plot", sageSomaticTumorSampleBqrPlot.getLocalTargetPath(), "-purple_gene_copy_number_tsv", purpleGeneCopyNumberTsv.getLocalTargetPath(), "-purple_germline_driver_catalog_tsv", purpleGermlineDriverCatalog.getLocalTargetPath(), "-purple_germline_variant_vcf", purpleGermlineVcf.getLocalTargetPath(), "-purple_plot_directory", purpleOutputDir.getLocalTargetPath() + "/plot", "-purple_purity_tsv", purplePurityTsv.getLocalTargetPath(), "-purple_qc_file", purpleQCFile.getLocalTargetPath(), "-purple_somatic_driver_catalog_tsv", purpleSomaticDriverCatalog.getLocalTargetPath(), "-purple_somatic_variant_vcf", purpleSomaticVcf.getLocalTargetPath(), "-linx_fusion_tsv", linxFusionTsv.getLocalTargetPath(), "-linx_breakend_tsv", linxBreakEndTsv.getLocalTargetPath(), "-linx_driver_catalog_tsv", linxDriverCatalogTsv.getLocalTargetPath(), "-linx_driver_tsv", linxDriverTsv.getLocalTargetPath(), "-linx_plot_directory", linxPlotDir, "-cuppa_result_csv", cuppaResultCsv.getLocalTargetPath(), "-cuppa_summary_plot", cuppaSummaryPlot.getLocalTargetPath(), "-cuppa_feature_plot", cuppaFeaturePlot.getLocalTargetPath(), "-chord_prediction_txt", chordPredictionTxt.getLocalTargetPath(), "-peach_genotype_tsv", peachGenotypeTsv.getLocalTargetPath(), "-protect_evidence_tsv", protectEvidenceTsv.getLocalTargetPath(), "-annotated_virus_tsv", annotatedVirusTsv.getLocalTargetPath(), "-pipeline_version_file", pipelineVersionFilePath, "-cohort_mapping_tsv", resourceFiles.orangeCohortMapping(), "-cohort_percentiles_tsv", resourceFiles.orangeCohortPercentiles())));
}
Also used : MkDirCommand(com.hartwig.pipeline.execution.vm.unix.MkDirCommand) JavaJarCommand(com.hartwig.pipeline.execution.vm.java.JavaJarCommand)

Example 2 with JavaJarCommand

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

the class Bam2Fastq method execute.

@Override
public VirtualMachineJobDefinition execute(InputBundle inputs, RuntimeBucket bucket, BashStartupScript startupScript, RuntimeFiles executionFlags) {
    InputFileDescriptor descriptor = inputs.get();
    String localCopyOfBam = format("%s/%s", VmDirectories.INPUT, new File(descriptor.inputValue()).getName());
    startupScript.addCommand(() -> descriptor.toCommandForm(localCopyOfBam));
    startupScript.addCommand(new PipeCommands(new SambambaCommand("view", "-H", localCopyOfBam), () -> "grep ^@RG", () -> "grep -cP \"_L00[1-8]_\""));
    List<String> picargs = ImmutableList.of("SamToFastq", "ODIR=" + VmDirectories.OUTPUT, "OPRG=true", "RGT=ID", "NON_PF=true", "RC=true", "I=" + localCopyOfBam);
    startupScript.addCommand(new JavaJarCommand("picard", "2.18.27", "picard.jar", "16G", picargs));
    startupScript.addCommand(() -> format("rename 's/(.+)_(.+)_(.+)_(.+)_(.+)__(.+)\\.fastq/$1_$2_$3_$4_R$6_$5.fastq/' %s/*.fastq", VmDirectories.OUTPUT));
    startupScript.addCommand(() -> format("pigz %s/*.fastq", VmDirectories.OUTPUT));
    startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(bucket.name(), "bam2fastq"), executionFlags));
    return ImmutableVirtualMachineJobDefinition.builder().name("bam2fastq").startupCommand(startupScript).namespacedResults(ResultsDirectory.defaultDirectory()).workingDiskSpaceGb(1800).performanceProfile(VirtualMachinePerformanceProfile.custom(4, 20)).build();
}
Also used : PipeCommands(com.hartwig.pipeline.execution.vm.unix.PipeCommands) OutputUpload(com.hartwig.pipeline.execution.vm.OutputUpload) InputFileDescriptor(com.hartwig.batch.input.InputFileDescriptor) SambambaCommand(com.hartwig.pipeline.execution.vm.SambambaCommand) JavaJarCommand(com.hartwig.pipeline.execution.vm.java.JavaJarCommand) File(java.io.File)

Example 3 with JavaJarCommand

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

the class Amber method formCommand.

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

Example 4 with JavaJarCommand

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

the class Cobalt method formCommand.

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

Example 5 with JavaJarCommand

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

Aggregations

JavaJarCommand (com.hartwig.pipeline.execution.vm.java.JavaJarCommand)9 BashCommand (com.hartwig.pipeline.execution.vm.BashCommand)4 MkDirCommand (com.hartwig.pipeline.execution.vm.unix.MkDirCommand)2 InputFileDescriptor (com.hartwig.batch.input.InputFileDescriptor)1 OutputUpload (com.hartwig.pipeline.execution.vm.OutputUpload)1 SambambaCommand (com.hartwig.pipeline.execution.vm.SambambaCommand)1 PipeCommands (com.hartwig.pipeline.execution.vm.unix.PipeCommands)1 File (java.io.File)1