Generating sequence logos with Perl, and other fun TFBS stuff

1 post / 0 new
ryan_m
ryan_m's picture
Generating sequence logos with Perl, and other fun TFBS stuff

I found a neat set of perl modules for handling many aspects of gene regulation research. I found this package here. Here is a sample script which generates a nice sequence logo from a PWM. See below for the image it generates.

#!/usr/bin/perl
use strict;
use TFBS::Matrix::ICM;
use TFBS::Matrix::PFM;

my $matrixref = [ [ 3, 3, 1, 0, 0, 3 ],
[ 0, 1, 1, 1, 0, 0 ],
[ 0, 0, 1, 2, 0, 1 ],
[ 1, 0, 1, 1, 4, 0 ]
];

my $pfm = TFBS::Matrix::PFM->new(-matrixstring => $matrixref,
-name => "MyProfile",
-ID => "M0001"
);

my $icm_version = $pfm->to_ICM($matrixref); # convert to information con

$icm_version->draw_logo(-file=>"logo.png",
-full_scale =>2.25,
-xsize=>500,
-ysize =>250,
-graph_title=>"C/EBPalpha binding site logo",
-x_title=>"position",
-y_title=>"bits");