I'd like to find all of the PL indices in a VCF line for a specific allele at sites with an arbitrary number of alleles and arbitrary sample ploidy. For dipolid samples, the algorithm is straightforward, but things get more complicated for plodies 3 and above. The related question of finding the PL index given a genotype already has a nice algorithm http://gatkforums.broadinstitute.org/gatk/discussion/2157/gatk-vcf-pl-field-ordering-for-pooled-polyploid-samples.
I already have some code to do this (see below), but it's not very elegant. Does anyone have a better algorithm?
1 answer
I was able to come up with a solution and I have updated the gist with a recursive function, non-recursive function and profiling of the results. I am posting here in case anyone finds the code useful.
Now only if I could figure out how to embed the gist...
Log in to answer this question.