« Return to Thread: Access the parent of a Bio::DB::SeqFeature within a gbrowse config callback function

Re: Access the parent of a Bio::DB::SeqFeature within a gbrowse config callback function

by Lincoln Stein :: Rate this Message:

Reply to Author | View in Thread

The objects are set up without parent pointers in order to avoid circular references, which make memory management a nightmare. It's a bit ugly, but if you set all_callbacks to true, then the callback will be invoked on the parent object as well, and you can simply store it into a global variable for access from the child. The operation is depth first, so the callback will be invoked on the child immediately after the parent.

A better long-term solution would be to add a method such that the parent is available by making a method call on the glyph object. I'll have a look.

Lincoln

On 6/1/07, Daniel Lang <daniel.lang@...> wrote:
Hi,

I'm looking for an efficient way (hack) to access the parent of a given
feature within a callback function in a gbrowse config. Currently I do
it like this:
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 (@p) {


                                $parent = @{ [ grep {$_ and $_->seq_id eq
$feature->seq_id and $_->location->contains($feature->location)}
$store->get_features_by_alias($p[0])] }[0];

                        }


                        else { last; }
                        }


                until ($parent and ($name = $parent->name));


        }
}
The callback is used in to produce popups within a link attribute
(ggbmenu.js).
The problems with this approach are a)effciency and b) if a feature on
the same region exists with the same ID.

So I wonder if there is some "magic" object/variable in the scope of the
callback I could use? I originally hoped that this would work with
something like $GBROWSE...

Additionally, it would be great if someone could point me to code that
uses these "meta variables" ( e.g. access browser or track or panel
objects) to generate content.

Thanks in advance,

Daniel

--

Daniel Lang
University of Freiburg, Plant Biotechnology
Schaenzlestr. 1, D-79104 Freiburg
fax: +49 761 203 6945
phone: +49 761 203 6974
homepage:  http://www.plant-biotech.net/
e-mail: daniel.lang@...

#################################################
My software never has bugs.
It just develops random features.
#################################################




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Gmod-gbrowse mailing list
Gmod-gbrowse@...
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse



--
Lincoln D. Stein
Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724
(516) 367-8380 (voice)
(516) 367-8389 (fax)
FOR URGENT MESSAGES & SCHEDULING,
PLEASE CONTACT MY ASSISTANT,
SANDRA MICHELSEN, AT michelse@...
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Gmod-gbrowse mailing list
Gmod-gbrowse@...
https://lists.sourceforge.net/lists/listinfo/gmod-gbrowse

 « Return to Thread: Access the parent of a Bio::DB::SeqFeature within a gbrowse config callback function