vcfR
vcfR copied to clipboard
plans for helper functions?
Are there any plans for getting/setting of META, INFO and FORMAT (sub)fields?
Use cases:
- [ ] extract AF field from INFO
- [ ] add genotype to FORMAT field
- [ ] add AF to a fresh or already existing FORMAT field
- [ ] add meta field for .e.g. FORMAT:AF
Helper functions would be beneficial because some extra checking could be implemented to avoid potential breaking of VCF file definitions.
Hi Roman,
For your first bullet we have the following.
library(vcfR)
data("vcfR_test")
extract.info(vcfR_test, element = "AF")
In regards to adding the GT, my understanding of the specification is that if there is anything in the GT section it must include GT. So if you're adding GT I would think that the gt slot is empty.
I do not have anything or any plans for the last two. Although, the meta slot is simply a vector. But I can see an argument in creating helper functions to provide some checking. And that goes for your first two as well.
Are you offering to put together a PR? Or shall we just leave this open until I or someone else gets to it?
Thanks!
For manipulating the gt slot I've also created this.
https://knausb.github.io/vcfR_documentation/dip_to_hap.html
Which, again, an argument could be made that I'm asking a bit from the user.
Those extract functions are indeed handy. Thank you for pointing them out. I'll think about how to best implement this and get back in a while.