[Bioperl-l] is_remote() in Location::Simple

Hilmar Lapp hilmarl@yahoo.com
Wed, 02 May 2001 10:43:31 -0700


Jason Stajich wrote:
> >
> > It appears that the concept of parent sequences in terms of locations
> > applies to sub-locations of a compound (split) location, the issue
> > being that if such a sub-location is a simple location there is no way
> > of tracking the parent in the sub-location. Is this correct?
> >
> > If it is, my suggestion is the following (code obviously slightly
> > simplified):
> >
> > package Bio::Location::SubLocationI;
> > @ISA = qw(Bio::LocationI);
> >
> > sub parent_seq_id {
> >       # abstract stub
> > }
> >
> > package Bio::Location::SimpleSubLocation;
> > @ISA = qw(Bio::Location::Simple Bio::Location::SubLocationI);
> >
> > sub parent_seq_id {
> >       # implement get/set
> > }
> >
> >
> > A simpler solution would be to put parent_seq_id() into
> > Bio::LocationI, which has the disadvantage of urging all location
> > instances which are not sub-locations to provide a dummy value.
> >
> > What do you think? Jason, any comment?
> 
> Hmm nothing has jumped out at me as the obvious way to go here.  Just want
> to be sure the added object complexity (adding potentially 3 classes and a
> new interface ) is worth not having parent_seq_id return null when an
> object is not a subLocation.  Do we recast/rebless Locations that become
> sublocations or instantiate a new object each time?  We'd have to do some
> $obj->isa gymnastics then.  I prefer the robust object model Hilmar is
> proposing above I just don't want to go too overboard if we don't need to.
> 
> If you take a Tree data structure as an analogy to SplitLocations you
> often have parent/child  pointers which are null but you don't
> differentiate between parent and child nodes they are the same entity and
> not subclassed.  So this is different since we want a reference of
> something outside the tree so maybe I'm being simple minded again.
> 

I like the tree nodes argument. Probably we haven't looked at
Locations really as trees, which in fact they are, coming in
various shapes. Okay, so I overshot. Then we put parent_seq_id()
into LocationI, and have every derived class provide an
implementation. The return value can be undef, meaning it is the
root of the tree (which might have no other leaves besides the
root).

Elia, would this solve your problem?

We could also link to the parent location object, enabling
traversing of the tree bottom-up. This would create circular
references, which I'm pretty sure no-one really wants.

	Hilmar

-- 
-----------------------------------------------------------------
Hilmar Lapp                              email: hilmarl@yahoo.com
GNF, San Diego, Ca. 92122                phone: +1 858 812 1757
-----------------------------------------------------------------