Notice:
If you happen to see a question you know the answer to, please do chime in and help your fellow community members. We encourage our fourm members to be more involved, jump in and help out your fellow researchers with their questions. GATK forum is a community forum and helping each other with using GATK tools and research is the cornerstone of our success as a genomics research community.We appreciate your help!

Test-drive the GATK tools and Best Practices pipelines on Terra


Check out this blog post to learn how you can get started with GATK and try out the pipelines in preconfigured workspaces (with a user-friendly interface!) without having to install anything.
Attention:
We will be out of the office on November 11th and 13th 2019, due to the U.S. holiday(Veteran's day) and due to a team event(Nov 13th). We will return to monitoring the GATK forum on November 12th and 14th respectively. Thank you for your patience.

VariantFiltration of 1/1 only

Hi,

I'm trying to use VariantFiltration to keep only SNPs with a 1/1 genotype

GenomeAnalysisTK -T VariantFiltration -R dm6.fa \
--variant H001.UniGenotyper.SNP.vcf \
--genotypeFilterExpression 'isHomVar==1' \
--genotypeFilterName "KeepHomVar" \
-o H001.homVar.SNP.vcf

The GATK log states:
INFO 14:27:26,801 HelpFormatter - Program Args: -T VariantFiltration -R /mnt/lustre/scratch/bioenv/wg39/LHm_analysis/reference_sequences/dmel/v6.0/dm6.fa --variant H001.UniGenotyper.SNP.vcf --genotypeFilterExpression isHomVar==1

However, both heterozygous and homozygous-variant SNPs are still outputted to the resulting vcf file.

Could you help me correct this ? I'm guessing it's that the filter expression is not correct but I've tried a few alternatives to no avail.

Cheers,

Blue

Best Answer

Answers

  • BlueBlue Member

    Solution using bash instead of GATK:

    keep only homozygous non-reference genotypes, and annotation lines.

    for i in $(ls *.UniGenotyper.SNP.vcf)
    do
    grep -E '1/1|#' $i > ${i//UniGenotyper.SNP.vcf/UG.SNP.11.vcf}
    done;

    # convert to table using gatk

    for j in *.UG.SNP.11.vcf
    do
    GenomeAnalysisTK \
    -R dm6.fa \
    -T VariantsToTable \
    -V $j \
    -F CHROM -F POS -F ID -F QUAL -F DP \
    -o ${j//.vcf/.tb}
    done;

Sign In or Register to comment.