in reply to Numerical problem!
Doesn't show group headers for groups with no motifs. Assumes you want motifs that span groups to be reported only with the first group they are part of, not the last or all. Assumes you are using 1-based offsets (yuck) based on the 1-100, 101-200, stuff.my @motif = ( [30,43], [107,128], [209,254] ); # make sure it is in order by beginning position @motif = sort { $a->[0] <=> $b->[0] } @motif; my $last_group = 0; for my $motif (@motif) { my $group = int(($motif->[0]+99)/100); if ($group != $last_group) { print "\n" if $last_group; # blank between groups print "group $group (", $group*100-99, "-", $group*100, "):\n" +; $last_group = $group; } print "> genome.ptt_", $motif->[0], " ", $motif->[1], "\n", substr($string, $motif->[0]-1, $motif->[1] - $motif->[0]), "\n +"; }
|
|---|