Package obitools :: Package word :: Module predicat
[hide private]
[frames] | no frames]

Source Code for Module obitools.word.predicat

 1  import re 
 2  from obitools.word import wordDist 
 3   
4 -def rePredicatGenerator(regex):
5 regex = re.compile(regex,re.I) 6 def predicat(w): 7 return bool(regex.search(w))
8 return predicat 9
10 -def gcUpperBondGenerator(count):
11 def predicat(w): 12 c = w.count('g')+w.count('c') 13 return c <= count
14 return predicat 15
16 -def homoPolymerGenerator(count):
17 pattern = '(.)' + '\\1' * (count -1) 18 return rePredicatGenerator(pattern)
19
20 -def distMinGenerator(word,dmin):
21 def predicat(w): 22 return w==word or wordDist(w, word) >= dmin
23 return predicat 24