EnvGen/EMBLmyGFF3

Name: EMBLmyGFF3

Owner: Environmental Genomics Group SciLifeLab/KTH Stockholm

Description: An efficient way to convert gff3 annotation files into EMBL format ready to submit.

Forked from: NBISweden/EMBLmyGFF3

Created: 2017-11-22 09:07:29.0

Updated: 2017-11-22 09:07:30.0

Pushed: 2017-11-22 09:15:34.0

Homepage: null

Size: 24275

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

GFF3 to EMBL conversion tool

Software to convert GFF3 and fasta to legal EMBL format suitable for ENA submission.

Based on documentation from http://www.insdc.org/files/feature_table.html, http://www.ebi.ac.uk/ena/WebFeat/ and ftp://ftp.ebi.ac.uk/pub/databases/embl/doc/usrman.txt.

You don't know how to submit to ENA ? Please visit the ENA: Guidelines and Tips

INDEX

Prerequisite
Installation
Usage
   Foreword
   Simple case
   Complete case
   Advanced case 1
   Advanced case 2
   Use through a bash script
Parameter
Mapping
   Feature type
   GFF3 Attribute to EMBL qualifier
   Other
Validate your embl flat file
Known issues
Citation Author

PREREQUISITE

Python 2.7, biopython 1.67 and the bcbio-gff 0.6.4 python packages.

In order to install biopython and bcbio-gff please use the following steps:

Mac OS X / LINUX:

Intall pip the python package manager:

sudo easy_install pip

Install biopython using pip: pip install biopython==1.67

Install bcbio-gff using pip: pip install bcbio-gff==0.6.4

Installation

Clone the repository:

git clone https://github.com/NBISweden/EMBLmyGFF3.git

Move into the folder:

cd EMBLmyGFF3/

Executing: ./EMBLmyGFF3.py

or

./EMBLmyGFF3.py -h

will display some help.

USAGE
FOREWORD

A correct GFF3 file and the genome in FASTA format that has been used to produce the GFF3 file are the mandatory input files. Then, in order to get a valid EMBL flat file suitable for submission you have to fill carefully all mandatory metadata.

/!\ Please be aware that a project ID and an locus tag are mandatory for a submission to ENA. You don't need this information if you don't plan to submit the data (In case you just want an EMBL-like flat file for other purposes). If you don't have yet those information you can add them later by replacing the corresponding fields.
To learn how to obtain a project ID click here.
To learn how to obtain a locus tag click here.

Test data are located in the examples folder.

Simple case

./EMBLmyGFF3.py example/maker.gff3 example/maker.fa

Will prompt you to fill one by one the mandatory information needed to produce a proper EMBL file. Once the software has all the information it needs, it will process the input files and will print the result to STDOUT.

In order to write the result in the desired file use the -o option:

./EMBLmyGFF3.py example/maker.gff3 example/maker.fa -o result.embl

Complete case

Minimum requirement to launch the software and avoid any prompt.

./EMBLmyGFF3.py examples/maker.gff3 examples/maker.fa –topology linear –molecule_type 'genomic DNA' –transl_table 1 –species 'Drosophila melanogaster' –locus_tag MY_LOCUS_TAG –project_id PRJXXXXXXX -o result.embl

Advanced case 1

When you want add more information than those mandatory: Fill the ID line except the accession and the RG line.

./EMBLmyGFF3.py examples/maker.gff3 examples/maker.fa –data_class STD –topology linear –molecule_type “genomic DNA” –transl_table 1 –species 'Drosophila melanogaster' –taxonomy INV –locus_tag LOCUS_TAG –project_id PRJXXXXXXX –rg MYGROUP -o result.embl

Advanced case 2

When you want add more information than those mandatory: Fill the ID line + publication and authors information.

./EMBLmyGFF3.py examples/maker.gff3 examples/maker.fa –data_class STD –topology linear –molecule_type “genomic DNA” –transl_table 1 –species 'Drosophila melanogaster' –taxonomy INV –locus_tag LOCUS_TAG –accession ERSXXXXXXX –project_id PRJXXXXXXX –rg MYGROUP –author 'author for the reference' –rt 'reference title' –rl 'Some journal' -o result.embl

