[Bio] / FigKernelPackages / gjoalign2html.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/gjoalign2html.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1, Wed Feb 21 18:15:51 2007 UTC revision 1.2, Mon Apr 9 21:00:24 2007 UTC
# Line 8  Line 8 
8    
9  eval { use Data::Dumper };  # Not in all installations  eval { use Data::Dumper };  # Not in all installations
10    
11    #-------------------------------------------------------------------------------
12    #  Prepend and/or append unaligned sequence data to a trimmed alignment:
13    #
14    #       \@align = add_alignment_context( \@align, \@seqs, \%options )
15    #
16    #     ( \@align, $pre_len, $ali_len, $suf_len )
17    #               = add_alignment_context( \@align, \@seqs, \%options )
18    #
19    #  Options:
20    #
21    #     max_prefix => $limit  #  limit of residues to be added at beginning
22    #     max_suffix => $limit  #  limit of residues to be added at end
23    #     pad_char   => $char   #  character to pad beginning and end (D = ' ')
24    #
25    #-------------------------------------------------------------------------------
26    #  Change the pad character at the ends of an alignment:
27    #
28    #     \@align = repad_alignment( \@align, \%options )
29    #     \@align = repad_alignment(          \%options )
30    #      @align = repad_alignment( \@align, \%options )
31    #      @align = repad_alignment(          \%options )
32    #
33    #  Options:
34    #
35    #     pad_char => $char      #  character to pad beginning and end (D = ' ')
36    #     old_pad  => $regexp    #  characters to replace at end (D = [^A-Za-z.*])
37    #
38    #-------------------------------------------------------------------------------
39    #  Color an alignment by residue type
40    #
41    #       \@align             = color_alignment_by_residue( \@align, \%options )
42    #       \@align             = color_alignment_by_residue(          \%options )
43    #     ( \@align, \@legend ) = color_alignment_by_residue( \@align, \%options )
44    #     ( \@align, \@legend ) = color_alignment_by_residue(          \%options )
45    #
46    #  Options:
47    #
48    #      align     => \@alignment  #  alignment if not supplied as parameter
49    #      alignment => \@alignment  #  alignment if not supplied as parameter
50    #      colors    => \%colors     #  character colors (html spec.)
51    #      pallet    =>  $pallet     #  ale | gde | default
52    #      protein   =>  $bool       #  indicates a protein alignment
53    #
54    #-------------------------------------------------------------------------------
55    #  Color an alignment by consensus
56    #
57    #       \@align             = color_alignment_by_consensus( \@align, \%options )
58    #       \@align             = color_alignment_by_consensus(          \%options )
59    #     ( \@align, \%legend ) = color_alignment_by_consensus( \@align, \%options )
60    #     ( \@align, \%legend ) = color_alignment_by_consensus(          \%options )
61    #
62    #  Options:
63    #
64    #      align      => \@alignment   #  Alignment if not supplied as parameter
65    #      alignment  => \@alignment   #  Alignment if not supplied as parameter
66    #      colors     => \%colors      #  HTML colors for consensus categories
67    #      matrix     => \%scr_matrix  #  Hash of hashes of character align scores
68    #      max_f_diff =>  $max_f_diff  #  Maximum fraction exceptions to consensus
69    #      max_n_diff =>  $max_n_diff  #  Maximum number of exceptions to consensus
70    #      min_score  =>  $score       #  Score for conservative change (D=1)
71    #      protein    =>  $is_protein  #  Indicates a protein alignment
72    #
73    #-------------------------------------------------------------------------------
74    #  Make an html table with an alignment:
75    #
76    #       $html                = alignment_2_html_table( \@alignment, \%options )
77    #       $html                = alignment_2_html_table(              \%options )
78    #     ( $html, $javascript ) = alignment_2_html_table( \@alignment, \%options )
79    #     ( $html, $javascript ) = alignment_2_html_table(              \%options )
80    #
81    #  In scalar context, the routine returns a single block of html that includes
82    #  the JavaScript followed by the table.  In list context, they are returned
83    #  separately.
84    #
85    #  Options:
86    #
87    #     align        => \@alignment  #  Alignment, when not a parameter
88    #     alignment    => \@alignment  #  Alignment, when not a parameter
89    #     key          => \@legend     #  Append the supplied legend
90    #     legend       => \@legend     #  Append the supplied legend
91    #     nojavascript =>  $boolean    #  Omit the JavaScript for pop-ups
92    #     tooltip      =>  $boolean    #  Add pop-up tooltip to sequences
93    #     tooltip      => \%id2tip     #   (specify the tip for each id)
94    #
95    #  Each sequence can be a string, or an array of [ text, color ] pairs.
96    #  @legend is an array of lines of strings and/or [ text, color ] pairs.
97    #
98    #  Default tooltip is the id and description, but user can supply a
99    #  hash with arrays of alternative mouseover parameters:
100    #
101    #     mouseover( @{ $tooltip->{ $id } } )
102    #     mouseover( $ttl, $text, $menu, $parent, $ttl_color, $text_color )
103    #-------------------------------------------------------------------------------
104    #  Make an html page with an alignment:
105    #
106    #     $html = alignment_2_html_page( \@alignment, \%options )
107    #     $html = alignment_2_html_page(              \%options )
108    #
109    #  Options:
110    #
111    #     align     => \@alignment
112    #     alignment => \@alignment
113    #     key       => \@legend
114    #     legend    => \@legend
115    #     title     =>  $page_title
116    #
117    #  Each sequence can be a string, or an array of character-color pairs.
118    #-------------------------------------------------------------------------------
119    
120  #  Some global defaults:  #  Some global defaults:
121    
122  my $max_n_diff = 1;     # Maximum number of exceptions to consensus  my $max_n_diff = 1;     # Maximum number of exceptions to consensus
# Line 683  Line 792 
792  #     legend       => \@legend     #  Append the supplied legend  #     legend       => \@legend     #  Append the supplied legend
793  #     nojavascript =>  $boolean    #  Omit the JavaScript for pop-ups  #     nojavascript =>  $boolean    #  Omit the JavaScript for pop-ups
794  #     tooltip      =>  $boolean    #  Add pop-up tooltip to sequences  #     tooltip      =>  $boolean    #  Add pop-up tooltip to sequences
795    #     tooltip      => \%id2tip     #   (specify the tip for each id)
796  #  #
797  #  Each sequence can be a string, or an array of [ text, color ] pairs.  #  Each sequence can be a string, or an array of [ text, color ] pairs.
798  #  @legend is an array of lines of strings and/or [ text, color ] pairs.  #  @legend is an array of lines of strings and/or [ text, color ] pairs.
799    #
800    #  Default tooltip is the id and description, but user can supply a
801    #  hash with arrays of alternative mouseover parameters:
802    #
803    #     mouseover( @{ $tooltip->{ $id } } )
804    #     mouseover( $ttl, $text, $menu, $parent, $ttl_color, $text_color )
805  #-------------------------------------------------------------------------------  #-------------------------------------------------------------------------------
806  sub alignment_2_html_table  sub alignment_2_html_table
807  {  {
# Line 715  Line 831 
831      {      {
832          if ( $tooltip )          if ( $tooltip )
833          {          {
834                #  Default tooltip is the id and description, but user can supply a
835                #  hash with alternative mouseover parameters:
836                #
837              # mouseover( $ttl, $text, $menu, $parent, $ttl_color, $text_color )              # mouseover( $ttl, $text, $menu, $parent, $ttl_color, $text_color )
838                #
839              my @args = ( $_->[0], ( $_->[1] || ' ' ), '', '', '', '' );              my @args;
840                if ( ( ref( $tooltip ) eq 'HASH' )
841                  && ( ref( $tooltip->{ $_->[0] } ) eq 'ARRAY' )
842                   )
843                {
844                    @args = @{ $tooltip->{ $_->[0] } }
845                }
846                else
847                {
848                    @args = ( $_->[0], ( $_->[1] || ' ' ) );
849                }
850              $tiplink = '<A' . &mouseover( @args ) . '>';              $tiplink = '<A' . &mouseover( @args ) . '>';
851          }          }
852    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3