This figure is created with the following script:
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use Bio::Graphics;
use Bio::SeqFeature::Generic;
use List::Compare;
use List::Util qw(max);
my %nofseq = ( 0 => 300, 1 => 300, 2 => 300, 3 => 300, 4 => 300, 5 =>
+300 );
my @seqid = keys %nofseq;
my @lenlist = values %nofseq; #Sequence length
my $maxlen = max (@lenlist);
#print Dumper \@seqid ;
my $panel = Bio::Graphics::Panel->new(
-length => 300,
-width => 500,
-pad_left => 70,
-pad_right => 70,
-key_style => 'left',
-connector => 'solid',
);
my $flen = Bio::SeqFeature::Generic->new(
-start => 1,
-end => 300,
);
my $track1 = $panel->add_track(
$flen,
-glyph => 'arrow',
-tick => 2,
-fgcolor => 'black',
-double => 1,
);
my %nlist;
while ( <DATA> ) {
chomp;
next if /^\#/;
my ($sqi,$pos,$str,$progname) = split /\,/;
my $start = $pos + $nofseq{$sqi};
my $end = $start + length($str) + 1;
push @{$nlist{$sqi}}, $start." ".$end." ".$progname;
}
# Check which sequence has no motifs;
my @bssi = keys %nlist;
my $lc = List::Compare->new(\@seqid, \@bssi);
my @comp = $lc->get_unique;
foreach my $comp ( @comp ) {
push @{$nlist{$comp}}, '0'." ".'0'." "."NONE";
}
my %prog_color = ( "WEEDER" => 3000, "MEME" => 200, "NONE" => 0 );
foreach my $seqid ( sort keys %nlist ) {
my $track = $panel->add_track(
-glyph => 'graded_segments',
-key => "SEQ ". $seqid,
-connector => "solid"
-label => 1,
-bgcolor => 'blue',
-bump => +1,
-height => 8,
-min_score => 0,
-max_score => 5000
);
foreach my $range ( @{$nlist{$seqid}} ) {
my ($st,$en,$progname) = split(" ", $range);
my $dname = " ";
if ( $st != 0 and $en !=0 ) {
$dname = "Seq ". $seqid;
}
my $score;
if ( $progname eq "WEEDER" ) {
$score = $prog_color{$progname};
}
elsif ($progname eq "MEME" ) {
$score = $prog_color{$progname};
}
my $feature = Bio::SeqFeature::Generic->new(
-display_name => $dname,
-start => $st,
-end => $en,
-score => $score
);
$track->add_feature($feature);
}
}
print $panel->png;
__DATA__
# sequence number,pos,binding sites,program
4,-63,AGCTTTCTCT,MEME
0,-22,AACTTTGTAC,WEEDER
1,-13,AAGTTTCTCT,WEEDER
5,-228,ACCTTTGCCA,MEME
5,-121,AAGTTTGTCT,WEEDER
5,-88,AAGTTTTTCC,SPACE
3,-148,AACTTAGTCA,MEME
0,-184,AACTTTGTCT,MEME
The DATA is simply just list of string and its location in their respective sequence. The figure is just the plot of it out.
As you can see from the figure, there are some misgivings
of my script above.
I was thinking to
mimic this figure.
Does anybody has experience in dealing with such issues with
Bio::Graphics? Any idea how to achieve that?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.