Reverse Complement utility, Bio::Alg, return value problem

Georg Fuellen fuellen@dali.Mathematik.Uni-Bielefeld.DE
Thu, 7 Aug 1997 18:13:09 +0000 (GMT)


SteveB wrote,
> > I'd like to follow the PDL example; I think they export the inplace()
> > function, and seq() [and possibly some other, similar functions]
> > could be handled the same way.
> 
> UGH!!  This means, for example, that we couldn't use inplace() in a
> script which also uses PDL.
> 
> Exporting is, in general, bad.  Following this route will lead to
> disasters.

The Perl Data Language ppl know this, too; they seem to believe there's no
better way (or they're just ignorant experts...?!). 
But you're right, it's bad.

> I think that we should determine, for ALL functions, wether they modify
> existing objects or return new ones.

Or, whether they return the actual sequence..
>>>>>>>>
> $myseq->revcom($beg,$end,'inplace')
This makes sense, but is pretty verbose.  Also, this would suggest that
the return would alwasy be the object itself, whereas you might want to be
returned the actual sequence, or some status value.
<<<<<<<<

Also, modification of the existing object can save so much space that we
should have it, and I hope the way it's currently done in UnivAln.pm
(i.e. setting the flag using a _method_ inplace() which does _not_ need 
to be exported) is OK.

The open problem in my view is whether revcom should return a sequence or
an object. Both have advantages and disadvantages, and using copy()
you can simulate one behaviour by the other. (If revcom accesses the sequence
but you need the object, create an identical copy and do revcom() inplace; 
if revcom returns an object but you need the sequence, apply get_seq to the
returned object. The former saves space, but the latter is more OO I guess).

best wishes,
georg

> Steve