|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
DNA sequence callbackHi,
I'm trying to show the reference nucleotide sequence for some features in a balloon popup. I've tryed with a callback using: $self = shift; $refseq = $self->dna; but it's not working, how can I do it ? thank you very much Miquel Ramia ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gmod-gbrowse mailing list Gmod-gbrowse@... https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse |
|
|
Re: DNA sequence callbackHi Miquel,
If my Perl were better I might be able to tell you. I'm attaching two routines from the dna glyph that I'm hoping will make it easy for you (or people with better Perl than mine) to figure out how to display the sequence. The dna glyph shows bases at high magnifications, and %gc at lower magnifications. Dave C sub draw_component { my $self = shift; my $gd = shift; my ($x1,$y1,$x2,$y2) = $self->bounds(@_); my $dna = eval { $self->feature->seq }; $dna = $dna->seq if ref($dna) and $dna->can('seq'); # to catch Bio::PrimarySeqI objects $dna or return; # workaround for my misreading of interface -- LS $dna = $dna->seq if ref($dna) && $dna->can('seq'); if ($self->dna_fits) { $self->draw_dna($gd,$dna,$x1,$y1,$x2,$y2); } elsif ($self->do_gc) { $self->draw_gc_content($gd,$dna,$x1,$y1,$x2,$y2); } } sub draw_dna { my $self = shift; my ($gd,$dna,$x1,$y1,$x2,$y2) = @_; my $pixels_per_base = $self->scale; my $feature = $self->feature; my $strand = $feature->strand || 1; $strand *= -1 if $self->{flip}; my @bases = split '',$strand >= 0 ? $dna : $self->reversec($dna); my $color = $self->fgcolor; my $font = $self->font; my $lineheight = $font->height; $y1 -= $lineheight/2 - 3; my $strands = $self->option('strand') || 'auto'; my ($forward,$reverse); if ($strands eq 'auto') { $forward = $feature->strand >= 0; $reverse = $feature->strand <= 0; } elsif ($strands eq 'both') { $forward = $reverse = 1; } elsif ($strands eq 'reverse') { $reverse = 1; } else { $forward = 1; } # minus strand features align right, not left $x1 += $pixels_per_base - $font->width - 1 if $strand < 0; for (my $i=0;$i<@bases;$i++) { my $x = $x1 + $i * $pixels_per_base; $gd->char($font,$x+2,$y1,$bases[$i],$color) if $forward; $gd->char($font,$x+2,$y1+($forward ? $lineheight:0), $complement{$bases[$i]}||$bases[$i],$color) if $reverse; } } 2009/11/10 Miquel Ràmia <miquel.ramia@...>: > Hi, > > I'm trying to show the reference nucleotide sequence for some features > in a balloon popup. I've tryed with a callback using: > > $self = shift; > $refseq = $self->dna; > > but it's not working, how can I do it ? > > thank you very much > > Miquel Ramia > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Gmod-gbrowse mailing list > Gmod-gbrowse@... > https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse > -- Please keep responses on the list! http://gmod.org/wiki/January_2010_GMOD_Meeting http://gmod.org/wiki/GMOD_News Was this helpful? http://gmod.org/wiki/Help_Desk_Feedback ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gmod-gbrowse mailing list Gmod-gbrowse@... https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse |
|
|
Re: DNA sequence callbackHi Miquel,
IIRC, the trick is that the dna method returns a Bio::Seq object, not a dna string. To get the dna string, you have to call the seq method on it, so like this: my $refseq = $self->dna->seq; Scott 2009/11/10 Miquel Ràmia <miquel.ramia@...>: > Hi, > > I'm trying to show the reference nucleotide sequence for some features > in a balloon popup. I've tryed with a callback using: > > $self = shift; > $refseq = $self->dna; > > but it's not working, how can I do it ? > > thank you very much > > Miquel Ramia > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Gmod-gbrowse mailing list > Gmod-gbrowse@... > https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse > -- ------------------------------------------------------------------------ Scott Cain, Ph. D. scott at scottcain dot net GMOD Coordinator (http://gmod.org/) 216-392-3087 Ontario Institute for Cancer Research ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Gmod-gbrowse mailing list Gmod-gbrowse@... https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse |
| Free embeddable forum powered by Nabble | Forum Help |