in reply to Re: Re: Why is it matching??
in thread Why is it matching??
The rebuke wasn't intended to come across as harsh. Sorry that it did.
Moving right along. Could you explain a little more of what you mean by ...but I couldn't get your program to work as stated...? I just downloaded the code again and it produced the output I listed, which show that two keys were created. The first with three probes found
1415671 : GGAACAGGAATGTCGCAACATCGTA, ACATCGTATGGATTGCTGAGTGCAT, GGCTGATCACATCCAAAAAGTCATG
And the second with 10:
1415670 : GAGGAAACGTTCACCCTGTCTACTA, GTTCACCCTGTCTACTATCAAGACA, TACTATCAAGACACTCGAAGAGGCT, CTGTGGGCAATATTGTGAAGTTCCT, GAATGCATCCTTGTGAGAGGTCAGA, GAGAGGTCAGACAAAGTGCCAGAAA, AAAACAAGAACACCCACACGCTGCT, ACACGCTGCTGCTAGCTGGAGTATT, TATCTTGTCCAACACTACGTCGAAG, TTGTCACCATGCCTGCAAGGAGAGA
This is as expected from the sample data you provided on that original post, although I've manually wrapped it to prevent it getting confused by the autowrapper.
If you are getting different output when you run my original code, then could you post the output you get please and I'll try to work out what could be different.
The way $target name gets updated in the original is like this.
do { # extract the target name $target_name = $1 if m[( \d{7} ) _at: \d{3} : \d{3} ]x; while( m[$target_name] ) { # process the record containing the current target name my $probe = <DATA>; # Read the probe chomp $probe; # save it in an HoA keyed by the target name push @{ $probes{ $target_name } }, $probe; # get the next line; last unless defined( $_ = <DATA> ); } } until eof DATA; # till done
$target_name is set at the top of the outer do..until loop.
The code enters the inner while loop, reads the next line, extracts the probe pushes it onto the HoA.
It then gets to the last unless defined... line, where it reads another line. So long as it hasn't reached the eof, then it loops back to the top and tests the while condition again. If it matches, the loop repeats, another probe is read and pushed.
If it doesn't, then it falls out of the while loop and the until eof DATA condition is tested. If it's not at the eof, then it loops back to the top of the do...until loop and the new $target_name is extracted from the last line it read (which failed to match the while condition) and the cycle repeats.
Hopefully, that explains how it works and will allow you to modify it to your needs.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Why is it matching??
by bioinformatics (Friar) on Sep 12, 2003 at 17:00 UTC | |
by BrowserUk (Patriarch) on Sep 12, 2003 at 17:16 UTC | |
|
Re: Re: Re: Re: Why is it matching??
by bioinformatics (Friar) on Sep 16, 2003 at 19:18 UTC | |
by BrowserUk (Patriarch) on Sep 16, 2003 at 20:23 UTC |