daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from Bio import SeqIO
  2. from Bio.Seq import Seq
  3.  
  4. forseq = Seq("tttaca".upper())
  5. revseq = Seq("gtcttt".upper())
  6. filename = "/‎users/ryanjhope/documents/phd/dna_sequences/genome/c_aceto/nc_003030.1.fasta"
  7.  
  8. forcom = forseq.reverse_complement()
  9. revcom = revseq.reverse_complement()
  10. print("seq\tstart\tstop\tgap\tdir\tseq")
  11. for record in SeqIO.parse(filename, "/‎users/ryanjhope/documents/phd/dna_sequences/genome/c_aceto/nc_003030.1.fasta"):
  12.     for i in range(len(record.seq)):
  13.         for v1, v2, direc in [ (forseq, revseq, "F"), (revcom, forcom, "R") ]:
  14.             if record.seq[i:i+len(v1)] == v1:
  15.                 for j in range(10,25):
  16.                     if record.seq[i+len(v1)+j:i+len(v2)+j+len(v2)] == v2:
  17.                         print("{}\t{}\t{}\t{}\t{}\t{}".format(
  18.                             record.id, i,
  19.                             i + len(v1)+j+len(v2)-1,
  20.                             j, direc,
  21.                             record.seq[i: i+len(v1) + j + len(v2)] ))
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