As I suggested:

#! perl -slw use strict; use Data::Dump qw[ pp ]; my $k = 15; my %repo = ( "readA" => "AAACATGAAAAGAAATGATGAAACAGA", "readB" => "AAATCATGAAACAGAGCCTCATCTCCC ", ); my @order = ( "readB_1","readA_2"); #my $k = 25; #my %repo = ( # "readA" => "GCTGAGGCAGGAGAATTGCTTGAACCTGGGAGGCA", # "readB" => "TACTCAGGAGGCTGAGGCAGGAGAATTGCTTGAAC", # "readC" => "GCTGAGGCAGGAGAATTGCTTGAACTTAGGGGATG", # "readD" => "TACTCGGGAGGCTGAGGCAGGAGAATTGCTTGAAC", #); #my @order = ( "readA_1", "readB_2", "readC_1", "readD_2"); sub muster { local $^W; my( $bits ) = @_; my $muster = ''; for my $p ( 0 .. length( $bits->[0] )-1 ) { my %uniq; ++$uniq{ substr $bits->[ $_ ], $p, 1 } for 0 .. $#$bits; if( keys %uniq > 1 ) { $muster .= '(' . join( ',', keys %uniq ) . ')'; } else { $muster .= each %uniq; } } return $muster; } my( @heads, @bodys, @tails ); while( @order ) { my( $s1, $p1, $s2, $p2 ) = map split( '_', shift @order ), 1 .. 2; ( $s1, $s2 ) = ( $s2, $s1 ) if $p1 > $p2; push @heads, substr $repo{ $s2 }, 0, length( $repo{ $s2 } ) - $k; push @bodys, substr $repo{ $s2 }, -$k; push @tails, substr $repo{ $s1 }, $k; push @bodys, substr $repo{ $s1 }, 0, $k; } my $head = muster( \@heads ); my $body = muster( \@bodys ); my $tail = muster( \@tails ); print $head, $body, $tail; __END__ TACTC(A,G)GGAGGAGAATTGCTTGAACCTGGGAGGCA(T,C)T(A,G)GG(A,G)G(A,G)(T,C)(A +,G) TACTC(A,G)GGAGGCTGAGGCAGGAGAATTGCTTGAAC(T,C)T(A,G)GG(A,G)G(A,G)(T,C)(A +,G) AAACATGAAAAGAAAT(C,G)ATGAAACAGAGCCTCATCTCCC AAACATGAAAAGAAAT(G,C)ATGAAACAGAGCCTCATCTCCC

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

In reply to Re^3: Mustering Reads by BrowserUk
in thread Mustering Reads by neversaint

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, details, 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, summary, 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.