Re: [Tutor] Splitting text

2006-06-29 Thread Terry Carroll
On Thu, 29 Jun 2006, Apparao Anakapalli wrote: > pattern = 'ATTTA' > > I want to find the pattern in the sequence and count. > > For instance in 'a' there are two 'ATTTA's. use re.findall: >>> import re >>> pat = "ATTTA" >>> rexp=re.compile(pat) >>> a = "TCCCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGT

Re: [Tutor] Splitting text

2006-06-29 Thread Dave Kuhlman
On Thu, Jun 29, 2006 at 01:06:54PM -0700, Matthew White wrote: > Hello Appu, > > You can use the count() method to find the number of occurances of a > substring within a string: > > >>> a = 'TCCCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGTCACATTTA' > >>> a.count('ATTTA') > 2 > And, if you need to search

Re: [Tutor] Splitting text

2006-06-29 Thread Matthew White
Hello Appu, You can use the count() method to find the number of occurances of a substring within a string: >>> a = 'TCCCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGTCACATTTA' >>> a.count('ATTTA') 2 -mtw On Thu, Jun 29, 2006 at 12:45:06PM -0700, Apparao Anakapalli ([EMAIL PROTECTED]) wrote: > hello all:

[Tutor] Splitting text

2006-06-29 Thread Apparao Anakapalli
hello all: I have a question and I do not know how I can work it out. I have a file of sequences >a TCCCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGTCACATTTA' >b CCTGCGGCGCATGAGTGACTGGCGTATTTAGCCCGTCACAATTTAA' (10 K) pattern = 'ATTTA' I want to find the pattern in the sequence and count. For ins