Skip to content

Commit

Permalink
Making the Vapor plots optional to store as a final output (#692)
Browse files Browse the repository at this point in the history
* added boolean and modified output of plots to be optional and output only if the boolean is true

* changed boolean name, modified output to be NONE_FILE if set to false

* tried to change optional files output format

* try to address checking issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* address issue

* modified jsons

* made edits based on review

* made edits based on review
  • Loading branch information
kirtanav98 committed Jul 3, 2024
1 parent dc88507 commit 7e7f2f7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
1 change: 1 addition & 0 deletions inputs/templates/test/Vapor/Vapor.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"Vapor.ref_fasta" : {{ reference_resources.reference_fasta | tojson }},
"Vapor.ref_fai" : {{ reference_resources.reference_index | tojson }},
"Vapor.ref_dict": {{ reference_resources.reference_dict | tojson }},
"Vapor.save_plots": "false",

"Vapor.prefix": {{ test_batch.example_pacbio_sample_id | tojson }},
"Vapor.sample_id": {{ test_batch.example_pacbio_sample_id | tojson }},
Expand Down
1 change: 1 addition & 0 deletions inputs/templates/test/Vapor/VaporBatch.json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"VaporBatch.ref_fasta" : {{ reference_resources.reference_fasta | tojson }},
"VaporBatch.ref_fai" : {{ reference_resources.reference_index | tojson }},
"VaporBatch.ref_dict": {{ reference_resources.reference_dict | tojson }},
"VaporBatch.save_plots": "false",

"VaporBatch.samples": {{ test_batch.pacbio_samples | tojson }},
"VaporBatch.bam_or_cram_files": {{ test_batch.pacbio_crams | tojson }},
Expand Down
30 changes: 17 additions & 13 deletions wdl/Vapor.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ workflow Vapor {
File bed_file
String sample_id

Boolean save_plots # Control whether plots are final output
File ref_fasta
File ref_fai
File ref_dict
Expand All @@ -20,15 +22,17 @@ workflow Vapor {
String sv_base_mini_docker
String sv_pipeline_docker

RuntimeAttr? runtime_attr_vapor
RuntimeAttr? runtime_attr_vapor
RuntimeAttr? runtime_attr_bcf2vcf
RuntimeAttr? runtime_attr_vcf2bed
RuntimeAttr? runtime_attr_split_vcf
RuntimeAttr? runtime_attr_concat_beds
RuntimeAttr? runtime_attr_LocalizeCram
File? NONE_FILE_ # Create a null file - do not use this input
}
scatter ( contig in read_lines(contigs) ) {
scatter (contig in read_lines(contigs)) {

call tasks10.PreprocessBedForVapor {
input:
Expand Down Expand Up @@ -57,16 +61,16 @@ workflow Vapor {
call tasks10.ConcatVapor {
input:
shard_bed_files=RunVaporWithCram.vapor,
shard_plots=RunVaporWithCram.vapor_plot,
prefix=prefix,
sv_base_mini_docker=sv_base_mini_docker,
runtime_attr_override=runtime_attr_concat_beds
shard_bed_files = RunVaporWithCram.vapor,
shard_plots = RunVaporWithCram.vapor_plot,
prefix = prefix,
sv_base_mini_docker = sv_base_mini_docker,
runtime_attr_override = runtime_attr_concat_beds
}
output {
File vapor_bed = ConcatVapor.merged_bed_file
File vapor_plots = ConcatVapor.merged_bed_plot
File? vapor_plots = if save_plots then ConcatVapor.merged_bed_plot else NONE_FILE_
}
}

Expand All @@ -85,8 +89,8 @@ task RunVaporWithCram {
}
RuntimeAttr default_attr = object {
cpu_cores: 1,
mem_gb: 15,
cpu_cores: 1,
mem_gb: 15,
disk_gb: 30,
boot_disk_gb: 10,
preemptible_tries: 3,
Expand All @@ -107,8 +111,8 @@ task RunVaporWithCram {
export GCS_OAUTH_TOKEN=`gcloud auth application-default print-access-token`
samtools view -h -T ~{ref_fasta} -o ~{contig}.bam ~{bam_or_cram_file} ~{contig}
samtools index ~{contig}.bam
#run vapor

# run vapor
mkdir ~{prefix}.~{contig}

vapor bed \
Expand All @@ -120,7 +124,7 @@ task RunVaporWithCram {
--pacbio-input ~{contig}.bam

tar -czf ~{prefix}.~{contig}.tar.gz ~{prefix}.~{contig}
bgzip ~{prefix}.~{contig}.vapor
bgzip ~{prefix}.~{contig}.vapor
>>>
runtime {
cpu: select_first([runtime_attr.cpu_cores, default_attr.cpu_cores])
Expand Down
5 changes: 4 additions & 1 deletion wdl/VaporBatch.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ workflow VaporBatch {
String sv_base_mini_docker
String sv_pipeline_docker

Boolean save_plots

RuntimeAttr? runtime_attr_vapor
RuntimeAttr? runtime_attr_bcf2vcf
RuntimeAttr? runtime_attr_vcf2bed
Expand All @@ -38,6 +40,7 @@ workflow VaporBatch {
ref_fai = ref_fai,
ref_dict = ref_dict,
contigs = contigs,
save_plots = save_plots,
vapor_docker = vapor_docker,
sv_base_mini_docker = sv_base_mini_docker,
sv_pipeline_docker = sv_pipeline_docker,
Expand All @@ -50,7 +53,7 @@ workflow VaporBatch {
}
output {
Array[File] vapor_batch_beds = Vapor.vapor_bed
Array[File] vapor_batch_plots = Vapor.vapor_plots
Array[File?] vapor_batch_plots = Vapor.vapor_plots
}
}

Expand Down

0 comments on commit 7e7f2f7

Please sign in to comment.