Skip to main content

A script for parsing GenBank files

Project description

read_genbank

A module to read and parse the features of a genbank file

To output a tab separated file:

$ read_genbank.py tests/phiX174.gbk
'phiX174'	'CDS'	(('100', '627'),)	{'gene': 'G'}
'phiX174'	'CDS'	(('636', '1622'),)	{'gene': 'H'}
'phiX174'	'CDS'	(('1659', '3227'),)	{'gene': 'A'}
'phiX174'	'CDS'	(('2780', '3142'),)	{'gene': 'B'}
'phiX174'	'CDS'	(('3142', '3312'),)	{'gene': 'K'}
'phiX174'	'CDS'	(('3224', '3484'),)	{'gene': 'C'}
'phiX174'	'CDS'	(('3481', '3939'),)	{'gene': 'D'}
'phiX174'	'CDS'	(('3659', '3934'),)	{'gene': 'E'}
'phiX174'	'CDS'	(('3939', '4055'),)	{'gene': 'J'}
'phiX174'	'CDS'	(('4092', '5375'),)	{'gene': 'F'}

To output the amino-acid translations in fasta format

$ read_genbank.py tests/phiX174.gbk -f faa
>phiX174[100..627]
MLQTFISRHNSNFFSDKLVLTSVTPASSAPVLQTPKATSSTLYFDSLTVNAGNGGFLHCIQMDTSVNAANQVVSVGADIAFDADPKFFACLVRFESSSVPTTLPTAYDVYPLNGRHDGGYYTVKDCVTIDVLPRTPGNNVYVGFMVWSNFTATKCRGLVSLNQVIKEIICLQPLK
>phiX174[636..1622]
MFGAIAGGIASALAGGAMSKLFGGGQKAASGGIQGDVLATDNNTVGMGDAGIKSAIQGSNVPNPDEAAPSFVSGAMAKAGKGLLEGTLQAGTSAVSDKLLDLVGLGGKSAADKGKDTRDYLAAAFPELNAWERAGADASSAGMVDAGFENQKELTKMQLDNQKEIAEMQNETQKEIAGIQSATSRQNTKDQVYAQNEMLAYQQKESTARVASIMENTNLSKQQQVSEIMRQMLTQAQTAGQYFTNDQIKEMTRKVSAEVDLVHQQTQNQRYGSSHIGATAKDISNVVTDAASGVVDIFHGIDKAVADTWNNFWKDGKADGIGSNLSRK
>phiX174[1659..3227]
MPPNLGGFFMVRSYYPSECHADYFDFERIEALKPAIEACGISTLSQSPMLGFHKQMDNRIKLLEEILSFRMQGVEFDNGDMYVDGHKAASDVRDEFVSVTEKLMDELAQCYNVLPQLDINNTIDHRPEGDEKWFLENEKTVTQFCRKLAAERPLKDIRDEYNYPKKKGIKDECSRLLEASTMKSRRGFAIQRLMNAMRQAHADGWFIVFDTLTLADDRLEAFYDNPNALRDYFRDIGRMVLAAEGRKANDSHADCYQYFCVPEYGTANGRLHFHAVHFMRTLPTGSVDPNFGRRVRNRRQLNSLQNTWPYGYSMPIAVRYTQDAFSRSGWLWPVDAKGEPLKATSYMAVGFYVAKYVNKKSDMDLAAKGLGAKEWNNSLKTKLSLLPKKLFRIRMSRNFGMKMLTMTNLSTECLIQLTKLGYDATPFNQILKQNAKREMRLRLGKVTVADVLAAQPVTTNLLKFMRASIKMIGVSNLQSFIASMTQKLTLSDISDESKNYLDKAGITTACLRIKSKWTAGGK
>phiX174[2780..3142]
MEQLTKNQAVATSQEAVQNQNEPQLRDENAHNDKSVHGVLNPTYQAGLRRDAVQPDIEAERKKRDEIEAGKSYCSRRFGGATCDDKSAQIYARFDKNDWRIQPAEFYRFHDAEVNTFGYF
>phiX174[3142..3312]
MSRKIILIKQELLLLVYELNRSGLLAENEKIRPILAQLEKLLLCDLSPSTNDSVKN
>phiX174[3224..3484]
MRKFDLSLRSSRSSYFATFRHQLTILSKTDALDEEKWLNMLGTFVKDWFRYESHFVHGRDSLVDILKERGLLSESDAVQPLIGKKS
>phiX174[3481..3939]
MSQVTEQSVRFQTALASIKLIQASAVLDLTEDDFDFLTSNKVWIATDRSRARRCVEACVYGTLDFVGYPRFPAPVEFIAAVIAYYVHPVNIQTACLIMEGAEFTENIINGVERPVKAAELFAFTLRVRAGNTDVLTDAEENVRQKLRAEGVM
>phiX174[3659..3934]
MVRWTLWDTLAFLLLLSLLLPSLLIMFIPSTFKRPVSSWKALNLRKTLLMASSVRLKPLNCSRLPCVYAQETLTFLLTQKKTCVKNYVRKE
>phiX174[3939..4055]
MSKGKKRSGARPGRPQPLRGTKGKRKGARLWYVGGQQF
>phiX174[4092..5375]
MSNIQTGAERMPHDLSHLGFLAGQIGRLITISTTPVIAGDSFEMDAVGALRLSPLRRGLAIDSTVDIFTFYVPHRHVYGEQWIKFMKDGVNATPLPTVNTTGYIDHAAFLGTINPDTNKIPKHLFQGYLNIYNNYFKAPWMPDRTEANPNELNQDDARYGFRCCHLKNIWTAPLPPETELSRQMTTSTTSIDIMGLQAAYANLHTDQERDYFMQRYHDVISSFGGKTSYDADNRPLLVMRSNLWASGYDVDGTDQTSLGQFSGRVQQTYKHSVPRFFVPEHGTMFTLALVRFPPTATKEIQYLNAKGALTYTDIAGDPVLYGNLPPREISMKDVFRSGDSSKKFKIAEGQWYRYAPSYVSPAYHLLEGFPFIQEPPSGDLQERVLIRHHDYDQCFQSVQLLQWNSQVKFNVTVYRNLPTTRDSIMTS

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

