Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

to split vcf #465

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions wdl/tasks/Utility/split_vcf.wdl
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
version 1.0

workflow SplitVCFWorkflow {
input {
File joint_vcf
Array[String] regions
Array[String] sample_names
}

scatter (region in regions) {
scatter (samplename in sample_names) {
call SplitVCFbySample {
input:
joint_vcf = joint_vcf,
region = region,
sample_name = samplename
}
}
}

output {
Array[File] single_sample_vcfs = flatten(SplitVCFbySample.single_sample_vcf)
Array[File] single_sample_vcf_tbis = flatten(SplitVCFbySample.single_sample_vcf_tbi)
}
}

task SplitVCFbySample {
input {
File joint_vcf
String region
String sample_name
}

command <<<
set -euxo pipefail

bcftools index ${joint_vcf}

bcftools view -s ${sample_name} ${joint_vcf} -r ${region} -o ${sample_name}.subset.g.vcf.gz

tabix -p vcf ${sample_name}.subset.g.vcf.gz
>>>

output {
File single_sample_vcf = "${sample_name}.subset.g.vcf.gz"
File single_sample_vcf_tbi = "${sample_name}.subset.g.vcf.gz.tbi"
}

runtime {
cpu: 1
memory: "64 GiB"
disks: "local-disk ${disk_size} HDD"
bootDiskSizeGb: 10
preemptible: 0
maxRetries: 1
docker: "us.gcr.io/broad-dsp-lrma/lr-basic:0.1.1"
}

Int disk_size = ceil(2 * size(joint_vcf, "GiB")) + 1
}
Loading