Use through a bash script

You may prefer to launch the software through a bash script especially when you want to fill many information, so we provide examples of such script here example/maker_example.sh.

In order to use it move in the example folder, then launch the script:

./maker_example.sh

PARAMETER

Some parameters are mandatory and some others are not. Here is a list of all parameters available. You can also find a comprehensive help about the different parameters using the software help command.

positional arguments:

| Parameter | Description | | — | — | | gff_file| Input gff-file.| | fasta| Input fasta sequence.|

Mandatory Arguments related to the EMBL format to check carrefully:

| Parameter | Description | | — | — | | -i , –locus_tag | Locus tag prefix registered at ENA. More information here. No default value.| | -p , –project_id |Project ID. The defalut value is 'XXX' (This option is used to set up the PR line.)| | -r , –transl_table |Translation table. No default value. (This option is used to set up the translation table qualifier| transl_table of the CDS features.) Please visit this NCBI genetic code page for more information.| | -s , –species |Sample Species, formatted as 'Genus species' or taxid. No default value. This option is used to set up the OS line.| | -t , –topology |Sequence topology. No default value. (This option is used to set up the Topology that is the 3th token of the ID line.)| | -m , –molecule_type |Molecule type of the sample. No default value.|

Optional arguments related to the EMBL format:

| Parameter | Description | | — | — | | -a , –accession |Accession number(s) for the entry. Default value: XXX . This option is used to set up the accession number of the AC line and the first token of the ID line as well. The unique accession number is assigned by the database. Please visit this page and this one to learn more about it.|
| -c , –created| Creation time of the original entry. The default value is the date of the day.| | -d , –data_class |Data class of the sample. Default value 'XXX'. (This option is used to set up the 5th token of the ID line.) | -g , –organelle| Sample organelle. No default value.| | -k , –keyword| Keywords for the entry. No default value.| | -l , –classification| Organism classification. The default value is the classification found in the NCBI taxonomy DB from the species/taxid given as –species parameter. If none is found, 'Life' will be the default value.| | -x , –taxonomy |Source taxonomy. Default value 'XXX'. This option is used to set the taxonomic division within ID line (6th token).| | –rc| Reference Comment. No default value.| | –ra , –author| Author for the reference. No default value.| | –rg |Reference Group, the working groups/consortia that produced the record. Default value 'XXX'.| | –rl| Reference publishing location. No default value.| | –rt| Reference Title. No default value.| | –rx| Reference cross-reference. No default value.| | –email| Email used to fetch information from NCBI taxonomy database. Default value 'EMBLmyGFF3@tool.org'.| | –interleave_genes| Print gene features with interleaved mRNA and CDS features.| | –keep_duplicates| Do not remove duplicate features during the process. /!\ Option not suitable for submission purpose.| | –force_unknown_features| Force to keep feature types not accepted by EMBL. /!\ Option not suitable for submission purpose.| | –force_uncomplete_features| Force to keep features whithout all the mandatory qualifiers. /!\ Option not suitable for submission purpose.| | –translate| Include translation in CDS features. Not activated by default.| | –version| Sequence version number. The default value is 1.|

Optional arguments related to the software:

| Parameter | Description | | — | — | | -a, –advanced_help |Display advanced information of the parameter specified or of all parameters if none specified.| | -h, –help |Show this help message and exit.| | -v, –verbose |Increase verbosity.| | -q, –quiet |Decrease verbosity.| | –shame |Suppress the shameless plug.| | -z, –gzip |Gzip output file.| | -o , –output |Output filename.|

MAPPING

The challenge for a correct conversion is the correct mapping between the feature types described in the 3th column as well as the different attribute?s tags of the 9th column of the GFF3 file and the corresponding EMBL features and qualifiers.
If you figure out that a feature type or an attribute's tag is not mapped to the corresponding EMBL features or qualifiers you would like, you will have to modify the corresponding information in the mapping files.
The software will skip the unknown feature types (Non EMBL feature types that are not mapped against an EMBL feature type) and the unknown qualifiers (Non EMBL qualifiers that are not mapped against an EMBL qualifier) and will inform you during the conversion process. If you want to include them within the output, you can add the information needed in the corresponding mapping file.

