Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I think this does what you describe.

#! perl -slw use strict; my( $target_name, %probes ); $_ = <DATA>; # Prime the pump. 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; last unless defined( $_ = <DATA> ); # get the next line; } } until eof DATA; # till done print $_, ' : ', join', ', @{ $probes{ $_ } } for keys %probes; __DATA__ probe:MOE430A:1415670_at:549:177; Interrogation_Position=2513; Antisen +se; GAGGAAACGTTCACCCTGTCTACTA probe:MOE430A:1415670_at:467:433; Interrogation_Position=2521; Antisen +se; GTTCACCCTGTCTACTATCAAGACA probe:MOE430A:1415670_at:254:643; Interrogation_Position=2533; Antisen +se; TACTATCAAGACACTCGAAGAGGCT probe:MOE430A:1415670_at:54:269; Interrogation_Position=2556; Antisens +e; CTGTGGGCAATATTGTGAAGTTCCT probe:MOE430A:1415670_at:405:339; Interrogation_Position=2583; Antisen +se; GAATGCATCCTTGTGAGAGGTCAGA probe:MOE430A:1415670_at:60:395; Interrogation_Position=2597; Antisens +e; GAGAGGTCAGACAAAGTGCCAGAAA probe:MOE430A:1415670_at:284:165; Interrogation_Position=2619; Antisen +se; AAAACAAGAACACCCACACGCTGCT probe:MOE430A:1415670_at:622:145; Interrogation_Position=2634; Antisen +se; ACACGCTGCTGCTAGCTGGAGTATT probe:MOE430A:1415670_at:291:661; Interrogation_Position=2804; Antisen +se; TATCTTGTCCAACACTACGTCGAAG probe:MOE430A:1415670_at:146:701; Interrogation_Position=2956; Antisen +se; TTGTCACCATGCCTGCAAGGAGAGA probe:MOE430A:1415671_at:116:525; Interrogation_Position=1156; Antisen +se; GGAACAGGAATGTCGCAACATCGTA probe:MOE430A:1415671_at:655:137; Interrogation_Position=1173; Antisen +se; ACATCGTATGGATTGCTGAGTGCAT probe:MOE430A:1415671_at:398:139; Interrogation_Position=1232; Antisen +se; GGCTGATCACATCCAAAAAGTCATG

Output

P:\test>285872 1415671 : GGAACAGGAATGTCGCAACATCGTA, ACATCGTATGGATTGCTGAGTGCAT, GGCTGA +TCACATCCAAAAAGTCATG 1415670 : GAGGAAACGTTCACCCTGTCTACTA, GTTCACCCTGTCTACTATCAAGACA, TACTAT +CAAGACACTCGAAGAGGCT, CTGTGGGCAATATTGTGAAGTTCCT, GAATGCATCCTTGTGAGAGGT +CAGA, GAGAGGTCAGACAAAGTGCCAGAAA, AAAACAAGAACACCCACACGCTGCT, ACACGCTGC +TGCTAGCTGGAGTATT, TATCTTGTCCAACACTACGTCGAAG, TTGTCACCATGCCTGCAAGGAGAG +A

Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
If I understand your problem, I can solve it! Of course, the same can be said for you.


In reply to Re: Little pattern problem... by BrowserUk
in thread Little pattern problem... by bioinformatics

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2018-11-20 23:55 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My code is most likely broken because:
















      Results (234 votes). Check out past polls.

      Notices?