1 '''
2 Created on 14 mai 2009
3
4 @author: coissac
5 '''
6
7 from obitools import WrappedBioSequence
8
10 '''
11 classdocs
12 '''
13
14
15 - def __init__(self,reference,id=None,definition=None,**info):
22
24 s = []
25 c = []
26 old=None
27 nc=0
28 for n in self._wrapped:
29 if old is not None and n!=old:
30 s.append(old)
31 c.append(nc)
32 nc=0
33 old=n
34 nc+=1
35 self._cached=''.join(s)
36 self['homopolymer']=c
37 self._cumulative=[]
38 sum=0
39 for c in self._count:
40 sum+=c
41 self._cumulative.append(sum)
42
44 return len(self._cached)
45
48
50 return iter(self._cached)
51
53 return self._cumulative[position]
54