@Ryan, thanks for code and effort, I really do appreciate it, but firstly I really don't think GTF format is the problem..I think Ensembl does follow GFT file standards. Secondly though what are the standards ..? We sort of had this discussion previously here A: Ensemble GTF format: isn't the tag "transcript_id" mandatory?. I've been doing a bit of research and here are the most common sites that people refer to as GFF/GTF specifications..
- http://www.sanger.ac.uk/resources/software/gff/spec.html
- http://mblab.wustl.edu/GTF2.html
- https://genome.ucsc.edu/FAQ/FAQformat.html#format3
- http://www.sequenceontology.org/gff3.shtml
- http://www.gencodegenes.org/gencodeformat.html
- http://asia.ensembl.org/info/website/upload/gff.html?redirect=no
From what I understand the only major difference between GFF 1,2,3 and GTF is the 9th column formatting. The tag and value pairs. It worth to mention that features type can also differ (but I don't think its that important at all. I actually never have seen start and stop _codon features). According to Sanger site tag names can be *Tags must be standard identifiers ([A-Za-z][A-Za-z0-9_]*). *My understanding that means any text, at least for GFF3 format... Whereas according to GENCODE there are pre-defined number of tag that you must have, that's for GTF only format.
I've noticed that Ensembl had only released GFF3 format in the latest release (that is release 81). I looked back a few releases and they have only ever released GTF files until now.
The reason I'm writing it all out here is because GFF/GTF files are pain in the back work with, but unavoidable.. You did mention once before about writing to GA4GH in order to standardise the format. I'm all for it.
I git cloned your code snippet, but it doesn't work. Here is the command I'm running
python make-gtf-db.py ~/ref-files/Mammalian/Mus_musculus/Mus_musculus.GRCm38.80.gtf t.db
Here is the error I'm getting
Traceback (most recent call last):
File "make-gtf-db.py", line 111, in <module>
force=args.force,
TypeError: create_db() got an unexpected keyword argument 'disable_infer_genes'
I don't know if I can do that, but if i comment out lines 100 and 101 (because both cause the error) the script runs for 10-15 minutes fine (I actually see t.db file grows in size very quickly to 1.4 Gb, but then it seats at this forever
2015-07-31 08:58:05,082 - INFO - Committing changes: 1524000 features
2015-07-31 08:58:10,510 - INFO - Populating features table and first-order relations: 1524099 features
2015-07-31 08:58:10,510 - INFO - Creating relations(parent) index
2015-07-31 08:58:41,345 - INFO - Creating relations(child) index
2015-07-31 08:59:12,226 - INFO - Inferring gene and transcript extents, and writing to tempfile
2015-07-31 09:01:49,873 - INFO - Importing inferred features into db
0 of 433220 (0%)
Ultimate goal for me is to have one reliable annotation format that I can easily parse and get what I need. Right now I need to parse GFF such that I need to grab all features that belong to a gene and kinder do some quick calculations and merging of different exons.. My script works ok, but I'd much rather utilise gffutils tool. I really like database idea central to gffutils..
Here are a couple of some what related link for others reference on the GFF/GTF matter:
- Yet another randomly formatted GFF file A: RNASeqQC - Low number of genes detected on run
- Good discussion about large GFF files and how to get quick feature access Light-Weight Script-Based Random Access To Large Gff3 Files Using Biopython
It really shouldn't take longer than an hour. For example, database creation for the full human GENCODE GTF takes 20 mins.
Can you post a link to the file(s) you're using?
@Ryan you can pull exact files from here http://bioinformatics.erc.monash.edu/home/kirill/check/Mus_musculus.GRCm38.81.gff3
http://bioinformatics.erc.monash.edu/home/kirill/check/Mus_musculus.GRCm38.81.gff3
I actually got those files from Ensembl ftp://ftp.ensembl.org/pub/release-81/gtf/mus_musculus/
Thanks
P.S Those links are temporal. I'll remove at some point
@Ryan just a quick update. So database file generation have been running for about 5-6 hours now and hasn't finished yet. The current database file is ~ 150 Mb. I think database file roughly is the double of the original gff. (It was the case with previous gff's I tried). If this the case then original gff is 250 Mb I then expect db file aroung 500 Mb. Still long way to go.. I'll way until tomorrow morning and might kill it then. Either way if gtf/gff file is Gb in size at this rate it'll be too long to make db file.
Thanks