valerio_mazza

find_seqDna

Nov 18th, 2019
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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]
RAW Paste Data