use of com.hartwig.pipeline.resource.ResourceFiles in project pipeline5 by hartwigmedical.
the class LilacPcawgBatch method addSampleCommands.
private void addSampleCommands(final InputFileDescriptor runData, final BashStartupScript commands, final String runDirectory, final String sampleId) {
final String referenceAlignment = String.format("%s/%s_ref.bam", VmDirectories.INPUT, sampleId);
final String tumorAlignment = String.format("%s/%s_tumor.bam", VmDirectories.INPUT, sampleId);
// download sample BAM files
commands.addCommand(() -> format("gsutil -m -u hmf-crunch cp gs://%s/%s/* %s", PCAWG_BAM_BUCKET, sampleId, VmDirectories.INPUT));
// build Lilac arguments
String sampleOutputDir = String.format("%s/%s/", VmDirectories.OUTPUT, sampleId);
commands.addCommand(() -> format("mkdir -p %s", sampleOutputDir));
final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
StringBuilder lilacArgs = new StringBuilder();
lilacArgs.append(String.format(" -sample %s", sampleId));
lilacArgs.append(String.format(" -resource_dir %s", VmDirectories.INPUT));
lilacArgs.append(String.format(" -ref_genome %s", resourceFiles.refGenomeFile()));
lilacArgs.append(String.format(" -reference_bam %s", referenceAlignment));
lilacArgs.append(String.format(" -tumor_bam %s", tumorAlignment));
lilacArgs.append(" -run_id REF");
lilacArgs.append(String.format(" -output_dir %s", sampleOutputDir));
// lilacArgs.append(String.format(" -gene_copy_number_file %s", geneCopyNumber));
// lilacArgs.append(String.format(" -somatic_variants_file %s", somaticVcf));
lilacArgs.append(" -max_elim_candidates 500");
lilacArgs.append(String.format(" -threads %s", Bash.allCpus()));
commands.addCommand(() -> format("java -Xmx%s -jar %s/%s %s", MAX_HEAP, VmDirectories.TOOLS, LILAC_JAR, lilacArgs.toString()));
// and a tumor-only run
String tumorOutputDir = String.format("%s/%s/tumor", VmDirectories.OUTPUT, sampleId);
commands.addCommand(() -> format("mkdir -p %s", tumorOutputDir));
StringBuilder tumorLilacArgs = new StringBuilder();
tumorLilacArgs.append(String.format(" -sample %s", sampleId));
tumorLilacArgs.append(String.format(" -resource_dir %s", VmDirectories.INPUT));
tumorLilacArgs.append(String.format(" -ref_genome %s", resourceFiles.refGenomeFile()));
tumorLilacArgs.append(String.format(" -reference_bam %s", tumorAlignment));
tumorLilacArgs.append(" -run_id TUMOR");
lilacArgs.append(" -max_elim_candidates 500");
tumorLilacArgs.append(String.format(" -output_dir %s", tumorOutputDir));
tumorLilacArgs.append(String.format(" -threads %s", Bash.allCpus()));
commands.addCommand(() -> format("java -Xmx%s -jar %s/%s %s", MAX_HEAP, VmDirectories.TOOLS, LILAC_JAR, tumorLilacArgs.toString()));
String sampleRemoteOutputDir = String.format("gs://%s/%s/", LILAC_BATCH_BUCKET, runDirectory);
commands.addCommand(() -> format("gsutil -m cp -r %s/%s/ %s", VmDirectories.OUTPUT, sampleId, sampleRemoteOutputDir));
}
use of com.hartwig.pipeline.resource.ResourceFiles 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;
}
use of com.hartwig.pipeline.resource.ResourceFiles in project pipeline5 by hartwigmedical.
the class AmberRerun method execute.
@Override
public VirtualMachineJobDefinition execute(final InputBundle inputs, final RuntimeBucket runtimeBucket, final BashStartupScript commands, final RuntimeFiles executionFlags) {
// Inputs
final String set = inputs.get("set").inputValue();
final String tumorSampleName = inputs.get("tumor_sample").inputValue();
final String referenceSampleName = inputs.get("ref_sample").inputValue();
final InputFileDescriptor remoteTumorFile = inputs.get("tumor_cram");
final InputFileDescriptor remoteReferenceFile = inputs.get("ref_cram");
final InputFileDescriptor remoteTumorIndex = remoteTumorFile.index();
final InputFileDescriptor remoteReferenceIndex = remoteReferenceFile.index();
final String localTumorFile = localFilename(remoteTumorFile);
final String localReferenceFile = localFilename(remoteReferenceFile);
// Download tumor
commands.addCommand(() -> remoteTumorFile.toCommandForm(localTumorFile));
commands.addCommand(() -> remoteTumorIndex.toCommandForm(localFilename(remoteTumorIndex)));
// Download normal
commands.addCommand(() -> remoteReferenceFile.toCommandForm(localReferenceFile));
commands.addCommand(() -> remoteReferenceIndex.toCommandForm(localFilename(remoteReferenceIndex)));
final ResourceFiles resourceFiles = ResourceFilesFactory.buildResourceFiles(RefGenomeVersion.V37);
commands.addCommand(() -> AmberCommandBuilder.newBuilder(resourceFiles).reference(referenceSampleName, localReferenceFile).tumor(tumorSampleName, localTumorFile).build().asBash());
// Store output
final GoogleStorageLocation archiveStorageLocation = amberArchiveDirectory(set);
commands.addCommand(new CopyLogToOutput(executionFlags.log(), "run.log"));
commands.addCommand(new OutputUpload(archiveStorageLocation));
return VirtualMachineJobDefinition.amber(commands, ResultsDirectory.defaultDirectory());
}
Aggregations