2 # zoom into a PostScript dot plot produced by RNAfold, RNAalifold or alidot
3 # Last changed Time-stamp: <2003-03-24 12:47:26 ivo>
5 die "Usage: $0 [-f first] [-l last] [dp_file]\n";
13 /^-f$/ && ($from = shift, next );
14 /^-l$/ && ($to = shift, next );
22 if (/\/sequence \{ \((\S*)[\\\)]/) {
23 $seq = $1; # empty for new version
24 while (!/\) \} def/) { # read until end of definition
26 /(\S*)[\\\)]/; # ends either with `)' or `\'
29 if ($to>$from) { $seq=substr($seq,$from-1,$to-$from+1) }
30 else { $seq=substr($seq,$from-1) }
31 print "% Subsequence from $from to $to\n";
32 print "/sequence { (\\\n";
33 for ($p=0; $p<length($seq); $p+=250) {
34 print substr($seq,$p, 250), "\\\n";
38 elsif (/(\d+) (\d+) (.*box$)/) {
40 next if (($i<$from) || (($j>$to)&&($to>0)));
43 printf "%d %d %s\n", $i, $j, $3;