@Dan Gaston:
This answer works well for one of the problem I have.
But, if say there is a PG field in FORMAT and it corresponding values in SAMPLE field. And, this PG isn't represented in everyline of the vcf how do I capture format(sample['PG']
I am getting following error:
AttributeError: 'CallData' object has no attribute 'PI'
How, do I invoke an exception and force the PI value to be period '.' when PI tag is missing?
You're not giving us much to work with. What genotypes? Why do you want the genotypes?
Thanks Zev,
It is my fault I did not say clearly what I want to do.
For example, I have get my vcf file is
I want to get a file like as:
Thanks,
Fuyou
Thank you everybody.
It is my fault I did not say clearly what I want to do.
For example, I have get my vcf file is
I want to get a file like as:
Thanks,
Fuyou
It is better if you include this as an Update to your original post and not add it as an answer (you can hit the edit button to edit your original post and add to the bottom, typically after putting in that it is an Update that follows). All you are doing is stripping out some fields. You can use linux tools to cut out columns from tabular data. Any of the programming options I mentioned in my post will also let you do this by iterating over the VCF records and only outputting the desired fields to a new output file.
Thank you very much!
If my answer solves your problem please upvote and accept as the answer. Much appreciated