I am trying to create a dataframe from a vcf file including just some elements from INFO field. The problem is that values of those elemnts are not always in the same position, so when I load the VCF and split INFO field, I get those specific elements in different columns.
For example:
Pos Score Strand Length
CIPOS=0 SCORE=1 STRAND=+ LEN=634
SCORE=89 STRAND=- LEN=567 UTR=+
CIPOS=9 SCORE=1 STRAND=+ LEN=0
CIPOS=8 SCORE=1 STRAND=+ LEN=1
STRAND=+ LEN=555 UTR=+ B
As you can see, some rows are shifted, because there is no symbol in the vcf for the absence of some INFO element, and the field info is readed as a string, so when splitting I don't know how to tell R to write an NA in the corresponding row of each column.
Is there any way to write each "SCORE=" value in Score column, each "STRAND=" value in Strand column, etc?
Thanks in advance!