Package: genbank-to
genbank_toA 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 postan issueusing our template,
or if you have already got it working, posta PRso we can add it and
add you to the project.You might also be interesteddeprekate'spackage calledgenbankwhich includes
several of the features here, and you canimport genbankinto your Python projects.What it doesRead an NCBI GenBank format file (like ourtest data) and convert it to one of many
different formats.Input formatsAt the moment we only support NCBI GenBank format. If you want us to read other common formats,let us knowand we'll add them.Output formatsHere 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 byAMR Finder Plus. Note that this format checks for validity that often crashes AMRFinderPlus--phage_finderoutputs a unique format required byphage_finderOutput 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 filesIf 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.ExamplesAll of these examples use ourtest dataExtract afastaof the genome:genbank_to-gtest/NC_001417.gbk-ntest/NC_001417.fnaExtract the DNA sequences of the ORFs to a single filegenbank_to-gtest/NC_001417.gbk-otest/NC_001417.orfsExtract the protein (amino acid) sequences of the ORFs to a filegenbank_to-gtest/NC_001417.gbk-atest/NC_001417.faaDo all of these at oncegenbank_to-gtest/NC_001417.gbk-ntest/NC_001417.fna-otest/NC_001417.orfs-atest/NC_001417.faaInstallationYou can installgenbank_toin three different ways:Using condaThis is the easiest and recommended method.mambacreate-ngenbank_togenbank_to
condaactivategenbank_to
genbank_to--helpUsing pipI recommend putting this into a virtual environment:virtualenvvenvsourcevenv/bin/activate
pipinstallgenbank_to
genbank_to--helpDirectly from this repository(Not really recommended as things might break)gitclonehttps://github.com/linsalrob/genbank_to.gitcdgenbank_to
virtualenvvenvsourcevenv/bin/activate
pythonsetup.pyinstall
genbank_to--help