WSTester updated to work plus hopefully all the other changes that need to go into...
[jabaws.git] / binaries / src / ViennaRNA / Utils / b2mt.pl
1 #!/usr/bin/perl -w
2 # -*-Perl-*-
3 # Last changed Time-stamp: <2005-03-09 19:38:25 ivo> 
4 # produce Pauline's mountain representation from bracket notation
5 # use e.g. as  RNAfold < foo.seq | b2mt | xmgr -pipe
6 # definition: h=number of base pairs enclosing base
7 use strict;
8 while (<>) {
9     print if (s/>/#/);
10
11     next unless (/\.\.\./);
12     next if (/\[/);   # don't process output from partition function
13     chop;
14     my @F=split(//,$_);
15     my $p=0; my $h=0;
16     foreach my $i (@F) {
17         $h-- if ($i eq ')');
18         $p++;
19         printf("%4d %4d\n",$p,$h);
20         $h++ if ($i eq '(');    # increase $h *after* printing
21     }
22     print "&\n";
23 }
24
25 =head1 NAME
26
27 b2mt - produce coordinates for a mountain plot from bracket notation
28
29 =head1 SYNOPSIS
30
31   b2mt.pl < seq.fold > mountain.dat
32
33 =head1 DESCRIPTION
34
35 read a secondary structures in bracket notation as output by RNAfold,
36 and compute coordinates for a mountain plot as introduced by Pauline Hogeweg.
37 The output is suitable for graphing  with xmgrace, e.g.:
38 C< RNAfold < foo.seq | b2mt.pl | xmgrace -pipe>
39
40 =head1 AUTHOR
41
42 Ivo L. Hofacker <ivo@tbi.univie.ac.at>