Source code

Download source archive ↓

upstream-extended/community/tools/biopython/converters/gb_embl_to_gff.py

1#!/usr/bin/env python
2"""Convert a GenBank file into GFF format.
3
4https://raw.github.com/chapmanb/bcbb/master/gff/Scripts/gff/genbank_to_gff.py
5
6Usage:
7    gb_embl_to_gff.py <genbank_file> <gff_file> <input_format embl or genbank>
8"""
9import sys
10
11from BCBio import GFF
12from Bio import SeqIO
13
14
15def main(gb_file, ofile, iformat):
16    with open(ofile, "w") as out_handle:
17        GFF.write(SeqIO.parse(gb_file, iformat), out_handle)
18
19
20if __name__ == "__main__":
21    main(*sys.argv[1:])