The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Bio::Draw::Pictogram - generate SVG output of Pictogram display for consensus motifs

SYNOPSIS

use Bio::Draw::Pictogram;
use Bio::SeqIO;

my $sio = Bio::SeqIO->new(-file=>$ARGV[0],-format=>'fasta');
my @seq;
while(my $seq = $sio->next_seq){
  push @seq, $seq;
}

my $picto = Bio::Draw::Pictogram->new(-width=>"800",
                                  -height=>"500",
                                  -fontsize=>"60",
                                  -plot_bits=>1,
                                  -background=>{
                                                'A'=>0.25,
                                                'C'=>0.18,
                                                'T'=>0.32,
                                                'G'=>0.25},
                                  -color=>{'A'=>'red',
                                           'G'=>'blue',
                                           'C'=>'green',
                                           'T'=>'magenta'});

my $svg = $picto->make_svg(\@seq);

print $svg->xmlify."\n";

#Support for Bio::Matrix::PSM::SiteMatrix now included

 use Bio::Matrix::PSM::IO;

 my $picto = Bio::Draw::Pictogram->new(-width=>"800",
                                  -height=>"500",
                                  -fontsize=>"60",
                                  -plot_bits=>1,
                                  -background=>{
                                                'A'=>0.25,
                                                'C'=>0.18,
                                                'T'=>0.32,
                                                'G'=>0.25},
                                  -color=>{'A'=>'red',
                                           'G'=>'blue',
                                           'C'=>'green',
                                           'T'=>'magenta'});

my $psm = $psmIO->next_psm;
my $svg = $picto->make_svg($psm);
print $svg->xmlify;

DESCRIPTION

A module for generating SVG output of Pictogram display for consensus motifs. This method of representation was describe by Burge and colleagues: (Burge, C.B.,Tuschl, T., Sharp, P.A. in The RNA world II, 525-560, CSHL press, 1999)

This is a simple module that takes in an array of sequences (assuming equal lengths) and calculates relative base frequencies where the height of each letter reflects the frequency of each nucleotide at a given position. It can also plot the information content at each position scaled by the background frequencies of each nucleotide.

It requires the SVG-2.26 or later module by Ronan Oger available at http://www.cpan.org

Recommended viewing of the SVG is the plugin available at Adobe: http://www.adobe.com/svg

FEEDBACK

Mailing Lists

User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to one of the Bioperl mailing lists. Your participation is much appreciated.

bioperl-l@bioperl.org                  - General discussion
http://bioperl.org/wiki/Mailing_lists  - About the mailing lists

Support

Please direct usage questions or support issues to the mailing list:

bioperl-l@bioperl.org

rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible.

Reporting Bugs

Report bugs to the Bioperl bug tracking system to help us keep track the bugs and their resolution. Bug reports can be submitted via the web:

https://github.com/bioperl/bioperl-live/issues

AUTHOR - Shawn Hoon

Email shawnh@fugu-sg.org

APPENDIX

The rest of the documentation details each of the object methods. Internal methods are usually preceded with a "_".

new

Title   : new
Usage   : my $picto = Bio::Draw::Pictogram->new(-width=>"800",
                                           -height=>"500",
                                           -fontsize=>"60",
                                           -plot_bits=>1,
                                           -background=>{
                                                         'A'=>0.25,
                                                         'C'=>0.18,
                                                         'T'=>0.32,
                                                         'G'=>0.25},
                                           -color=>{'A'=>'red',
                                                     'G'=>'blue',
                                                     'C'=>'green',
                                                     'T'=>'magenta'});
Function: Constructor for Pictogram Object
Returns : L<Bio::Draw::Pictogram>

make_svg

Title   : make_svg
Usage   : $picto->make_svg();
Function: make the SVG object
Returns : L<SVG>
Arguments: A fasta file or array ref of L<Bio::Seq> objects or a L<Bio::Matrix::PSM::SiteMatrixI>

fontsize

Title   : fontsize
Usage   : $picto->fontsize();
Function: get/set for fontsize
Returns : int
Arguments: int

color

Title   : color
Usage   : $picto->color();
Function: get/set for color
Returns : a hash reference
Arguments: a hash  reference

svg_obj

Title   : svg_obj
Usage   : $picto->svg_obj();
Function: get/set for svg_obj
Returns : L<SVG>
Arguments: L<SVG>

plot_bits

Title   : plot_bits
Usage   : $picto->plot_bits();
Function: get/set for plot_bits to indicate whether to plot
          information content at each base position
Returns :1/0
Arguments: 1/0

normalize

Title   : normalize
Usage   : $picto->normalize($newval)
Function: get/set to make all columns the same height.
          default is to scale height with information
          content.
Returns : value of normalize (a scalar)
Args    : on set, new value (a scalar or undef, optional)

background

Title   : background
Usage   : $picto->background();
Function: get/set for hash reference of nucleodtide bgd frequencies
Returns : hash reference
Arguments: hash reference

pwm

Title   : pwm
Usage   : $picto->pwm();
Function: get/set for pwm
Returns : int
Arguments: int