|Bio::Align::Graphics(3pm)||User Contributed Perl Documentation||Bio::Align::Graphics(3pm)|
Bio::Align::Graphics - Graphic Rendering of Bio::Align::AlignI Objects
use Bio::Align::Graphics; #Get an AlignI object, usually by using Bio::AlignIO my $file=shift @ARGV; my $in=new Bio::AlignIO(-file=>$file, -format=>'clustalw'); my $aln=$in->next_aln(); #Create a new Graphics object my $print_align = new Bio::Align::Graphics(align => $aln); #Draw the alignment $print_align->draw();
Bio::Align::Graphics is a module designed to create image files out of Bio::Align::AlignI objects. An alignment may be manipulated with various formatting and highlighting options.
#!/usr/bin/perl -w use Bio::AlignIO; use Bio::Align::Graphics; use strict; #Get an alignment file my $file = shift @ARGV; #Create an AlignI object using AlignIO my $in=new Bio::AlignIO(-file=>$file, -format=>'clustalw'); #Read the alignment my $aln=$in->next_aln(); #Create some domains for highlighting my @domain_start = ( 25 , 50, 80 ); my @domain_end = ( 40 , 60 , 100 ); my @domain_color = ( 'red' , 'cyan' , 'green' ); #Create Labels for the domains my @dml = ("CARD", "Proline Rich", "Transmembrane"); my @dml_start = (25, 50, 80); my @dml_end = (40, 60, 100); my @dml_color = ("lightpink", "lightblue", "lightgreen"); #Create individual labels my %labels = ( 145 => "Hep-c target"); my $print_align = new Bio::Align::Graphics( align => $aln, pad_bottom => 5, domain_start => \@domain_start, domain_end => \@domain_end, dm_color => \@domain_color, dm_labels => \@dml, dm_label_start => \@dml_start, dm_label_end => \@dml_end, dm_label_color => \@dml_color, labels => \%labels, out_format => "png"); $print_align->draw();
This section describes the class and object methods for Bio::Align::Graphics.
Typically you will begin by creating a Bio::Align::Graphics object, passing it an alignment object created using Bio::AlignIO. The Bio::Align::Graphics->new() method has a number of configuration variables that allow you to control the appearance of the final image.
You will then call the draw() method to output the final image.
new() is the constructor for Bio::Align::Graphics:
- $print_align = Bio::Align::Graphics->new(@options)
- The new() method creates a new graphics object. The options are a
set of tag/value pairs as follows:
Option Value Default ------ ----- ------- align Bio::AlignI object None, must be supplied to draw an alignment output Filename to print image to STDOUT out_format png, jpeg, gif, gd png font Size of font, ranging from 1 to 5 2 and equal to the standard GD fonts ranging from gdTinyFont to gdGiantFont x_label Draws a scale numbering alignment true bases along top of image, every x bases are numbered, where x is the block_size option y_label Draws sequence ids of alignment true along left side of image bg_color Background color of the image white font_color Color of the font used for drawing black the alignment characters x_label_color Color of the font used for drawing red the base scale characters y_label_color Color of the font used for drawing blue the sequence id characters p_color Colors protein bases according to false a coloring scheme proposed by W.R. Taylor(Protein Engineering, vol 10 no 7, 1997), only works with protein alignments pad_top Additional whitespace characters 5 between top of image and x-label pad_bottom Additional whitespace characters 5 between bottom of image and alignment pad_left Additional whitespace characters 5 between left side of image and y-label pad_right Additional whitespace characters 5 between right side of image and alignment x_label_space Additional whitespace characters 1 between x_label and alignment y_label_space Additional whitespace characters 1 between y_label and alignment reference Characters which are identical to false the reference sequence are replaced with the match character reference_id Sequence id of the sequence to use First sequence as the reference supplied in alignment match_char Character to replace identical bases . in aligned sequences block_size Number of bases to group together 10 when printing alignment, groups are separated by whitespace block_space Amount of character whitespace to 2 separate groups of bases by labels A hash containing labels to be none printed beneath the alignment, where the keys are the bases to print the values at dm_start An array containing start bases none for highlighting of segments of the alignment, paired with dm_end option dm_end An array containing end bases none for highlighting of segments of the alignment, paired with dm_start options dm_color An array containing colors for silver highlighting segments of bases denoted by the coordinates located in the dm_start and dm_end options dml_start An array containing start bases none for addition of domain labels underneath the alignment, paired with dml_end dml_end An array containing end bases none for addition of domain labels underneath the alignment, paired with dml_start dml_color An array containing colors for silver the domain labels denoted by the coordinates located in the dml_start and dml_end options dm_labels An array containing labels to be none printed underneath specified domains, each label should correspond with the base position located in the dml_start option show_nonsynonymous Boolean value to turn option false on or off. If 0 (or undef), option is off. If 1 (or non-0), option is on. Only valid for nucleotide alignments. Output images are wider with this option on.
Note that all arrays and hashes must be passed by reference.
- The draw() method draws the image with the options that were specified with new().
- Get the width of the image created with new(), in pixels.
- Get the height of the image created with new(), in pixels.
- Get the length of the alignment submitted to new().
- Get the format of the alignment submitted to new().
- Get the number of sequences in the alignment submitted to new().
AUTHORS AND CONTRIBUTORS¶
William McCaig, <firstname.lastname@example.org>
Mikhail Bekarev, <email@example.com>
Yoezen Hernandez, <firstname.lastname@example.org>
Weigang Qiu (Corresponding Developer), <email@example.com>
COPYRIGHT AND LICENSE¶
Copyright (C) 2006-2008 by William McCaig
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available.
Bio::Align::AlignI, Bio::AlignIO, GD, GD::Simple