Advertisement
valerio_mazza

find_seqDna

Nov 18th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.46 KB | None | 0 0
  1. def find_seqDna(pathFile, seqN):
  2. # @param pathFile: String.
  3. # @param seqN: String. Nucleotide sequence to look for
  4.  
  5.   file = open(pathFile, "rt")
  6.   seqFile = file.read()
  7.   if seqFile.find(seqN) != -1:
  8.      pos_seq = seqFile.find(seqN)
  9.   else:
  10.     print "ERROR: sequence",seqN,"not found"
  11.     return    
  12.   pos_startName = seqFile.rfind(">", 0, pos_seq)
  13.   pos_endName = seqFile.find("\n", pos_startName)
  14.   print "Found in",seqFile[pos_startName:pos_endName]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement