Re: Measuring Substring with Hash

2005-04-09 Thread John W. Krahn
Edward Wijaya wrote: Hi John and David, Hello, I forgot to mentioned another variances of scoring apart from this two They are cases where they overlap: CASE C: . ... #score 16 GATTACGAGTGGCGCTCGTGTAACGGCA GATTACG TTACGAG CGTGTAA CASE D: GCTCGTG

Re: Measuring Substring with Hash

2005-04-08 Thread John W. Krahn
Edward Wijaya wrote: Hi John and David, Hello, Don't mean to nitpick. Just wondering if it's possible to modify Krahn's snippet to accomodate the overlapping cases? No, it won't work if they overlap. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional c

Re: Measuring Substring with Hash

2005-04-08 Thread Edward Wijaya
Hi John and David, Thanks so much for your reply. I forgot to mentioned another variances of scoring apart from this two ...... .. GATTACGAGTGGCGCTCGTGTAACGGCA#Score 21 GATTACGGCGCTCG AACGGCA CASE B: .... #Score 4 GATTACGAGTGGCGCTCGTGTAACGGCA

Re: Measuring Substring with Hash

2005-04-08 Thread John W. Krahn
Wagner, David --- Senior Programmer Analyst --- WGO wrote: John W. Krahn wrote: Wagner, David --- Senior Programmer Analyst --- WGO wrote: Since you are not using the offset, and you have the same value GG twice and index starts over from the first, you are counting the same GG twice. If you re

RE: Measuring Substring with Hash

2005-04-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
John W. Krahn wrote: > Wagner, David --- Senior Programmer Analyst --- WGO wrote: >> John W. Krahn wrote: >> >>> John W. Krahn wrote: >>> It looks like this will do what you want: >> >> John, >> Since you are not using the offset, and you have the same value >> GG twice and index starts

Re: Measuring Substring with Hash

2005-04-08 Thread John W. Krahn
Wagner, David --- Senior Programmer Analyst --- WGO wrote: John W. Krahn wrote: John W. Krahn wrote: It looks like this will do what you want: John, Since you are not using the offset, and you have the same value GG twice and index starts over from the first, you are counting the same GG twice.

RE: Measuring Substring with Hash

2005-04-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
John W. Krahn wrote: > John W. Krahn wrote: >> >> It looks like this will do what you want: John, Since you are not using the offset, and you have the same value GG twice and index starts over from the first, you are counting the same GG twice. If you remove the last GG

Re: Measuring Substring with Hash

2005-04-08 Thread John W. Krahn
John W. Krahn wrote: It looks like this will do what you want: sub score { my ( $str, $array ) = @_; my $total_score = 0; for my $frag ( @$array ) { my $len = length $frag; my $idx = index $str, $frag; if ( $idx >= 0 and substr $str, $idx, $len, '' ) { $total_score += $len;

Re: Measuring Substring with Hash

2005-04-08 Thread John W. Krahn
Edward Wijaya wrote: Hi, Hello, I have following code that measure the substring. It basically the number of positions of substrings that occur (dotted count) CASE A: ...... .. GATTACGAGTGGCGCTCGTGTAACGGCA#Score 21 GATTACGGCGCTCG AACGGCA CASE B: ...

RE: Measuring Substring with Hash

2005-04-08 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Edward Wijaya wrote: > Hi, > > I have following code that measure the substring. > It basically the number of positions of substrings > that occur (dotted count) > > CASE A: > ...... .. > GATTACGAGTGGCGCTCGTGTAACGGCA#Score 21 > GATTACGGCGCTCG AACGGCA > > > CASE B: >