read_genbank-0.6.tar.gz (22.7 kB view details)

Uploaded Source

Built Distributions

read_genbank-0.6-py3.8.egg (10.2 kB view details)

Uploaded Source

read_genbank-0.6-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file read_genbank-0.6.tar.gz.

File metadata

  • Download URL: read_genbank-0.6.tar.gz
  • Upload date:
  • Size: 22.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

File hashes

Hashes for read_genbank-0.6.tar.gz
Algorithm Hash digest
SHA256 ff15daed7c6593b0eb261b055664ed3c0a8110638c314c4379cb3ef91c817f5b
MD5 bdd98cdb3a40796a52e89cb04c8889d7
BLAKE2b-256 f75321004fe7dfd54c90a62d4fdf9ce55bbe87ff30bd75f14335581648a0c2a4

See more details on using hashes here.

File details

Details for the file read_genbank-0.6-py3.8.egg.

File metadata

  • Download URL: read_genbank-0.6-py3.8.egg
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

File hashes

Hashes for read_genbank-0.6-py3.8.egg
Algorithm Hash digest
SHA256 efdc20acdee3f4366cca3056ec1c14bdea754f111767422fc27f20497070b322
MD5 3a5a8d96f306ff7b32d22a0d1dfe9c55
BLAKE2b-256 a5d2adb05d40619e2453fbbaa97cdc0f4c370c9b9d0f2e2e813c88b01b0dd4da

See more details on using hashes here.

File details

Details for the file read_genbank-0.6-py3-none-any.whl.

File metadata

  • Download URL: read_genbank-0.6-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.21.0 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.8.2

File hashes

Hashes for read_genbank-0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 95755a10087260482ed4f93ad0553994f3e9ef8df4febb86d70a8414ff91d4ce
MD5 c979033598b038fe6687cf604cfb6436
BLAKE2b-256 f42ebdbb3ebb548e264cdd468d98025ee02fb8ad743923468be45d02cb76b4b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page