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

Ewan Birney birney@ebi.ac.uk
Mon, 11 Dec 2000 20:23:27 +0000 (GMT)


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