[Bioperl-l] Problems with revcom and translate in PrimarySeqI

Jason Stajich jason@chg.mc.duke.edu
Mon, 11 Dec 2000 17:27:11 -0500 (EST)


Yes, this was a problem I fixed in my local copy of the code, but did not
propigate out because I am confused.  

Do we want to have a generic new routine in RootI which can be overriden
by classes that need special attention (Bio::SeqIO::* classes 
explicitly describe new otherwise they will get the new from the class
they are extends - Bio::SeqIO)?  I am fine with a generic 'new' in RootI,
but there has been a little bit back and forth on this.

What did we finally decide was the Right way?

-Jason

On Mon, 11 Dec 2000, Ewan Birney wrote:

> On Mon, 11 Dec 2000, David Block wrote:
> 
> > I've been working with the main trunk - I know, I know, but I'm a big boy,
> > I can handle it.
> > 
> > I get tons of errors when trying to either revcom or translate a
> > PrimarySeq.  It seems that can_call_new=1 for PrimarySeq objects, but new
> > is not implemented properly, because it simply defaults to RootI's
> > new.  That expects a class as first argument, but gets an object instance,
> > which screws it up, since the class is now
> > Bio::PrimarySeq=HASH(0x<somebignumber>)
> > 
> > This leads to the error:
> > 
> > Can't locate object method "_initialize" via package
> > "Bio::PrimarySeq=HASH(0x11392918)" at
> > /home/dave/bioperl/bioperl-live/Bio/Root/RootI.pm line 79.
> > 
> > Two possible fixes - RootI could check to see if $class being sent to it
> > is a reference, and if so, make $class the class of $class (now that was
> > clear), or
> > Bio::PrimarySeq could return 0 for can_call_new, which would lead to
> > proper behaviour in this case (I think).
> > 
> > Code for the first fix (due to Damian Conway, OOPerl):
> > sub new {
> >     my ($caller, @arg) = @_;
> >     my $caller_is_obj = ref($caller);
> >     my $class = $caller_is_obj || $caller;
> >     my $self = bless {}, $class;
> > 
> > This is what we do in Workbench, and it works fine.
> 
> The first fix is the right fix. We should propagate this across all new
> modules. Jason, Hilmar - this is going to be a gotcha if we don't fix it,
> but the main area it will effect is primaryseq/seq.
> 
> e.
> 
> 
> > -- 
> > David Block
> > dblock@gene.pbi.nrc.ca
> > http://bioinfo.pbi.nrc.ca/dblock/wiki
> > Plant Biotechnology Institute
> > National Research Council of Canada
> > Saskatoon, Saskatchewan
> > 
> > 
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l@bioperl.org
> > http://bioperl.org/mailman/listinfo/bioperl-l
> > 
> 
> -----------------------------------------------------------------
> Ewan Birney. Mobile: +44 (0)7970 151230, Work: +44 1223 494420
> <birney@ebi.ac.uk>. 
> -----------------------------------------------------------------
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
> 

Jason Stajich
jason@chg.mc.duke.edu
Center for Human Genetics
Duke University Medical Center 
http://www.chg.duke.edu/