Skip to content

Instantly share code, notes, and snippets.

@Roboronnie
Created December 12, 2020 01:13
Show Gist options
  • Save Roboronnie/9184ed523cc964675e31aa85f7272e73 to your computer and use it in GitHub Desktop.
Save Roboronnie/9184ed523cc964675e31aa85f7272e73 to your computer and use it in GitHub Desktop.
miniwdl run vcf_chrom_count.wdl \
  vcf_gz=https://ftp-trace.ncbi.nlm.nih.gov/ReferenceSamples/giab/release/NA12878_HG001/latest/GRCh38/HG001_GRCh38_GIAB_highconf_CG-IllFB-IllGATKHC-Ion-10X-SOLID_CHROM1-X_v.3.3.2_highconf_PGandRTGphasetransfer.vcf.gz \
  tbi=https://ftp-trace.ncbi.nlm.nih.gov/ReferenceSamples/giab/release/NA12878_HG001/latest/GRCh38/HG001_GRCh38_GIAB_highconf_CG-IllFB-IllGATKHC-Ion-10X-SOLID_CHROM1-X_v.3.3.2_highconf_PGandRTGphasetransfer.vcf.gz.tbi \
  --verbose
version 1.0
workflow vcf_chrom_counter {
input {
File vcf_gz
File tbi
Int num_chrom = 22
}
scatter (i in range(num_chrom)) {
String chrom = "chr~{i+1}"
call tabix_count {
input:
vcf_gz = vcf_gz, tbi = tbi,
region = chrom
}
}
output {
Array[Pair[String,Int]] counts = zip(chrom, tabix_count.count)
}
}
task tabix_count {
input {
File vcf_gz
File tbi
String? region
}
command <<<
tabix "~{vcf_gz}" "~{region}" | wc -l
>>>
output {
Int count = read_int(stdout())
}
runtime {
docker: "biocontainers/tabix:v1.9-11-deb_cv1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment