|
| 1 | +version 1.0 |
| 2 | + |
| 3 | +struct RuntimeAttr { |
| 4 | + Float? mem_gb |
| 5 | + Int? cpu_cores |
| 6 | + Int? disk_gb |
| 7 | + Int? preemptible_tries |
| 8 | + Int? max_retries |
| 9 | +} |
| 10 | + |
| 11 | +workflow MitoPostProcessing { |
| 12 | + meta { |
| 13 | + description: "Runs mito post-processing from the cleaned notebook: exports filtered VCF, sample metadata TSV, and all generated plots as SVG." |
| 14 | + allowNestedInputs: true |
| 15 | + } |
| 16 | + |
| 17 | + input { |
| 18 | + String output_path |
| 19 | + String input_path |
| 20 | + String output_base |
| 21 | + |
| 22 | + String hail_docker = "us.gcr.io/broad-gotc-prod/aou_mitochondria_post:0.0.5" |
| 23 | + RuntimeAttr? runtime_attr_override |
| 24 | + } |
| 25 | + |
| 26 | + String pipeline_version = "aou_9.0.0" |
| 27 | + |
| 28 | + call RunMitoPostProcessing { |
| 29 | + input: |
| 30 | + output_path = output_path, |
| 31 | + input_path = input_path, |
| 32 | + output_base = output_base, |
| 33 | + hail_docker = hail_docker, |
| 34 | + runtime_attr_override = runtime_attr_override |
| 35 | + } |
| 36 | +
|
| 37 | + output { |
| 38 | + File filtered_vcf = RunMitoPostProcessing.filtered_vcf |
| 39 | + File filtered_vcf_tbi = RunMitoPostProcessing.filtered_vcf_tbi |
| 40 | + File sample_metadata_tsv = RunMitoPostProcessing.sample_metadata_tsv |
| 41 | + |
| 42 | + File variants_per_sample_svg = RunMitoPostProcessing.variants_per_sample_svg |
| 43 | + File mito_cn_distribution_svg = RunMitoPostProcessing.mito_cn_distribution_svg |
| 44 | + File variant_allele_frequency_svg = RunMitoPostProcessing.variant_allele_frequency_svg |
| 45 | + File variant_af_and_allele_fraction_svg = RunMitoPostProcessing.variant_af_and_allele_fraction_svg |
| 46 | + File numt_fp_by_mtcn_svg = RunMitoPostProcessing.numt_fp_by_mtcn_svg |
| 47 | + File haplogroup_heteroplasmy_svg = RunMitoPostProcessing.haplogroup_heteroplasmy_svg |
| 48 | + File haplogroup_homoplasmy_svg = RunMitoPostProcessing.haplogroup_homoplasmy_svg |
| 49 | + } |
| 50 | +} |
| 51 | + |
| 52 | +task RunMitoPostProcessing { |
| 53 | + input { |
| 54 | + String output_path |
| 55 | + String input_path |
| 56 | + String output_base |
| 57 | + |
| 58 | + String hail_docker |
| 59 | + RuntimeAttr? runtime_attr_override |
| 60 | + } |
| 61 | + |
| 62 | + RuntimeAttr runtime_default = object { |
| 63 | + mem_gb: 32, |
| 64 | + disk_gb: 200, |
| 65 | + cpu_cores: 8, |
| 66 | + preemptible_tries: 0, |
| 67 | + max_retries: 1 |
| 68 | + } |
| 69 | + RuntimeAttr runtime_override = select_first([runtime_attr_override, runtime_default]) |
| 70 | + |
| 71 | + command <<< |
| 72 | + set -euo pipefail |
| 73 | +
|
| 74 | + python3 /opt/mito_plot_filter.py \ |
| 75 | + --input-path "~{input_path}" \ |
| 76 | + --output-path "~{output_path}" \ |
| 77 | + --output-base "~{output_base}" |
| 78 | + >>> |
| 79 | + |
| 80 | + output { |
| 81 | + File filtered_vcf = "~{output_base}.vcf.bgz" |
| 82 | + File filtered_vcf_tbi = "~{output_base}.vcf.bgz.tbi" |
| 83 | + File sample_metadata_tsv = "~{output_base}_metadata.tsv" |
| 84 | + |
| 85 | + File variants_per_sample_svg = "~{output_base}.variants_per_sample.svg" |
| 86 | + File mito_cn_distribution_svg = "~{output_base}.mito_cn_distribution.svg" |
| 87 | + File variant_allele_frequency_svg = "~{output_base}.variant_allele_frequency.svg" |
| 88 | + File variant_af_and_allele_fraction_svg = "~{output_base}.variant_af_and_allele_fraction.svg" |
| 89 | + File numt_fp_by_mtcn_svg = "~{output_base}.numt_fp_by_mtcn.svg" |
| 90 | + File haplogroup_heteroplasmy_svg = "~{output_base}.haplogroup_heteroplasmy.svg" |
| 91 | + File haplogroup_homoplasmy_svg = "~{output_base}.haplogroup_homoplasmy.svg" |
| 92 | + } |
| 93 | + |
| 94 | + runtime { |
| 95 | + memory: select_first([runtime_override.mem_gb, runtime_default.mem_gb]) + " GB" |
| 96 | + disks: "local-disk " + select_first([runtime_override.disk_gb, runtime_default.disk_gb]) + " SSD" |
| 97 | + cpu: select_first([runtime_override.cpu_cores, runtime_default.cpu_cores]) |
| 98 | + preemptible: select_first([runtime_override.preemptible_tries, runtime_default.preemptible_tries]) |
| 99 | + maxRetries: select_first([runtime_override.max_retries, runtime_default.max_retries]) |
| 100 | + docker: hail_docker |
| 101 | + } |
| 102 | +} |
0 commit comments