use of com.hartwig.batch.input.InputFileDescriptor in project pipeline5 by hartwigmedical.
the class RnaIsofoxSpliceJunctions method execute.
@Override
public VirtualMachineJobDefinition execute(InputBundle inputs, RuntimeBucket bucket, BashStartupScript startupScript, RuntimeFiles executionFlags) {
InputFileDescriptor descriptor = inputs.get();
final String batchInputs = descriptor.inputValue();
final String[] batchItems = batchInputs.split(",");
if (batchItems.length < 2) {
System.out.print(String.format("invalid input arguments(%s) - expected SampleId,ReadLength", batchInputs));
return null;
}
final String sampleId = batchItems[COL_SAMPLE_ID];
final String geneIds = batchItems[COL_GENE_IDS];
final RefGenomeVersion refGenomeVersion = V37;
final ResourceFiles resourceFiles = buildResourceFiles(refGenomeVersion);
final String samplesDir = String.format("%s/%s", getRnaCohortDirectory(refGenomeVersion), "samples");
// copy down BAM and index file for this sample
final String bamFile = String.format("%s%s", sampleId, RNA_BAM_FILE_ID);
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", samplesDir, sampleId, bamFile, VmDirectories.INPUT));
final String bamIndexFile = String.format("%s%s", sampleId, RNA_BAM_INDEX_FILE_ID);
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", samplesDir, sampleId, bamIndexFile, VmDirectories.INPUT));
// copy down the executable
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s %s", ISOFOX_LOCATION, ISOFOX_JAR, VmDirectories.TOOLS));
startupScript.addCommand(() -> format("cd %s", VmDirectories.OUTPUT));
// run Isofox
StringJoiner isofoxArgs = new StringJoiner(" ");
isofoxArgs.add(String.format("-sample %s", sampleId));
isofoxArgs.add(String.format("-functions %s", FUNC_TRANSCRIPT_COUNTS));
isofoxArgs.add(String.format("-output_dir %s/", VmDirectories.OUTPUT));
isofoxArgs.add(String.format("-bam_file %s/%s", VmDirectories.INPUT, bamFile));
isofoxArgs.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
isofoxArgs.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
isofoxArgs.add(String.format("-write_exon_data"));
isofoxArgs.add(String.format("-restricted_gene_ids %s", geneIds));
isofoxArgs.add(" -output_id gene_sj");
startupScript.addCommand(() -> format("java -jar %s/%s %s", VmDirectories.TOOLS, ISOFOX_JAR, isofoxArgs.toString()));
// upload the results
startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(bucket.name(), "isofox"), executionFlags));
return ImmutableVirtualMachineJobDefinition.builder().name("rna-isofox").startupCommand(startupScript).namespacedResults(ResultsDirectory.defaultDirectory()).workingDiskSpaceGb(MAX_EXPECTED_BAM_SIZE_GB).build();
}
use of com.hartwig.batch.input.InputFileDescriptor in project pipeline5 by hartwigmedical.
the class RnaRsem method execute.
@Override
public VirtualMachineJobDefinition execute(InputBundle inputs, RuntimeBucket bucket, BashStartupScript startupScript, RuntimeFiles executionFlags) {
InputFileDescriptor descriptor = inputs.get();
final String batchInputs = descriptor.inputValue();
final String[] batchItems = batchInputs.split(",");
if (batchItems.length != 2) {
System.out.print(String.format("invalid input arguments(%s) - expected SampleId,PathToFastqFiles", batchInputs));
return null;
}
final String sampleId = batchItems[0];
final String fastqFilelist = batchItems[1];
final List<String> sampleFastqFiles = getSampleFastqFileList(sampleId, fastqFilelist);
if (sampleFastqFiles.isEmpty()) {
System.out.print(String.format("sampleId(%s) fastq files not found", sampleId));
return null;
}
// copy down FASTQ files for this sample
for (final String fastqFile : sampleFastqFiles) {
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s %s", fastqFile, VmDirectories.INPUT));
}
// download the executables
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp -r %s/%s %s", RSEM_RESOURCES, RSEM_TOOL, VmDirectories.TOOLS));
startupScript.addCommand(() -> format("chmod a+x %s/%s/*", VmDirectories.TOOLS, RSEM_TOOL));
// locate the FASTQ files for reads 1 and 2
final String r1Files = format("$(ls %s/*_R1* | tr '\\n' ',')", VmDirectories.INPUT);
final String r2Files = format("$(ls %s/*_R2* | tr '\\n' ',')", VmDirectories.INPUT);
// download reference files
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp -r %s/%s %s", RNA_RESOURCES, REF_GENCODE_37_DIR, VmDirectories.INPUT));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp -r %s/%s %s", RSEM_RESOURCES, RSEM_GENE_INDEX_DIR, VmDirectories.INPUT));
startupScript.addCommand(() -> format("cd %s", VmDirectories.OUTPUT));
// run STAR with transcriptome mapping
final String refGenomeDir = String.format("%s/%s", VmDirectories.INPUT, REF_GENCODE_37_DIR);
final String threadCount = Bash.allCpus();
final String[] starArgs = { "--runThreadN", threadCount, "--genomeDir", refGenomeDir, "--genomeLoad", "NoSharedMemory", "--readFilesIn", r1Files, r2Files, "--readFilesCommand", "zcat", "--outSAMtype", "BAM", "Unsorted", "--outSAMunmapped", "Within", "--outBAMcompression", "0", "--outSAMattributes", "All", "--outFilterMultimapNmax", "10", "--outFilterMismatchNmax", "3", "limitOutSJcollapsed", "3000000", "--chimSegmentMin", "10", "--chimOutType", "WithinBAM", "SoftClip", "--chimJunctionOverhangMin", "10", "--chimSegmentReadGapMax", "3", "--chimScoreMin", "1", "--chimScoreDropMax", "30", "--chimScoreJunctionNonGTAG", "0", "--chimScoreSeparation", "1", "--outFilterScoreMinOverLread", "0.33", "--outFilterMatchNminOverLread", "0.33", "--outFilterMatchNmin", "35", "--alignSplicedMateMapLminOverLmate", "0.33", "--alignSplicedMateMapLmin", "35", "--alignSJstitchMismatchNmax", "5", "-1", "5", "5", "--quantMode", // key line for RSEM;
"TranscriptomeSAM" };
startupScript.addCommand(new VersionedToolCommand("star", "STAR", "2.7.3a", starArgs));
// key output file is 'Aligned.toTranscriptome.out.bam'
// ./tools/RSEM-1.3.3/rsem-calculate-expression --alignments --paired-end
// ./runs/CPCT02020378T/Aligned.toTranscriptome.out.bam
// ./ref/rsem_gene_index/human_gencode
// CPCT02020378T.rsem -p 6 &
final String transcriptomeBam = "Aligned.toTranscriptome.out.bam";
// TMP: copy transcriptome BAM to the bucket
// startupScript.addCommand(() -> format("gsutil -m cp %s/%s gs://rna-cohort/%s/rsem/", VmDirectories.OUTPUT, transcriptomeBam, sampleId));
final String rsemGeneIndex = String.format("%s/%s/%s", VmDirectories.INPUT, RSEM_GENE_INDEX_DIR, RSEM_GENE_INDEX);
final String outputPrefix = String.format("%s.rsem", sampleId);
// run RSEM
StringBuilder rsemArgs = new StringBuilder();
rsemArgs.append(" --alignments");
rsemArgs.append(" --paired-end");
rsemArgs.append(String.format(" %s", transcriptomeBam));
rsemArgs.append(String.format(" %s", rsemGeneIndex));
rsemArgs.append(String.format(" %s", outputPrefix));
rsemArgs.append(String.format(" -p %s", threadCount));
// run RSEM transcript expression calcs
startupScript.addCommand(() -> format("%s/%s/%s %s", VmDirectories.TOOLS, RSEM_TOOL, RSEM_EXPRESSION_CMD, rsemArgs.toString()));
startupScript.addCommand(() -> format("mv %s.rsem.genes.results %s.rsem.gene_data.tsv", sampleId, sampleId));
startupScript.addCommand(() -> format("mv %s.rsem.isoforms.results %s.rsem.trans_data.tsv", sampleId, sampleId));
startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(bucket.name(), "rsem"), executionFlags));
// copy results to rna-analysis location on crunch
startupScript.addCommand(() -> format("gsutil -m cp %s/*tsv %s/%s/rsem/", VmDirectories.OUTPUT, RNA_COHORT_LOCATION_V37, sampleId));
return ImmutableVirtualMachineJobDefinition.builder().name("rna-rsem").startupCommand(startupScript).namespacedResults(ResultsDirectory.defaultDirectory()).workingDiskSpaceGb(500).performanceProfile(VirtualMachinePerformanceProfile.custom(12, 36)).build();
}
use of com.hartwig.batch.input.InputFileDescriptor in project pipeline5 by hartwigmedical.
the class SageCreatePonData method execute.
@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket runtimeBucket, final BashStartupScript startupScript, final RuntimeFiles executionFlags) {
final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
final InputFileDescriptor remoteReferenceFile = inputs.get("reference");
final InputFileDescriptor remoteReferenceIndex = remoteReferenceFile.index();
final String localReferenceFile = localFilename(remoteReferenceFile);
final String localReferenceBam = localReferenceFile.replace("cram", "bam");
final String referenceSampleName = inputs.get("referenceSample").inputValue();
// Download latest jar file
// 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 normal
startupScript.addCommand(() -> remoteReferenceFile.toCommandForm(localReferenceFile));
startupScript.addCommand(() -> remoteReferenceIndex.toCommandForm(localFilename(remoteReferenceIndex)));
final SageCommandBuilder sageCommandBuilder = new SageCommandBuilder(resourceFiles).ponMode(referenceSampleName, localReferenceBam);
final SageApplication sageApplication = new SageApplication(sageCommandBuilder);
// Convert to bam if necessary
if (!localReferenceFile.equals(localReferenceBam)) {
startupScript.addCommands(cramToBam(localReferenceFile));
}
// Run post processing (NONE for germline)
final SubStageInputOutput postProcessing = sageApplication.apply(SubStageInputOutput.empty(referenceSampleName));
startupScript.addCommands(postProcessing.bash());
// Store output
startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(runtimeBucket.name(), "sage"), executionFlags));
return VirtualMachineJobDefinition.sageSomaticCalling(startupScript, ResultsDirectory.defaultDirectory());
}
use of com.hartwig.batch.input.InputFileDescriptor in project pipeline5 by hartwigmedical.
the class SagePanelTumor method execute.
@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket runtimeBucket, final BashStartupScript startupScript, final RuntimeFiles executionFlags) {
InputFileDescriptor descriptor = inputs.get();
final String sampleId = descriptor.inputValue();
final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V38);
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_TOOLS_BUCKET, SAGE_DIR, SAGE_JAR, VmDirectories.TOOLS));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_RESOURCE_BUCKET, SAGE_DIR, PANEL_BED, VmDirectories.INPUT));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_TOOLS_BUCKET, PAVE_DIR, PAVE_JAR, VmDirectories.TOOLS));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/38/* %s", BATCH_RESOURCE_BUCKET, GNOMAD_DIR, VmDirectories.INPUT));
String ponFile = "SageGermlinePon.98x.38.tsv.gz";
String ponArtefactFile = "pon_panel_artefact.38.tsv";
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_RESOURCE_BUCKET, SAGE_DIR, ponFile, VmDirectories.INPUT));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_RESOURCE_BUCKET, SAGE_DIR, ponArtefactFile, VmDirectories.INPUT));
// download tumor BAM
final String tumorBam = String.format("%s.non_umi_dedup.bam", sampleId);
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s* %s", PANEL_BAM_BUCKET, tumorBam, VmDirectories.INPUT));
final String sageVcf = String.format("%s/%s.sage.somatic.vcf.gz", VmDirectories.OUTPUT, sampleId);
// run Sage
final StringJoiner sageArgs = new StringJoiner(" ");
sageArgs.add(String.format("-tumor %s", sampleId));
sageArgs.add(String.format("-tumor_bam %s/%s", VmDirectories.INPUT, tumorBam));
sageArgs.add(String.format("-hotspots %s", resourceFiles.sageSomaticHotspots()));
sageArgs.add(String.format("-panel_bed %s", resourceFiles.sageSomaticCodingPanel()));
sageArgs.add(String.format("-high_confidence_bed %s", resourceFiles.giabHighConfidenceBed()));
sageArgs.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
sageArgs.add(String.format("-ref_genome_version %s", resourceFiles.version().toString()));
sageArgs.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
sageArgs.add(String.format("-coverage_bed %s/%s", VmDirectories.INPUT, PANEL_BED));
sageArgs.add(String.format("-out %s", sageVcf));
sageArgs.add(String.format("-hotspot_min_tumor_qual 100"));
sageArgs.add(String.format("-panel_min_tumor_qual 200"));
sageArgs.add(String.format("-high_confidence_min_tumor_qual 200"));
sageArgs.add(String.format("-low_confidence_min_tumor_qual 300"));
sageArgs.add(String.format("-mnv_filter_enabled false"));
sageArgs.add(String.format("-perf_warn_time 50"));
// sageArgs.add(String.format("-log_debug"));
sageArgs.add(String.format("-threads %s", Bash.allCpus()));
startupScript.addCommand(() -> format("java -Xmx48G -jar %s/%s %s", VmDirectories.TOOLS, SAGE_JAR, sageArgs.toString()));
// annotate with Pave - PON, Gnomad and gene impacts
/*
String bcfTools = String.format("%s/bcftools/%s/bcftools", VmDirectories.TOOLS, Versions.BCF_TOOLS);
String ponVcf = String.format("%s/%s.sage.somatic.pon.vcf.gz", VmDirectories.OUTPUT, sampleId);
// /data/tools/bcftools/1.9/bcftools annotate -a /data/resources/bucket/sage/37/SageGermlinePon.1000x.37.vcf.gz
// -c PON_COUNT,PON_MAX
// FR16648814.sage.somatic.vcf.gz
// -O z
// -o FR16648814.sage.somatic.annotated.vcf.gz
final StringJoiner ponArgs = new StringJoiner(" ");
ponArgs.add(String.format("-a %s", resourceFiles.sageGermlinePon()));
ponArgs.add("-c PON_COUNT,PON_MAX");
ponArgs.add(String.format("%s", sageVcf));
ponArgs.add("-O z");
ponArgs.add(String.format("-o %s", ponVcf));
startupScript.addCommand(() -> format("%s annotate %s", bcfTools, ponArgs.toString()));
///data/tools/bcftools/1.9/bcftools filter
// -e ‘PON_COUNT!=“.” && INFO/TIER=“HOTSPOT” && PON_MAX>=5 && PON_COUNT >= 5’
// -s PON -m+ FR16648814.sage.somatic.annotated.vcf.gz -O u
// | /data/tools/bcftools/1.9/bcftools filter -e ‘PON_COUNT!=“.” && INFO/TIER=“PANEL” && PON_MAX>=5 && PON_COUNT >= 2’
// -s PON -m+ -O u | /data/tools/bcftools/1.9/bcftools filter -e ‘PON_COUNT!=“.” && INFO/TIER!=“HOTSPOT” && INFO/TIER!=“PANEL” && PON_COUNT >= 2’
// -s PON -m+ -O z -o FR16648814.sage.somatic.pon_filtered.vcf.gz
String ponFilterVcf = String.format("%s/%s.sage.somatic.pon_filter.vcf.gz", VmDirectories.OUTPUT, sampleId);
// private static final String HOTSPOT = "INFO/TIER=\"HOTSPOT\" && PON_MAX>=%s && PON_COUNT >= %s";
// private static final String PANEL = "INFO/TIER=\"PANEL\" && PON_MAX>=%s && PON_COUNT >= %s";
// private static final String OTHER = "INFO/TIER!=\"HOTSPOT\" && INFO/TIER!=\"PANEL\" && PON_COUNT >= %s";
final StringJoiner ponFilterArgs = new StringJoiner(" ");
ponFilterArgs.add("-e 'PON_COUNT!=\".\" && INFO/TIER=\"HOTSPOT\" && PON_MAX>=5 && PON_COUNT >= 5'");
ponFilterArgs.add(String.format("-s PON -m+ %s -O u", ponVcf));
ponFilterArgs.add(String.format("| %s filter -e 'PON_COUNT!=\".\" && INFO/TIER=\"PANEL\" && PON_MAX>=5 && PON_COUNT >= 2'", bcfTools));
ponFilterArgs.add(String.format("-s PON -m+ -O u | %s filter -e 'PON_COUNT!=\".\" && INFO/TIER!=\"HOTSPOT\" && INFO/TIER!=\"PANEL\" && PON_COUNT >= 2'", bcfTools));
ponFilterArgs.add(String.format("-s PON -m+ -O z -o %s", ponFilterVcf));
startupScript.addCommand(() -> format("%s filter %s", bcfTools, ponFilterArgs.toString()));
*/
// finally run Pave
final StringJoiner paveArgs = new StringJoiner(" ");
String ponFilters = "HOTSPOT:5:5;PANEL:2:5;UNKNOWN:2:0";
final String paveVcf = String.format("%s/%s.sage.somatic.pon.pave_pass.vcf.gz", VmDirectories.OUTPUT, sampleId);
paveArgs.add(String.format("-sample %s", sampleId));
// ponFilterVcf from BCF Tools
paveArgs.add(String.format("-vcf_file %s", sageVcf));
paveArgs.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
paveArgs.add(String.format("-ref_genome_version %s", resourceFiles.version().toString()));
paveArgs.add(String.format("-driver_gene_panel %s", resourceFiles.driverGenePanel()));
paveArgs.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
paveArgs.add("-only_canonical");
paveArgs.add("-filter_pass");
paveArgs.add(String.format("-gnomad_freq_dir %s", VmDirectories.INPUT));
paveArgs.add(String.format("-pon_file %s/%s", VmDirectories.INPUT, ponFile));
paveArgs.add(String.format("-pon_artefact_file %s/%s", VmDirectories.INPUT, ponArtefactFile));
paveArgs.add(String.format("-pon_filters \"%s\"", ponFilters));
paveArgs.add("-gnomad_load_chr_on_demand");
paveArgs.add(String.format("-output_vcf_file %s", paveVcf));
String paveJar = String.format("%s/%s", VmDirectories.TOOLS, PAVE_JAR);
// String paveJar = String.format("%s/pave/%s/pave.jar", VmDirectories.TOOLS, Versions.PAVE);
startupScript.addCommand(() -> format("java -jar %s %s", paveJar, paveArgs.toString()));
// upload output
startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(runtimeBucket.name(), "sage"), executionFlags));
return ImmutableVirtualMachineJobDefinition.builder().name("sage").startupCommand(startupScript).performanceProfile(custom(24, 64)).namespacedResults(ResultsDirectory.defaultDirectory()).build();
}
use of com.hartwig.batch.input.InputFileDescriptor in project pipeline5 by hartwigmedical.
the class SageRerun method execute.
@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket runtimeBucket, final BashStartupScript startupScript, final RuntimeFiles executionFlags) {
InputFileDescriptor descriptor = inputs.get();
final String sampleId = descriptor.inputValue();
final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_TOOLS_BUCKET, SAGE_DIR, SAGE_JAR, VmDirectories.TOOLS));
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_TOOLS_BUCKET, PAVE_DIR, PAVE_JAR, VmDirectories.TOOLS));
String ponFile = "SageGermlinePon.1000x.37.tsv.gz";
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp %s/%s/%s %s", BATCH_RESOURCE_BUCKET, SAGE_DIR, ponFile, VmDirectories.INPUT));
// download tumor and ref CRAM
final RemoteLocationsApi locations = new RemoteLocationsApi("hmf-crunch", sampleId);
String[] tumorCramData = getCramFileData(locations.getTumorAlignment());
String tumorCramFile = tumorCramData[CRAM_FILENAME];
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp gs://%s* %s", tumorCramData[CRAM_FULL_PATH], VmDirectories.INPUT));
String referenceId = locations.getReference();
String[] refCramData = getCramFileData(locations.getReferenceAlignment());
String refCramFile = refCramData[CRAM_FILENAME];
startupScript.addCommand(() -> format("gsutil -u hmf-crunch cp gs://%s* %s", refCramData[CRAM_FULL_PATH], VmDirectories.INPUT));
final String sageVcf = String.format("%s/%s.sage.somatic.vcf.gz", VmDirectories.OUTPUT, sampleId);
// run Sage
final StringJoiner sageArgs = new StringJoiner(" ");
sageArgs.add(String.format("-tumor %s", sampleId));
sageArgs.add(String.format("-tumor_bam %s/%s", VmDirectories.INPUT, tumorCramFile));
sageArgs.add(String.format("-reference %s", referenceId));
sageArgs.add(String.format("-reference_bam %s/%s", VmDirectories.INPUT, refCramFile));
sageArgs.add(String.format("-hotspots %s", resourceFiles.sageSomaticHotspots()));
sageArgs.add(String.format("-panel_bed %s", resourceFiles.sageSomaticCodingPanel()));
sageArgs.add(String.format("-high_confidence_bed %s", resourceFiles.giabHighConfidenceBed()));
sageArgs.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
sageArgs.add(String.format("-ref_genome_version %s", resourceFiles.version().toString()));
sageArgs.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
sageArgs.add(String.format("-out %s", sageVcf));
sageArgs.add(String.format("-perf_warn_time 50"));
// sageArgs.add(String.format("-log_debug"));
sageArgs.add(String.format("-threads %s", Bash.allCpus()));
startupScript.addCommand(() -> format("java -Xmx48G -jar %s/%s %s", VmDirectories.TOOLS, SAGE_JAR, sageArgs.toString()));
// annotate with Pave - PON and gene impacts
final StringJoiner paveArgs = new StringJoiner(" ");
String ponFilters = "HOTSPOT:5:5;PANEL:2:5;UNKNOWN:2:0";
final String paveVcf = String.format("%s/%s.sage.somatic.pon.pave.vcf.gz", VmDirectories.OUTPUT, sampleId);
paveArgs.add(String.format("-sample %s", sampleId));
// ponFilterVcf from BCF Tools
paveArgs.add(String.format("-vcf_file %s", sageVcf));
paveArgs.add(String.format("-ref_genome %s", resourceFiles.refGenomeFile()));
paveArgs.add(String.format("-ref_genome_version %s", resourceFiles.version().toString()));
paveArgs.add(String.format("-driver_gene_panel %s", resourceFiles.driverGenePanel()));
paveArgs.add(String.format("-ensembl_data_dir %s", resourceFiles.ensemblDataCache()));
paveArgs.add(String.format("-pon_file %s/%s", VmDirectories.INPUT, ponFile));
paveArgs.add(String.format("-pon_filters \"%s\"", ponFilters));
paveArgs.add(String.format("-output_vcf_file %s", paveVcf));
String paveJar = String.format("%s/%s", VmDirectories.TOOLS, PAVE_JAR);
startupScript.addCommand(() -> format("java -jar %s %s", paveJar, paveArgs.toString()));
// upload output
startupScript.addCommand(new OutputUpload(GoogleStorageLocation.of(runtimeBucket.name(), "sage"), executionFlags));
return ImmutableVirtualMachineJobDefinition.builder().name("sage").startupCommand(startupScript).performanceProfile(custom(24, 64)).namespacedResults(ResultsDirectory.defaultDirectory()).build();
}
Aggregations