Re: searching substrings with interpositions

2005-05-24 Thread Andrew Dalke
Claudio Grondi wrote: > Note: code below is intended to help to clarify things only, > so that a bunch of examples can be tested. > If you need bugfree production quality code, maybe > someone else can provide it. Still not tested enough to ensure that it's bug free, but more concise. Here's one

Re: searching substrings with interpositions

2005-05-24 Thread Claudio Grondi
<[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > thanx everyone, is what i need. > As Claudio argues, it's a standard problem of dna sequences > comparation. > the next step of my job is to make limits of lenght of interposed > sequences (if someone can help me in this way i'll

Re: searching substrings with interpositions

2005-05-24 Thread Andrew Dalke
[EMAIL PROTECTED] wrote: > the next step of my job is to make limits of lenght of interposed > sequences (if someone can help me in this way i'll apreciate a lot) > thanx everyone. Kent Johnson had the right approach, with regular expressions. For a bit of optimization, use non-greedy groups. Tha

Re: searching substrings with interpositions

2005-05-24 Thread Cyril BAZIN
Just another solution, pretty and effective: def fct(a, b):   idx = -1   for c in a:     idx = b.find(c, idx+1)     if idx == -1:   return False   return True On 24 May 2005 06:06:03 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:thanx everyone, is what i need.As Claudio argues, it's a st

Re: searching substrings with interpositions

2005-05-24 Thread [EMAIL PROTECTED]
thanx everyone, is what i need. As Claudio argues, it's a standard problem of dna sequences comparation. the next step of my job is to make limits of lenght of interposed sequences (if someone can help me in this way i'll apreciate a lot) thanx everyone. giorgio -- http://mail.python.org/mailman/

Re: searching substrings with interpositions

2005-05-24 Thread Claudio Grondi
> i search a function f(a,b) that gives 1 if a is "contained" in b with > any sub strings interposed. If I understand it right, it should be something like this: def blnFindCharSequenceAevenIfSpreadOverEntireStringB(strA, strB): intNoOfCharsFound = 0 intPtrToBeginOfSubsectionOfB = 0 intLenA

Re: searching substrings with interpositions

2005-05-24 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > hi everyone. > a problem: > two binary strings, a="0101" b="0100"; > i search a function f(a,b) that gives 1 if a is "contained" in b with > any sub strings interposed. > in this example a in contained cause 000<01>111<01>00 but also > 0<0>00<101>00" > but al

Re: searching substrings with interpositions

2005-05-24 Thread bplumhoff
Hello Giorgi, I suggest to google for "python boyer moore" to get a fast implementation of a string search algorithm in Python (the Boyer-Moore algorithm). One promising hit seems to be: http://www.egenix.com/files/python/mxTextTools.html HTH, Bernd -- http://mail.python.org/mailman/listinfo/p

searching substrings with interpositions

2005-05-24 Thread [EMAIL PROTECTED]
hi everyone. a problem: two binary strings, a="0101" b="0100"; i search a function f(a,b) that gives 1 if a is "contained" in b with any sub strings interposed. in this example a in contained cause 000<01>111<01>00 but also 0<0>00<101>00" but also <0>000<101>00 but also 000<0><