NAME
Bio::Align::Graphics - Graphic Rendering of Bio::Align::AlignI Objects
SYNOPSIS
use Bio::Align::Graphics;#Get an AlignI object, usually by using Bio::AlignIOmy $file=shift @ARGV;my $in=new Bio::AlignIO(-file=>$file, -format=>'clustalw');my $aln=$in->next_aln();#Create a new Graphics objectmy $print_align = new Bio::Align::Graphics(align => $aln);#Draw the alignment$print_align->draw();
DESCRIPTION
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.
An example:
#!/usr/bin/perl -wuse Bio::AlignIO;use Bio::Align::Graphics;use strict;#Get an alignment filemy $file = shift @ARGV;#Create an AlignI object using AlignIOmy $in=new Bio::AlignIO(-file=>$file, -format=>'clustalw');#Read the alignmentmy $aln=$in->next_aln();#Create some domains for highlightingmy @domain_start = ( 25 , 50, 80 );my @domain_end = ( 40 , 60 , 100 );my @domain_color = ( 'red' , 'cyan' , 'green' );#Create Labels for the domainsmy @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 labelsmy %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();
METHODS
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.
CONSTRUCTORS
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 besupplied to drawan alignmentoutput Filename to print image to STDOUTout_format png, jpeg, gif, gd pngfont Size of font, ranging from 1 to 5 2and equal to the standard GD fontsranging from gdTinyFont togdGiantFontx_label Draws a scale numbering alignment truebases along top of image, every xbases are numbered, where x is theblock_size optiony_label Draws sequence ids of alignment truealong left side of imagebg_color Background color of the image whitefont_color Color of the font used for drawing blackthe alignment charactersx_label_color Color of the font used for drawing redthe base scale charactersy_label_color Color of the font used for drawing bluethe sequence id charactersp_color Colors protein bases according to falsea coloring scheme proposed by W.R.Taylor(Protein Engineering, vol 10no 7, 1997), only works withprotein alignmentspad_top Additional whitespace characters 5between top of image and x-labelpad_bottom Additional whitespace characters 5between bottom of image andalignmentpad_left Additional whitespace characters 5between left side of image andy-labelpad_right Additional whitespace characters 5between right side of image andalignmentx_label_space Additional whitespace characters 1between x_label and alignmenty_label_space Additional whitespace characters 1between y_label and alignmentreference Characters which are identical to falsethe reference sequence are replacedwith the match characterreference_id Sequence id of the sequence to use First sequenceas the reference supplied in alignmentmatch_char Character to replace identical bases .in aligned sequencesblock_size Number of bases to group together 10when printing alignment, groups areseparated by whitespaceblock_space Amount of character whitespace to 2separate groups of bases bylabels A hash containing labels to be noneprinted beneath the alignment,where the keys are the bases toprint the values atdm_start An array containing start bases nonefor highlighting of segments ofthe alignment, paired with dm_endoptiondm_end An array containing end bases nonefor highlighting of segments ofthe alignment, paired with dm_startoptionsdm_color An array containing colors for silverhighlighting segments of basesdenoted by the coordinateslocated in the dm_start and dm_endoptionsdml_start An array containing start bases nonefor addition of domain labelsunderneath the alignment, pairedwith dml_enddml_end An array containing end bases nonefor addition of domain labelsunderneath the alignment, pairedwith dml_startdml_color An array containing colors for silverthe domain labels denoted by thecoordinates located in thedml_start and dml_end optionsdm_labels An array containing labels to be noneprinted underneath specifieddomains, each label shouldcorrespond with the base positionlocated in the dml_start optionshow_nonsynonymous Boolean value to turn option falseon or off. If 0 (or undef), optionis 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.
OBJECT METHODS
- $draw_align->draw();
-
The draw() method draws the image with the options that were specified with new().
- $draw_align->width();
-
Get the width of the image created with new(), in pixels.
- $draw_align->height();
-
Get the height of the image created with new(), in pixels.
- $draw_align->aln_length();
-
Get the length of the alignment submitted to new().
- $draw_align->aln_format();
-
Get the format of the alignment submitted to new().
- $draw_align->no_sequences();
-
Get the number of sequences in the alignment submitted to new().
AUTHORS AND CONTRIBUTORS
William McCaig, <[email protected]>
Mikhail Bekarev, <[email protected]>
Yoezen Hernandez, <[email protected]>
Weigang Qiu (Corresponding Developer), <[email protected]>
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.
SEE ALSO
Bio::Align::AlignI, Bio::AlignIO, GD, GD::Simple