Skip to content

Commit

Permalink
Refactor extract_info.wdl to use filter_vcf.py for variant filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-imcm committed Apr 12, 2024
1 parent 33777f9 commit e7ef90e
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions workflows/tasks/extract_info.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ task extract {
bcftools view --regions-file ${chr}_query_subset_variants_list.txt ${chr}.dose.vcf.gz > ~{prefix}_${chr}_query_subset.vcf
fi
if [ "~{match_pos_only}" = "false" ]; then
bcftools query -f '%CHROM\t%POS\t%REF\t%ALT\n' ~{prefix}_${chr}_query_subset.vcf > variants.txt
awk 'BEGIN {FS="\t"} NR==FNR{a[$1,$2,$4,$5]; next} ($1,$2,$3,$4) in a {print}' ${chr}_query_subset_variants_list.txt variants.txt > matched_variants.txt
bcftools view -T matched_variants.txt ~{prefix}_${chr}_query_subset.vcf -Ov -o ~{prefix}_${chr}_query_matched_alleles_subset.vcf
python3 /scripts/filter_vcf.py --query ${chr}_query_subset_variants_list.txt --vcf ~{prefix}_${chr}_query_subset.vcf --out ~{prefix}_${chr}_query_matched_alleles_subset
VCF_FILES="${VCF_FILES} ~{prefix}_${chr}_query_matched_alleles_subset.vcf"
else
VCF_FILES="${VCF_FILES} ~{prefix}_${chr}_query_subset.vcf"
Expand All @@ -51,9 +49,9 @@ task extract {

if [ "~{use_GT_from_PED}" = "true" ]; then
plink2 --vcf ~{prefix}_query_extracted.vcf --recode compound-genotypes --out ~{prefix}_query_extracted
python3 /scripts/extract_vcf_info.py --vcf ~{prefix}_query_extracted.vcf --out ~{prefix}_extracted --extract ~{extract_item} --ped ~{prefix}_query_extracted.ped --vars ~{query_variants}
python3 /scripts/extract_vcf_info.py --vcf ~{prefix}_query_extracted.vcf --out ~{prefix}_extracted --extract ~{extract_item} --ped ~{prefix}_query_extracted.ped
else
python3 /scripts/extract_vcf_info.py --vcf ~{prefix}_query_extracted.vcf --out ~{prefix}_extracted --extract ~{extract_item} --vars ~{query_variants}
python3 /scripts/extract_vcf_info.py --vcf ~{prefix}_query_extracted.vcf --out ~{prefix}_extracted --extract ~{extract_item}
fi
>>>

Expand Down

0 comments on commit e7ef90e

Please sign in to comment.