[Bio] / FigKernelScripts / gd_tree.pl Repository:
ViewVC logotype

Annotation of /FigKernelScripts/gd_tree.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : golsen 1.1 #
2 :     # Copyright (c) 2003-2009 University of Chicago and Fellowship
3 :     # for Interpretations of Genomes. All Rights Reserved.
4 :     #
5 :     # This file is part of the SEED Toolkit.
6 :     #
7 :     # The SEED Toolkit is free software. You can redistribute
8 :     # it and/or modify it under the terms of the SEED Toolkit
9 :     # Public License.
10 :     #
11 :     # You should have received a copy of the SEED Toolkit Public License
12 :     # along with this program; if not write to the University of Chicago
13 :     # at info@ci.uchicago.edu or the Fellowship for Interpretation of
14 :     # Genomes at veronika@thefig.info or download a copy from
15 :     # http://www.theseed.org/LICENSE.TXT.
16 :     #
17 :    
18 :     my $usage = <<'End_of_Usage';
19 :    
20 :     Usage: gd_tree [ options ] < newick_tree > png_file
21 :    
22 :     Options:
23 :    
24 :     -bc r,g,b # Background color (D = transparent)
25 :     -bp position # Scale bar position: upper_left | ul | lower_left | ll
26 :     # | upper_right | ur | lower_right | lr
27 :     # (D = upper_left)
28 :     -dx pixels # Minimum delta x at node (D = 0)
29 :     -dy pixels # Vertical space between tips (D = 12)
30 :     -f font # GD font name: gdTinyFont | gdSmallFont | gdLargeFont
31 :     # (D depends on dy)
32 :     -lc r,g,b # Line color (D = 0,0,0)
33 :     -lt pixels # Line thickness (D = 1)
34 :     -tb r,g,b # Text background color (D = none)
35 :     -tc r,g,b # Text color (D = 0,0,0)
36 :     -ts pixels # Text size (D = 0.8 * dy)
37 :     -u # Display this usage information
38 :     -w pixels # Tree width without labels (D = 540)
39 :     -xs scale # Pixels per unit branch length (D = scaled to width)
40 :    
41 :     All color r,g,b values are on 0-255 color intensity range
42 :    
43 :     Any node in the tree can have a comment of the form:
44 :    
45 :     [&&treeLayout: key => value; key => value; ...]
46 :    
47 :     Allowed key => value pairs within a tree are:
48 :    
49 :     bkg_color => [r,g,b]
50 :     line_color => [r,g,b]
51 :     thickness => pixels
52 :     text_bkg_color => [r,g,b]
53 :     text_color => [r,g,b]
54 :    
55 :     End_of_Usage
56 :    
57 :     use FIG;
58 :     use gjonewicklib;
59 :     use strict;
60 :     use gd_tree_0; # Note that the package name is just gd_tree
61 :    
62 :     my %options = ();
63 :    
64 :     my $val;
65 :     while ( @ARGV && $ARGV[0] =~ s/^-// )
66 :     {
67 :     $_ = shift;
68 :     if ( s/^bc// ) { $val = $_ || shift; $options{ bkg_color } = [ split ',', $val ]; next }
69 :     if ( s/^bp// ) { $val = $_ || shift; $options{ bar_position } = $val; next }
70 :     if ( s/^dx// ) { $val = $_ || shift; $options{ min_dx } = $val; next }
71 :     if ( s/^dy// ) { $val = $_ || shift; $options{ dy } = $val; next }
72 :     if ( s/^f// ) { $val = $_ || shift; $options{ font } = $val; next }
73 :     if ( s/^lc// ) { $val = $_ || shift; $options{ line_color } = [ split ',', $val ]; next }
74 :     if ( s/^lt// ) { $val = $_ || shift; $options{ thickness } = $val; next }
75 :     if ( s/^tb// ) { $val = $_ || shift; $options{ text_bkg_color } = [ split ',', $val ]; next }
76 :     if ( s/^tc// ) { $val = $_ || shift; $options{ text_color } = [ split ',', $val ]; next }
77 :     if ( s/^ts// ) { $val = $_ || shift; $options{ text_size } = $val; next }
78 :     if ( s/^u// ) { print STDERR $usage; exit }
79 :     if ( s/^w// ) { $val = $_ || shift; $options{ width } = $val; next }
80 :     if ( s/^xs// ) { $val = $_ || shift; $options{ x_scale } = $val; next }
81 :    
82 :     if ( /\S/ ) { print STDERR "Bad flag: '$_'\n", $usage; exit }
83 :     }
84 :    
85 :     my $tree = gjonewicklib::parse_newick_tree_str( join('',<>) );
86 :    
87 :     gd_tree::newick_gd_png( $tree, \%options );

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3