Heads up:
We’re moving the GATK website, docs and forum to a new platform. Read the full story and breakdown of key changes on this blog.
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.

How to get nonvariant sites without the ref N sites.

I'm trying to get a vcf with the invariant sites i.e. select out ONLY the homozygous references sites in a multi-sample vcf (samples are either all 0/0 or a mix of 0/0 and ./.). I do not want the sites where the reference is N or all the sites are ./. (before filtering)

Is the only way to do this:
VariantFiltration with a filter QUAL > -1 (to remove the reference N sites)
Then
selectVariants with --selectTypeToInclude NO_VARIATION

Best Answer

  • prepagamprepagam
    Accepted Answer

    Thanks for that - I hadn't know of VcfFilter. I was kind of hoping for a GaTK solution.
    I had assumed I needed to do this in the variant filtration step, but I did find in SelectVariants just now
    --maxNOCALLfraction
    And I can use that I think.

Answers

  • lindenblindenb FranceMember ✭✭

    using vcffilterjdk ( http://lindenb.github.io/jvarkit/VcfFilterJdk.html ) , the following expression should work:

     java -jar dist/vcffilterjdk.jar  -e 'return !variant.getReference().getDisplayString().equals("N") && !variant.getGenotypes().stream().anyMatch(G->G.getAlleles().stream().anyMatch(A->A.isCalled() && !A.isReference())) && variant.getGenotypes().stream().anyMatch(G->G.getAlleles().stream().anyMatch(A->A.isReference())); '  input.vcf
    
  • prepagamprepagam Member
    Accepted Answer

    Thanks for that - I hadn't know of VcfFilter. I was kind of hoping for a GaTK solution.
    I had assumed I needed to do this in the variant filtration step, but I did find in SelectVariants just now
    --maxNOCALLfraction
    And I can use that I think.

  • SheilaSheila Broad InstituteMember, Broadie admin

    @prepagam
    Hi,

    I think you can use SelectVariants with --excludeNonVariants. That will only output the sites which have variants. Then, you can use --discordance with that VCF against the original to get the sites with no variants.

    I hope that helps. I just tested it on a one sample VCF, and it seems to work. I hope it works on multi-sample VCFs too :smiley:

    -Sheila

Sign In or Register to comment.