Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Dec 13th, 2017 52 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. def find_orfs_with_trans(seq, trans_table, min_protein_length):
  2.     answer = []
  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
  21.                     answer.append((start, end, strand,
  22.                                    trans[aa_start:aa_end]))
  23.                 aa_start = aa_end+1
  24.     answer.sort()
  25.     return answer
  26.  
  27. orf_list = find_orfs_with_trans(record.seq, table, min_pro_len)
  28.  
  29. for start, end, strand, pro in orf_list:
  30. print("%s...%s - length %i, strand %i, %i:%i"
  31.       % (pro[:30], pro[-3:], len(pro), strand, start, end))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top