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

Chris Fields cjfields at uiuc.edu
Wed Nov 15 17:37:35 UTC 2006


On Nov 15, 2006, at 9:52 AM, Nancy Hansen wrote:

> Keith Anthony Boroevich wrote:
>>
>> 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.
>>
>> #----Test.pl-BEGIN---#
>> use strict;
>> use diagnostics;
>> use Extended::FPC;
>> my $mapio = new Extended::FPC(-format => "fpc",-file =>
>> $ARGV[0],-readcor => 1);
>> my $map = $mapio->next_map();
>> $map->fpc_test();
>> exit 0;
>> #---Test.pl-END------#
>
> You're right that your Extended::FPC should inherit from
> Bio::Map::Physical, but you really don't want to use it to parse  
> the fpc
> file (Bio::MapIO does that just fine, and gets all the data you  
> need into
> the Bio::Map::Physical object).  Try retrieving a Bio::Map::Physical
> object using Bio::MapIO, then forcing it to be an Extended::FPC, which
> will allow it to use your method(s):
>
> my $mapio = Bio::MapIO->new(-format => 'fpc',
>                             -file => $ARGV[0],
>                             -readcor => 1);
>
> my $fpc_map = $mapio->next_map();
>
> bless $fpc_map, Extended::FPC;
> my $ra_bands = $fpc_map->my_new_extended_method();
>
> I've actually written my own method to return the band sizes as  
> well, so
> it would probably make a good enhancement to Bio::Map::Physical, which
> already has a "matching_bands" method that returns the (scalar)  
> number of
> bands that match at a given tolerance.  If that method were  
> "enhanced" to
> return an array of matching band sizes rather than the scalar  
> number of
> bands, it would still return the number in scalar context, but give  
> you
> the matching band info in list context.  I'd be happy to submit a  
> patch
> for this if others think it's backwardly-compatible enough.
>
> 	--Nancy

Keith, Nancy,

Sendu Bala has taken over maintenance of the Bio::Map modules.  I  
have cc'd him this in case he has missed it (he's in the middle of  
getting a bioperl developer release put together).

In general we are more than happy to take new modules and patches for  
current ones.  There is a HOWTO on submitting patches and new code:

http://www.bioperl.org/wiki/HOWTO:SubmitPatch

If you plan on submitting a patch, you should also consider adding  
some tests as well.  I think the relevant tests for Bio::Map modules  
are in t/Map.t and t/MapIO.t.

chris

Christopher Fields
Postdoctoral Researcher
Lab of Dr. Robert Switzer
Dept of Biochemistry
University of Illinois Urbana-Champaign






More information about the Bioperl-l mailing list