Bug Bulletin: The recent 3.2 release fixes many issues. If you run into a problem, please try the latest version before posting a bug report, as your problem may already have been solved.

variantFiltration using PL numbers on multisample VCF file

vplagnolvplagnol Posts: 47Member

Dear all,

I want to use GATK to filter a multisample VCF based on the PL numbers but I cannot figure out how to do this. I want to flag genotypes that are likely to be homozygous reference (with the aim of removing these eventually). I would like to look at the PL field and if the first PL number (which refers to the probability of a homozygous reference call) is 10 or less, flag these genotypes.

The variant Filtration page is quite helpful and suggests accessing arrays using things like: 'vc.getGenotype("NA12878").getAD().0 > 10'

but this is not quite what I want, as I want the filtering to be genotype based (not variant based) and I don't want to base the filtering on a single sample but on each sample separately. Basically I am looking for something like this:

--genotypeFilterExpression "PL.0 > 10"

where PL/0 is the first number of the PL array. I cannot figure out anywhere a way to do this. Can someone suggest a recipe to achieve this?

Thank you in advance.

Best Answer

Answers

  • Geraldine_VdAuweraGeraldine_VdAuwera Posts: 5,902Administrator, GATK Developer admin

    Hi Vincent,

    I don't think we've run into this use case before, so I'm not sure this is actually possible. We're planning to put together a "cookbook" of filtering expressions, so I'll put this on the list of requested use cases. But in the meantime I'm afraid you'll need to experiment on your own, unless someone in the community can jump in with an idea.

    Geraldine Van der Auwera, PhD

  • pdexheimerpdexheimer Posts: 327Member, GSA Collaborator ✭✭✭

    This is not something I've tested myself, but the Genotype class does include a getPL() method that's analogous to getAD(). So a very minor modification of the example you found should work: vc.getGenotype("NA12878").getPL().0 > 10.

    Note that this is at the genotype, not variant, level. You have direct access to the variant (via 'vc'), and can then look up each individual genotype separately through the getGenotype() method

  • vplagnolvplagnol Posts: 47Member

    Thank you both.

    pdxheimer's solution looks close to what I want but I am probably missing something obvious, I apologize in advance. How do I apply the same line of command not on a specific sample (like "NA12878") but instead for each sample to every relevant entry my VCF (something like vc.getGenotype(currentSample) or something like this).

    Geraldine: I suspect my query has been addressed before but I don't know where to look. I am looking for the Proba( genotype != homozygous reference), because I don't want to filter out PL fields like 100,3,0 (for which, if I am not mistaken, GQ is 3). In other words, as long as it is not reference homozygous I am interested. Seems generic enough, but I could not find it.

Sign In or Register to comment.