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

Steven E. Brenner brenner@hyper.stanford.edu
Wed, 6 Aug 1997 12:27:47 -0700 (PDT)


> 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.

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

Steve


> > > When you say "returns modified object," do you mean modifies the current
> > > object or creates a new object and returns that?
> 
> creates a new object and returns that. You modify the current object
> by 'inplace'.
> 
> > > > $myseq->get_seq($beg,$end)            same as current get_seq() -- returns sequence
> > > > $myseq->get_seq(inplace($beg,$end))   modifies the object itself -- ithis saves time+space
> > > > 
> > > > And for revcom:
> > > > $myseq->revcom(seq($beg,$end))      returns modified object
> > > > $myseq->revcom($beg,$end)           same as current revcom() -- returns sequence
> > > > $myseq->revcom(inplace($beg,$end))  modifies the object itself -- this saves time+space
> > > > 
> > 
> > I'm also confused about how the seq() and inplace() calls within the 
> > get_seq() and revcom() calls are being used.  Either of these might be 
> > more obvious:
> > 
> > $myseq->revcom($myseq->inplace($beg,$end))
> 
> The analog $myseq->get_seq($myseq->seq($beg,$end)) [which slices and returns
> a new object containing the slice] doesn't look nice to me.
> 
> > OR
> > $myseq->revcom($beg,$end,'inplace')
> 
> This runs into problems if for some utilities you later add a 3rd parameter
> (and need to move 'inplace' one step further towards the end of the parameter
> list).
> 
> > Cheers,
> > 
> > SteveC
> > 
> 
> best wishes,
> georg
>