def gb(args):
    """
    %prog gb gffile fastafile

    Convert GFF3 to Genbank format. Recipe taken from:
    <http://www.biostars.org/p/2492/>
    """
    from Bio.Alphabet import generic_dna
    try:
        from BCBio import GFF
    except ImportError:
        print("You need to install dep first: $ easy_install bcbio-gff", file=sys.stderr)

    p = OptionParser(gb.__doc__)
    opts, args = p.parse_args(args)

    if len(args) != 2:
        sys.exit(not p.print_help())

    gff_file, fasta_file = args
    pf = op.splitext(gff_file)[0]
    out_file = pf + ".gb"
    fasta_input = SeqIO.to_dict(SeqIO.parse(fasta_file, "fasta", generic_dna))
    gff_iter = GFF.parse(gff_file, fasta_input)
    SeqIO.write(gff_iter, out_file, "genbank")
def gb ( args ) : from Bio . Alphabet import generic_dna try : from BCBio import GFF except ImportError : print ( "You need to install dep first: $ easy_install bcbio-gff" , file = sys . stderr ) p = OptionParser ( gb . __doc__ ) opts , args = p . parse_args ( args ) if len ( args ) != 2 : sys . exit ( not p . print_help ( ) ) gff_file , fasta_file = args pf = op . splitext ( gff_file ) [ 0 ] out_file = pf + ".gb" fasta_input = SeqIO . to_dict ( SeqIO . parse ( fasta_file , "fasta" , generic_dna ) ) gff_iter = GFF . parse ( gff_file , fasta_input ) SeqIO . write ( gff_iter , out_file , "genbank" )
%prog gb gffile fastafile

    Convert GFF3 to Genbank format. Recipe taken from:
    <http://www.biostars.org/p/2492/>