[Bioperl-l] BioSeq method errors with BioSQL sequences

Marc Logghe Marc.Logghe at devgen.com
Thu Nov 11 18:41:30 EST 2004


Hi Barry,
Have you tried setting the seqfactory type to 'Bio::Seq::RichSeq' ?
Did not check it, but guess Bio::Seq has no division method, a richseq does.
HTH,
Marc

> -----Original Message-----
> From: Barry Moore [mailto:barry.moore at genetics.utah.edu]
> Sent: Friday, November 12, 2004 12:35 AM
> To: bioperl
> Subject: [Bioperl-l] BioSeq method errors with BioSQL sequences
> 
> 
> I have code that I have used to grab details from a Bio::Seq 
> object like 
> this:
> 
> my $locus = $seq->display_name;
> my $length = $seq->length;
> my $mol_type = $seq->molecule;
> my $division = $seq->division;
> 
> This works great when called on Bio::Seq created like this:
> 
> use Bio::DB::RefSeq;
> $db = new Bio::DB::RefSeq;
> $seq = $db->get_Seq_by_id('NM_006732');
> 
> But I recently switched the to using a local database and getting my 
> sequence objects like this:
> 
> my $db_adaptor = Bio::DB::BioDB->new(
>         -database => 'biosql',
>         -user     => 'postgres',
>         -dbname   => 'some_db',
>         -host     => 'localhost',
>         -driver   => 'Pg',
>     );
> my $tmp_seq = Bio::Seq->new(-accession_number => "$NM_006732",
>                             -namespace        => "$ncbi");
> my $seqfact = Bio::Seq::SeqFactory->new(-type => "Bio::Seq");
> my $adp = $db_adaptor->get_object_adaptor($tmp_seq);
> my $seq = $adp->find_by_unique_key($tmp_seq, -obj_factory => 
> $seqfact);
> 
> The new seq object seems to behave very nicely under most 
> circumstances 
> but it will not execute some methods like these:
> 
> my $mol_type = $seq->molecule;
> my $division = $seq->division;
> 
> I get an error like this:
> 
> Can't locate object method "division" via package "Bio::Seq" at 
> /usr/local/share/perl/5.6.1/Bio/DB/Persistent/PersistentObject
> .pm line 
> 541, <IN> line 1.
> 
> 
> I tried to track down where the problem occured and found that in 
> AUTOLOAD for Bio/DB/Persistent/PersistentObject.pm on line 
> 534 and error 
> was being thrown.
> 
> 534:        $self->throw("Can't locate object method \"$meth\" via 
> package ".
> 535:                     ref($self))
> 536:            unless $obj && ($obj ne $self);
> 
> Checking ref $obj and ref $self gives Bio::Seq and 
> Bio::DB::Persistent::Seq respectively.  That seems to me to indicate 
> that the 'unless' above should be satisfied - $obj exist and is not 
> equal to $self therefore don't throw.  Running $seq->display_name 
> generates the same values for $obj and $self, but it works.  Methods 
> molecule and division throw errors.  Any suggestions?
> 
> Barry
> 
> --
> 
> Barry Moore
> Dept. of Human Genetics
> University of Utah
> Salt Lake City, UT
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at portal.open-bio.org
> http://portal.open-bio.org/mailman/listinfo/bioperl-l
> 



More information about the Bioperl-l mailing list