BP_GENBANK2GFF3(1p)
π NAME π
bp_genbank2gff3.pl β bestie, it's the Genbank β gbrowse-friendly GFF3 glow-up tool. (Yes, this is the 1p manual, she's a Perl script and she's iconic.) π§¬β¨
πΈ SYNOPSIS πΈ
bp_genbank2gff3.pl [options] filename(s)
# process a directory containing GenBank flatfiles
perl bp_genbank2gff3.pl --dir path_to_files --zip
# process a single file, ignore explicit exons and introns
perl bp_genbank2gff3.pl --filter exon --filter intron file.gbk.gz
# process a list of files
perl bp_genbank2gff3.pl *gbk.gz
# process data from URL, with Chado GFF model (-noCDS), and pipe to database loader
curl ftp://ftp.ncbi.nih.gov/genomes/Saccharomyces_cerevisiae/CHR_X/NC_001142.gbk \
| perl bp_genbank2gff3.pl -noCDS -in stdin -out stdout \
| perl gmod_bulk_load_gff3.pl -dbname mychado -organism fromdata
β¨ Options: β¨
okay so here's the whole menu, no skips, no gatekeeping π
--noinfer,-rβ don't infer exon/mRNA subfeatures. She just takes things at face value, periodt.--conf,-iβ path to the curation configuration file that contains user preferences for Genbank entries (must be YAML format). (if--manualis passed without--ini, user will be prompted to create the file if any manual input is saved)--sofile,-lβ path to to the so.obo file to use for feature type mapping. (--sofile livewill download the latest online revision β yes, live, like a livestream π«Ά)--manual,-mβ when trying to guess the proper SO term, if more than one option matches the primary tag, the converter will wait for user input to choose the correct one. (only works with--sofile)--dir,-dβ path to a list of genbank flatfiles π--outdir,-oβ location to write GFF files (can be'stdout'or'-'for pipe)--zip,-zβ compress GFF3 output files with gzip ποΈ--summary,-sβ print a summary of the features in each contig--filter,-xβ genbank feature type(s) to ignore π--split,-yβ split output to separate GFF and fasta files for each genbank record--nolump,-nβ separate file for each reference sequence (default is to lump all records together into one output file for each input file)--ethresh,-eβ error threshold for unflattener. set this high (>2) to ignore all unflattener errors--[no]CDS,-cβ Keep CDS-exons, or convert to alternate gene-RNA-protein-exon model.--CDSis default. Use--CDSto keep default GFF gene model, use--noCDSto convert to g-r-p-e.--format,-fβ Input format (SeqIO types):GenBank,SwissorUniprot,EMBLwork (GenBank is default)--GFF_VERSIONβ3is default,2and2.5and otherBio::Tools::GFFversions available--quietβ don't talk about what is being processed π€«--typesourceβ SO sequence type for source (e.g.chromosome;region;contig)--help,-hβ display this message
π¦ DESCRIPTION π¦
This script uses Bio::SeqFeature::Tools::Unflattener and Bio::Tools::GFF to convert GenBank flatfiles to GFF3, with gene containment hierarchies mapped so gbrowse looks chef's kiss ππ.
The input files are assumed to be gzipped GenBank flatfiles for refseq contigs. A file can hold multiple GenBank records, nbd. You can process either a single file or an entire directory. By default the DNA sequence is embedded right there in the GFF, but you can save it into a separate fasta file with the --split(-y) option instead. πΎ
If an input file contains multiple records, the default behaviour is to dump all GFF and sequence to a file of the same name (with .gff appended). Using the 'nolump' option will create a separate file for each genbank record. Using the 'split' option will create separate GFF and Fasta files for each genbank record.
π Notes
'split' and 'nolump' produce many files
When the input files are stacked with GenBank records (think the chromosome files for the mouse genome build, bestie, it's a LOT), choosing 'split' or 'nolump' will spawn an absolutely unhinged number of output files. If you do have lists of files > 6000, use the --long_list option in bp_bulk_load_gff.pl or bp_fast_load_gff.pl to load the gff and/ or fasta files. fr fr, plan for it.
Designed for RefSeq
This script is designed for RefSeq genomic sequence entries. It may work for third party annotations but this has not been tested. But see below, Uniprot/Swissprot works, EMBL and possibly EMBL/Ensembl if you don't mind some gene model unflattener errors (dgg).
G-R-P-E Gene Model π
Don Gilbert worked this over with needs to produce GFF3 suited to loading to GMOD Chado databases. Most of the changes I believe are suited for general use. One main chado-specific addition is the
--[no]cds2protein flag
My favorite GFF is to set the above as ON by default (disable with --nocds2prot). For general use it probably should be OFF, enabled with --cds2prot.
This writes GFF with an alternate, but useful Gene model, instead of the consensus model for GFF3
[ gene > mRNA> (exon,CDS,UTR) ]
This alternate is
gene > mRNA > polypeptide > exon
means the only feature with dna bases is the exon. The others specify only location ranges on a genome. Exon of course is a child of mRNA and protein/peptide.
The protein/polypeptide feature is an important one, having all the annotations of the GenBank CDS feature, protein ID, translation, GO terms, Dbxrefs to other proteins.
UTRs, introns, CDS-exons are all inferred from the primary exon bases inside/outside appropriate higher feature ranges. Other special gene model features remain the same.
Several other improvements and bugfixes, minor but useful are included
- IO pipes now work:
curl ftp://ncbigenomes/... | bp_genbank2gff3 --in stdin --out stdout | gff2chado ...
- GenBank main record fields are added to source feature, e.g. organism, date, and the sourcetype, commonly chromosome for genomes, is used.
- Gene Model handling for ncRNA, pseudogenes are added.
- GFF header is cleaner, more informative.
--GFF_VERSIONflag allows choice of v2 as well as default v3. - GFF
##FASTAinclusion is improved, and CDS translation sequence is moved to FASTA records. - FT -> GFF attribute mapping is improved.
--formatchoice of SeqIO input formats (GenBank default). Uniprot/Swissprot and EMBL work and produce useful GFF.SeqFeature::Tools::TypeMapperhas a few FT -> SOFA additions and more flexible usage.
π TODO π
Are these additions desired?
- filter input records by taxon (e.g. keep only organism=xxx or taxa level = classYYY
- handle Entrezgene, other non-sequence SeqIO structures (really should change those parsers to produce consistent annotation tags).
Related bugfixes/tests
These items from Bioperl mail were tested (sample data generating errors), and found corrected:
From: Ed Green <green <at> eva.mpg.de>
Subject: genbank2gff3.pl on new human RefSeq
Date: 2006-03-13 21:22:26 GMT
-- unspecified errors (sample data works now).
From: Eric Just <e-just <at> northwestern.edu>
Subject: genbank2gff3.pl
Date: 2007-01-26 17:08:49 GMT
-- bug fixed in genbank2gff3 for multi-record handling
This error is for a /trans_splice gene that is hard to handle, and unflattner/genbank2 doesn't π
From: Chad Matsalla <chad <at> dieselwurks.com>
Subject: genbank2gff3.PLS and the unflatenner - Inconsistent order?
Date: 2005-07-15 19:51:48 GMT
π AUTHOR π
Sheldon McKay (mckays@cshl.edu)
Copyright (c) 2004 Cold Spring Harbor Laboratory.
AUTHOR of hacks for GFF2Chado loading
Don Gilbert (gilbertd@indiana.edu)
and that's the whole page, bestie β no cap, every flag and footnote made it in. π This was BP_GENBANK2GFF3(1p), brought to you by perl v5.32.1, dated 2021-08-15. slay, go annotate some genomes ππ¦
π¦ where this page comes from
- debian bookworm: bioperl 1.7.8-1 Β· Perl
- debian trixie: bioperl 1.7.8-1 Β· Perl
- ubuntu jammy: bioperl 1.7.8-1 Β· Perl
- ubuntu noble: bioperl 1.7.8-1 Β· Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms