[Gmod-help] Re: [Gmod-gbrowse] arguments to call back functions in GBrowse2

Daniel Lang daniel.lang at biologie.uni-freiburg.de
Wed Nov 25 06:33:56 EST 2009


Hi Dave,

thanks a lot for digging the mail out. Did you find it in the bioperl-l
archive? I spent some time looking for it in online archives and
couldn't find it... And when I google with parts of the message pasted
below I don't find it either.

I know I could find it two weeks back when I posted a similar mail to
the bioperl-l...Mysterious

Best regards,
Daniel

On Tue, 2009-11-24 at 10:51 -0800, Dave Clements, GMOD Help Desk wrote: 
> Hi Daniel,
> 
> I don't know why the code below would be causing memory problems
> (unless the top "parent" feature points to itself?).  However, I did
> find the earlier email exchange with Lincoln.  From May 29, 2009:
> -----------------
> Hi,
> 
> This issue has come up again recently and I am posting a fix that is
> better than the one suggested in the original email thread.
> 
> Callbacks actually take five arguments, although most people ignore
> all but the first. The fifth argument is the glyph, and you can get
> the parent feature from that. Here's the code:
> 
>  bgcolor = sub {
>      my ($feature, $option_name, $part_no, $total_parts, $glyph) = @_;
>      my $parent_feature = $glyph->parent_feature;
>      # do something on the parent feature
>  }
> 
> You can pass arguments to $glyph->parent_feature() to get the
> grandparent, great-grandparent, etc.
> 
> Lincoln
> ---------------------
> However, you mentioned that you are only getting the first 3 arguments.
> 
> Does anyone know if there is something special about callbacks in a
> popup balloon context, where they would only pass 3 arguments?
> 
> Thanks,
> 
> Dave C.
> 
> On Mon, Nov 23, 2009 at 3:42 AM, Daniel Lang
> <daniel.lang at biologie.uni-freiburg.de> wrote:
> > Hi,
> >
> > I am running gbrowse2 on Bio::DB::SeqFeature database and am experiencing problems with callback functions. I need to access the parent object of the current object easily.
> >
> > Currently I am using the following approach:
> > if ($feature->get_tag_values('parent_id')) {
> >                my $store = $parent->object_store;
> >                if ($store and $store->can_store_parentage) {
> >                        do {
> >                                my @p = $parent->get_tag_values('parent_id') if $parent;
> >                                if (@p) {
> >                                        $parent = @{[grep {$_ and $_->seq_id eq $parent->seq_id and ${[$_->get_tag_values("load_id")]}[0] eq $p[0]} $store->get_features_by_alias($p[0])]}[0];
> >                                }
> >                                else { last; }
> >                        }
> >                        until ($parent and ($parent->name));
> >                }
> > ...
> >
> > This is from a callback function for "balloon click". I have tried both only one process or gbrowse_slaves, the result is the same.
> > Sometimes (?) this code seems to cause a memory problems.
> > The memory of the apache or slave process increases as if they were stuck in an infinite loop.
> >
> > So I am looking for ways to avoid the above procedure, by finding a more direct way to access the parent feature.
> >
> > Following the suggestion of a mail thread on this topic on the bioperl mailinglist between Lincoln/myself I
> > expected 5 arguments, but I am getting only three: $feature,$panel,$track.
> >
> > I cannot find the original mail anymore, but if I remember correctly Lincoln mentioned that he had added a parent accessor routine
> > to the glyph and that I could access the glyph from the callback's 5 arguments...
> >
> > In principle, I am using the latest releases/checkouts.
> > Which modules do I need to look at/update for this functionality?
> >
> > Furthermore, is there a possibility to share global variables between
> > gbrowse2 and slaves? Should this work via init_code?
> > Should modules initialized in a conf be in the scope of a slave?
> >
> > If not can I introduce modules via the slave config files, or do I need
> > to alter the slave scripts?
> >
> > Daniel
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > 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 at lists.sourceforge.net
> > 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 at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse


-- 
#################################################################
Dr. Daniel Lang 
University of Freiburg, Faculty of Biology, Plant-Biotechnology
Schaenzlestr. 1, D-79104 Freiburg, Germany
daniel.lang at biologie.uni-freiburg.de
phone: +49-761-2036989
http://www.plant-biotech.net               http://www.cosmoss.org
#################################################################

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
URL: <http://brie4.cshl.edu/pipermail/gmod-help/attachments/20091125/a470a16b/attachment.sig>


More information about the Gmod-help mailing list