[Bioperl-l] Bio::Graphics - Howto Show Negative Start-End and Enable Connector
Siddhartha Basu
basu at pharm.sunysb.edu
Fri Apr 20 16:37:57 UTC 2007
Hi,
Wijaya Edward wrote:
> Dear expert,
>
> My figure here: http://defiant.i2r.a-star.edu.sg/~ewijaya/misc/foo2.png <http://defiant.i2r.a-star.edu.sg/%7Eewijaya/misc/foo2.png>
> is created with the script (down below).
>
> How can I modify the script such that:
>
> 1. The arrow track is represented in negative form.
> I.e. instead of 1 to 300, we use -300 to 0.
>
> I tried this, but won't do:
>
> my $flen = Bio::SeqFeature::Generic->new(
> -start => -300,
> -end => 0, );
It works if you pass the 'SeqFeature' object to the '-segment' option of
"Bio::Graphics::Panel".
my $panel = Bio::Graphics::Panel->new(
-length => 300,
-width => 500,
-pad_left => 70,
-pad_right => 70,
-key_style => 'left',
-connector => 'solid',
-segment => $flen,
);
For more, read one of the previous posting,
http://article.gmane.org/gmane.comp.lang.perl.bio.general/1721/match=negative+seqfeature
-siddhartha
>
> And how can I make these number to appear
> for every gridpoints (not just two as I have now).
>
>
> 2. How can I enable the connector with grid just like
> I had in the first panel? (as you can see, my script
> has connector added, but still doesn't show).
>
> All, in all, I am trying to mimic this figure:
> http://nar.oxfordjournals.org/content/vol31/issue13/images/large/gkg56702.jpeg <http://nar.oxfordjournals.org/content/vol31/issue13/images/large/gkg56702.jpeg>
>
> And here is my script:
>
> __BEGIN__
> #!/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;
> 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, # tried -300
> -end => 300, # and 0, but failed.
> );
>
> 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 => "dashed"
> -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;
>
> #The DATA is simply just list of string and its location in their
> respective sequence.
> # The figure is just the plot of it out.
> __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
> __END__
>
>
> Thanks and hope to hear from you again.
>
> --
> Regards,
>
> Edward WIJAYA
>
> ------------ Institute For Infocomm Research - Disclaimer -------------
> This email is confidential and may be privileged. If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.
> --------------------------------------------------------
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
More information about the Bioperl-l
mailing list