2 ## Bioperl Test Harness Script for Modules
10 $DEBUG = $ENV{'BIOPERLDEBUG'};
11 # to handle systems with no installed Test module
12 # we include the t dir (where a copy of Test.pm is located)
14 eval { require Test; };
24 use Bio::Map::FPCMarker;
25 use Bio::Map::OrderedPositionWithDistance;
27 use Bio::Map::Physical;
30 ok my $phm = new Bio::Map::Physical;
31 ok $phm->version(2), 2;
32 ok $phm->version(), 2;
33 ok $phm->modification_user('me'), 'me';
34 ok $phm->modification_user(), 'me';
36 ok $phm->group_type('xx'), 'xx';
37 ok $phm->group_type(), 'xx';
39 ok $phm->group_abbr('xx'), 'xx';
40 ok $phm->group_abbr(), 'xx';
42 ok $phm->core_exists, undef, 'code holds and returns a string, definition requires a boolean';
44 ok $phm->core_exists(3), 1, 'code holds and returns a string, definition requires a boolean';
46 ok $phm->core_exists(1), 1;
47 ok $phm->core_exists(), 1;
52 my $fpcpath = Bio::Root::IO->catfile('t','data','biofpc.fpc');
54 my $mapio = new Bio::MapIO(-format => "fpc", -species => 'demo', -readcor => 1, -file => $fpcpath);
55 my $fobj = $mapio->next_map();
57 ok $fobj->group_abbr(), "Chr";
58 ok $fobj->core_exists(), 1;
64 #########################################################
78 foreach my $mid ($f->each_markerid())
81 my $mobj = $f->get_markerobj($mid);
82 if (not defined $mobj)
87 my @remarks = split /\n/, $mobj->remark();
88 $nrem += scalar(@remarks);
89 $types{$mobj->type()} = 1;
93 $grps{$mobj->group()} = 1;
94 $pos += $mobj->global();
96 if ($mobj->framework())
100 foreach my $ctgid ($f->each_contigid())
102 $ctgpos += $mobj->position($ctgid);
107 ok scalar(keys %types), 2;
110 ok scalar (keys %grps), 4;
115 #########################################################
128 foreach my $cid ($f->each_contigid())
131 my $cobj = $f->get_contigobj($cid);
132 if (not defined $cobj)
137 if ($cobj->chr_remark() ne "")
141 if ($cobj->user_remark() eq "test")
145 if ($cobj->trace_remark() eq "test")
151 $ncb += ($cobj->range()->end() - $cobj->range()->start() + 1);
155 $psum += $cobj->position();
156 $grps{$cobj->group()} = 1;
165 ok scalar(keys %grps), 3;
168 #########################################################
180 foreach my $cid ($f->each_cloneid())
183 my $cobj = $f->get_cloneobj($cid);
184 if (not defined $cobj)
189 my $pbands = $cobj->bands();
190 $nbands += scalar(@$pbands);
191 $ctgs{$cobj->contigid()} = 1;
192 if ($cobj->contigid() > 0)
194 if (not defined $cobj->range()->start() or
195 not defined $cobj->range()->end() or
196 $cobj->range()->end() < $cobj->range()->start())
201 foreach my $mid ($cobj->each_markerid())
207 @remarks = split /\n/, $cobj->remark();
208 $nrem += scalar(@remarks);
210 if ($cobj->fpc_remark) {
211 @remarks = split /\n/, $cobj->fpc_remark();
212 $nfprem += scalar(@remarks);
214 $stati{$cobj->sequence_status()} = 1 if $cobj->sequence_status;
218 ok scalar(keys %ctgs), 11;
222 ok scalar(keys %stati), 5;