I would like to analyse the content of a GTF file. I am quite able with R and dplyr, so I would like to transform my GTF file into a data frame to facilitate my analysis. Does anybody know of any tool to do this?
I forgot to specify the tab delimiter in the read.table() function. I thought that it was the default but it isn't.
The answer of cpad0112 is much better though because with his way, all the meta information of the 9th column is put in separate columns whereas with my way, all the meta information is all in one column.
I don't like how rtracklayer::import seems to be finicky about gtf format, so here's a solution that uses base R v.4.0.0 and tidyverse v.1.3.1 to read in a gtf file as a tibble. It's a little slow, but it properly parses the attribute column in cases where the number and types of attributes are inconsistent between features. It also handles the annoying cases when the attribute field separator (;) is found in quoted attribute strings (as in this gtf file for Aeropyrum pernix).