[Gmod-help] Re: [Gmod-gbrowse] arguments to call back functions in GBrowse2
Dave Clements, GMOD Help Desk
help at gmod.org
Thu Dec 17 19:48:01 EST 2009
Hi Daniel,
You haven't done anything wrong. Sometimes questions go unanswered.
I did highlight this question to Sheldon, who I believe is the
developer of the code that you are working with, but he did not
respond on the list. I will remind him one more time and see what
happens. I'll do that today.
If your Perl is good, you can always look at the problem code
yourself. If Perl is not your strength, then that solution won't work
either. You can also post a polite reminder to the list saying "I
still haven't got this to work. Does anyone have any ideas?" or
something like that.
Best regards,
Dave C.
On Mon, Dec 14, 2009 at 1:06 AM, Daniel Lang
<daniel.lang at biologie.uni-freiburg.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi Dave,
>
> did I do something wrong that I don't get an answer?
>
> Best regards,
> Daniel
>
> 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
>>>
>>>
>>
>>
>>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAksmACEACgkQmJnbCpJAG3CiCACfQ7EbUDOwMmE8MrQSnNiR7Tu2
> 4yAAnA8jIchqE4murRLmnzgaMh5cyZZY
> =/WyP
> -----END PGP SIGNATURE-----
>
--
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
More information about the Gmod-help
mailing list