• API
• FAQ
• Tools
• Archive
A Pastebin account makes a great Christmas gift
SHARE
TWEET

# Untitled

a guest Dec 13th, 2017 52 Never
ENDING IN00days00hours00mins00secs

1. def find_orfs_with_trans(seq, trans_table, min_protein_length):
3.     seq_len = len(seq)
4.     for strand, nuc in [(+1, seq), (-1, seq.reverse_complement())]:
5.         for frame in range(3):
6.             trans = str(nuc[frame:].translate(trans_table))
7.             trans_len = len(trans)
8.             aa_start = 0
9.             aa_end = 0
10.             while aa_start < trans_len:
11.                 aa_end = trans.find("*", aa_start)
12.                 if aa_end == -1:
13.                     aa_end = trans_len
14.                 if aa_end-aa_start >= min_protein_length:
15.                     if strand == 1:
16.                         start = frame+aa_start*3
17.                         end = min(seq_len,frame+aa_end*3+3)
18.                     else:
19.                         start = seq_len-frame-aa_end*3-3
20.                         end = seq_len-frame-aa_start*3
22.                                    trans[aa_start:aa_end]))
23.                 aa_start = aa_end+1