Feature type

The EMBL format accepts 52 different feature types whereas the GFF3 is constrained to be a Sequence Ontology term or accession number (3th column of the GFF3), but nevertheless this constitutes 2278 terms in version 2.5.3 of the Sequence Ontology.

The file handling the proper mapping is translation_gff_feature_to_embl_feature.json

example:

“three_prime_UTR”: {
  “target”: “3'UTR”
}

This will map the three_prime_UTR feature type from the 3th column of the GFF3 file to the 3'UTR EMBL feature type. When the feature type from the GFF3 is identical to the EMBL feature no need to specify any target. If a target is needed and you didn't specified it, the tool will throw a warning message during the process.

You can decide which features will be printed in the output using the remove parameter:

“exon”: {
  “remove”: true
}

Like that no exon feature will be display in the output.

GFF3 Attribute to EMBL qualifier

The embl format accepts 98 different qualifiers where the corresponding attribute tag types in the 9th column of the GFF3 are unlimited. The file handling the proper mapping is translation_gff_attribute_to_embl_qualifier.json

example:

“Dbxref”: {
  “source description”: “A database cross reference.“,
  “target”: “db_xref”,
  “dev comment”: ““
},

This will map the Dbxref attribute's tag from the 9th columm of the GFF3 file to the db_xref embl qualifier.

Other

The source (2nd column) as well as the score (6th column) from the GFF3 file can also be handled through the translation_gff_other_to_embl_qualifier.json mapping file.

“source”: {
   “source description”: “The source is a free text qualifier intended to describe the algorithm or operating procedure that generated this

                       feature. Typically this is the name of a piece of software, such as Genescan or a database name, such
                       as Genbank. In effect, the source is used to extend the feature ontology by adding a qualifier to the type 
                       creating a new composite type that is a subclass of the type in the type column.", </br>

  “target”: “note”,
  “prefix”: “source:“,
  “dev comment”: “EMBL qualifiers tend to be more specific than this, so very hard to create a good mapping.“
},

This will map the source from the 2nd columm of the GFF3 file to the note embl qualifier.

/!\ Please notice the prefix allows to add information dowstream the source value wihtin the qualifier (Upstream information is also possible using suffix).
e.g: The source value is “Prokka”:
Within the embl file, instead to get note=“Prokka”, here we will get note=“source:Prokka”

VALIDATE YOUR EMBL FLAT FILE

The output can be validated using the ENA flat file validator distributed by EMBL. Please visit http://www.ebi.ac.uk/ena/software/flat-file-validator and/or https://github.com/enasequence/sequencetools for more information.

KNOWN ISSUES

biopython version There's a bug between bcbio-gff 0.6.4 and biopython 1.68 though, so use biopython 1.67.

If you have several version of biopython or bcbio-gff on your computer it is possible that an incompatible version is used by default which will lead to an execution error. To check the real version used during the execution you can use this command:

python -c “import Bio; from BCBio import GFF; print 'biopython version: '+Bio.__version__; print 'bcbio-gff version: '+GFF.__version__”

Duplicated Features
Features that have the same key (feature type) and location as another feature are considered as duplicates and aren't allowed by the EMBL database. So they are remove during the process. If you don't plan to submit the file to ENA and you wish to keep these features, use the –keep_duplicates option.

CITATION

DOI

AUTHOR

Martin Norling1,2, Niclas Jareborg1,3, Jacques Dainat1,2

1National Bioinformatics Infrastructure Sweden (NBIS), SciLifeLab, Uppsala Biomedicinska Centrum (BMC), Husargatan 3, S-751 23 Uppsala, SWEDEN.
2IMBIM - Department of Medical Biochemistry and Microbiology, Box 582, S-751 23 Uppsala, SWEDEN.
3Department of Biochemisty and Biophys-ics, Stockholm University / SciLifeLab, Box 1031, S-171 21 Solna, SWEDEN.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.