def find_orfs(fa, seqs):
    """
    find orfs and see if they overlap with insertions
    # seqs[id] = [gene, model, [[i-gene_pos, i-model_pos, i-length, iseq, [orfs], [introns]], ...]]
    """
    faa = '%s.prodigal.faa' % (fa)
    fna = '%s.prodigal.fna' % (fa)
    gbk = '%s.prodigal.gbk' % (fa)
    if os.path.exists(faa) is False:
        p = subprocess.Popen('prodigal -q -i %s -a %s -d %s -c -f gbk -m -n -o %s -p meta' \
                % (fa, faa, fna, gbk), shell = True)
        p.communicate()
    for orf in parse_fasta(faa):
        if orf[0] == []:
            continue
        id = orf[0].split('>')[1].split('_', 1)[0]
        pos = sorted([int(i) for i in orf[0].split()[2:5] if i != '#'])
        if id not in seqs:
            continue
        for i, ins in enumerate(seqs[id][2]):
            if check_overlap(pos, ins, 0.90) is True:
                seqs[id][2][i][4].append(orf)
    return seqs, faa
def find_orfs ( fa , seqs ) : faa = '%s.prodigal.faa' % ( fa ) fna = '%s.prodigal.fna' % ( fa ) gbk = '%s.prodigal.gbk' % ( fa ) if os . path . exists ( faa ) is False : p = subprocess . Popen ( 'prodigal -q -i %s -a %s -d %s -c -f gbk -m -n -o %s -p meta' % ( fa , faa , fna , gbk ) , shell = True ) p . communicate ( ) for orf in parse_fasta ( faa ) : if orf [ 0 ] == [ ] : continue id = orf [ 0 ] . split ( '>' ) [ 1 ] . split ( '_' , 1 ) [ 0 ] pos = sorted ( [ int ( i ) for i in orf [ 0 ] . split ( ) [ 2 : 5 ] if i != '#' ] ) if id not in seqs : continue for i , ins in enumerate ( seqs [ id ] [ 2 ] ) : if check_overlap ( pos , ins , 0.90 ) is True : seqs [ id ] [ 2 ] [ i ] [ 4 ] . append ( orf ) return seqs , faa
find orfs and see if they overlap with insertions
    # seqs[id] = [gene, model, [[i-gene_pos, i-model_pos, i-length, iseq, [orfs], [introns]], ...]]