[Bioperl-l] Inheritance Bio::Map::Physical

Keith Anthony Boroevich kaboroev at sfu.ca
Tue Nov 14 00:55:46 EST 2006


I am using an up-to-date bioperl-live.  The precise code is 
insignificant so I wrote some additional (shorter) code to attempt to 
explain my problem.  What I want to do is the following.  I want to add 
some functionality to the Bio::Map::Physical module so i created a 
module that inherits Physical module, Extended::FPC.pm.

use strict;
use diagnostics;
use Extended::FPC;
my $mapio = new Extended::FPC(-format => "fpc",-file => 
$ARGV[0],-readcor => 1);
my $map = $mapio->next_map();
exit 0;

package Extended::FPC;
use strict;
use base qw(Bio::Map::Physical Bio::MapIO);

sub fpc_test {
  print STDERR "testing\n";
  return 0;


The execution of test.pl results in a "Can't locate object method 
"next_map" via package "Extended::FPC"" error;
Then I added the "Bio::MapIO" module to the "use base 
qw(Bio::Map::Physical Bio::MapIO);", because that is the module in which 
next_map is declared.  When I again execute test.pl I now get the exception:
Uncaught exception from user code:
#-------- EXCEPTION ------- #

------------- EXCEPTION: Bio::Root::NotImplemented -------------
MSG: Abstract method "Bio::Factory::MapFactoryI::next_map" is not 
implemented by package Extended::FPC.
This is not your fault - author of Extended::FPC should be blamed!

STACK: Error::throw
STACK: Bio::Root::Root::throw 
STACK: Bio::Root::RootI::throw_not_implemented 
STACK: Bio::Factory::MapFactoryI::next_map 
STACK: ./fpc.pl:12
 at /usr/lib/perl5/site_perl/5.8.7/Error.pm line 187
        Error::throw('Bio::Root::NotImplemented', '-class', 
'Bio::Root::NotImplemented', '-object', 'Extended::FPC=HASH(0x109ce10)', 
'-text', 'Abstract method "Bio::Factory::MapFactoryI::next_map" is not 
...') called at /usr/lib/perl5/site_perl/5.8.7/Bio/Root/Root.pm line 359
        Bio::Root::Root::throw('Extended::FPC=HASH(0x109ce10)', '-text', 
'Abstract method "Bio::Factory::MapFactoryI::next_map" is not ...', 
'-class', 'Bio::Root::NotImplemented') called at 
/usr/lib/perl5/site_perl/5.8.7/Bio/Root/RootI.pm line 522
called at /usr/lib/perl5/site_perl/5.8.7/Bio/Factory/MapFactoryI.pm line 84
called at ./fpc.pl line 12

#---- EXCEPTION END ----#

This is where I am now and have no real idea of where to begin.  I 
suppose the easiest way is to pass the $map variable to the function of 
interest and not to bother with inheriting any modules.

Sendu Bala wrote:
> Keith Anthony Boroevich wrote:
>> Hi,
>> I am attempting to add a few methods (ie. matching_bands_list) to the
>> fpc map class but I am having a hard time inheriting the class properly.
>> My first attempt was to inherit the "Bio::Map::Physical" class but the
>> "next_map" package is not found.
>> So I tried inheriting "Bio::MapIO" instead, and get a cannot find
>> "matching_bands_list" via package "Bio::Map::Physical"
>> The only way I can get it to work is with no inheritance and passing the
>> map class variable to the function, but this isn't very elegant.  Is
>> there a correct way to inherit these classes that will allow me to
>> execute this properly?
> It's hard to diagnose the problem without knowing exactly what you've 
> tried. Please post some relevant code. Also, what version of Bioperl are 
> you using?
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

><)))°> -cGRASP- <°(((><
Keith Anthony Boroevich
Simon Fraser University
Tel: 604-268-7276

More information about the Bioperl-l mailing list