A straightforward application to convert NCBI GenBank format files to a swath of other formats. Hopefully we have the
format you need, but if not either post an issue using our template,
or if you have already got it working, post a PR so we can add it and
add you to the project.
You might also be interested deprekate’s package called genbank which includes
several of the features here, and you can import genbank into your Python projects.
Documentation
For comprehensive documentation, including installation instructions, usage examples, and API reference, please visit:
Read an NCBI GenBank format file (like our test data) and convert it to one of many
different formats.
Input formats
At the moment we only support NCBI GenBank format. If you want us to read other common formats,
let us know and we’ll add them.
Output formats
Here are the output formats you can request. You can request as many of these at once as you like!
These outputs are assuming you provide a (for example) genome file that contains ORFs, Proteins, and Genomes.
Nucleotide output
-n or --nucleotide outputs the whole DNA sequence (e.g. the genome)
-o or --orfs outputs the DNA sequence of the open reading frames
Protein output
-a or --aminoacids outputs the protein sequence for each of the open reading frames
Complex formats
-p or --ptt NCBI ptt protein table. This is a somewhat deprecated NCBI format from their genomes downloads
-f or --functions outputs tab separated data of protein ID and protein function (also called the product)
--gff3 outputs GFF3 format
--amr outputs a GFF file, an amino acid fasta file, and a nucleotide fasta file as required by AMR Finder Plus. Note that this format checks for validity that often crashes AMRFinderPlus
--phage_finder outputs a unique format required by phage_finder
--bakta-json outputs JSON format genome files similar to those created by Bakta.
This option also allows you to specify additional information which can be recorded in the JSON output, including:
--gram [should be + or -] whether the strain is Gram +ve or Gram -ve. Note that if not provided we compute some from our list of Bacteria
--translation-table if you dind’t use 11
Output options
--pseudo normally we skip pseudogenes (e.g. in creating amino acid fasta files). This will try and include pseudogenes, but often biopython complains and ignores them!
-i or --seqid only output this sequence, or these sequences if you specify more than one -i/--seqid
-z or --zip compress some of the outputs
--log write logs to a different file
Separate multi-GenBank files
If your GenBank files contains multiple sequence records (separated with //), you can provide the --separate flag.
This will write each entry into its own file. This is compatible with -n/--nucleotide, -o/--orfs, and
-a/--aminoacids. However, if you provide the --separate flag on its own, it will write each entry in your
multi-GenBank file to its own GenBank file.
genbank_to
A straightforward application to convert NCBI GenBank format files to a swath of other formats. Hopefully we have the format you need, but if not either post an issue using our template, or if you have already got it working, post a PR so we can add it and add you to the project.
You might also be interested deprekate’s package called genbank which includes several of the features here, and you can
import genbankinto your Python projects.Documentation
For comprehensive documentation, including installation instructions, usage examples, and API reference, please visit:
https://genbank-to.readthedocs.io
What it does
Read an NCBI GenBank format file (like our test data) and convert it to one of many different formats.
Input formats
At the moment we only support NCBI GenBank format. If you want us to read other common formats, let us know and we’ll add them.
Output formats
Here are the output formats you can request. You can request as many of these at once as you like!
These outputs are assuming you provide a (for example) genome file that contains ORFs, Proteins, and Genomes.
Nucleotide output
-nor--nucleotideoutputs the whole DNA sequence (e.g. the genome)-oor--orfsoutputs the DNA sequence of the open reading framesProtein output
-aor--aminoacidsoutputs the protein sequence for each of the open reading framesComplex formats
-por--pttNCBI ptt protein table. This is a somewhat deprecated NCBI format from their genomes downloads-for--functionsoutputs tab separated data ofprotein IDandprotein function(also called theproduct)--gff3outputs GFF3 format--amroutputs a GFF file, an amino acid fasta file, and a nucleotide fasta file as required by AMR Finder Plus. Note that this format checks for validity that often crashes AMRFinderPlus--phage_finderoutputs a unique format required by phage_finder--bakta-jsonoutputs JSON format genome files similar to those created by Bakta.--gram[should be+or-] whether the strain is Gram +ve or Gram -ve. Note that if not provided we compute some from our list of Bacteria--translation-tableif you dind’t use 11Output options
--pseudonormally we skip pseudogenes (e.g. in creating amino acid fasta files). This will try and include pseudogenes, but often biopython complains and ignores them!-ior--seqidonly output this sequence, or these sequences if you specify more than one-i/--seqid-zor--zipcompress some of the outputs--logwrite logs to a different fileSeparate multi-GenBank files
If your GenBank files contains multiple sequence records (separated with
//), you can provide the--separateflag. This will write each entry into its own file. This is compatible with-n/--nucleotide,-o/--orfs, and-a/--aminoacids. However, if you provide the--separateflag on its own, it will write each entry in your multi-GenBank file to its own GenBank file.Examples
All of these examples use our test data
fastaof the genome:Installation
You can install
genbank_toin three different ways:This is the easiest and recommended method.
I recommend putting this into a virtual environment:
(Not really recommended as things might break)
More Information
For detailed documentation, including:
Please visit our documentation at https://genbank-to.readthedocs.io