1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 40);
12 use_ok('Bio::Map::Physical');
16 ok my $phm = Bio::Map::Physical->new();
17 is $phm->version(2), 2;
18 is $phm->version(), 2;
19 is $phm->modification_user('me'), 'me';
20 is $phm->modification_user(), 'me';
22 is $phm->group_type('xx'), 'xx';
23 is $phm->group_type(), 'xx';
25 is $phm->group_abbr('xx'), 'xx';
26 is $phm->group_abbr(), 'xx';
28 is $phm->core_exists, undef, 'code holds and returns a string, definition requires a boolean';
30 is $phm->core_exists(3), 1, 'code holds and returns a string, definition requires a boolean';
32 is $phm->core_exists(1), 1;
33 is $phm->core_exists(), 1;
35 my $fpcpath = test_input_file('biofpc.fpc');
37 # TODO? get Bio::MapIO::fpc to load from a Bio::MapIO call
38 my $mapio = Bio::MapIO->new(-format => "fpc", -species => 'demo', -readcor => 1, -file => $fpcpath);
39 my $fobj = $mapio->next_map();
41 is $fobj->group_abbr(), "Chr";
42 is $fobj->core_exists(), 1;
48 #########################################################
62 foreach my $mid ($f->each_markerid())
65 my $mobj = $f->get_markerobj($mid);
66 if (not defined $mobj)
71 my @remarks = split /\n/, $mobj->remark();
72 $nrem += scalar(@remarks);
73 $types{$mobj->type()} = 1;
77 $grps{$mobj->group()} = 1;
78 $pos += $mobj->global();
80 if ($mobj->framework())
84 foreach my $ctgid ($f->each_contigid())
86 push @ctgpos, $mobj->position($ctgid);
91 is scalar(keys %types), 2;
94 is scalar (keys %grps), 4;
98 $sum += $_ for @ctgpos;
102 #########################################################
115 foreach my $cid ($f->each_contigid())
118 my $cobj = $f->get_contigobj($cid);
119 if (not defined $cobj)
124 if ($cobj->chr_remark() ne "")
128 if ($cobj->user_remark() eq "test")
132 if ($cobj->trace_remark() eq "test")
138 $ncb += ($cobj->range()->end() - $cobj->range()->start() + 1);
142 $psum += $cobj->position();
143 $grps{$cobj->group()} = 1;
152 is scalar(keys %grps), 3;
155 #########################################################
167 foreach my $cid ($f->each_cloneid())
170 my $cobj = $f->get_cloneobj($cid);
171 if (not defined $cobj)
176 my $pbands = $cobj->bands();
177 $nbands += scalar(@$pbands);
178 $ctgs{$cobj->contigid()} = 1;
179 if ($cobj->contigid() > 0)
181 if (not defined $cobj->range()->start() or
182 not defined $cobj->range()->end() or
183 $cobj->range()->end() < $cobj->range()->start())
188 foreach my $mid ($cobj->each_markerid())
194 @remarks = split /\n/, $cobj->remark();
195 $nrem += scalar(@remarks);
197 if ($cobj->fpc_remark) {
198 @remarks = split /\n/, $cobj->fpc_remark();
199 $nfprem += scalar(@remarks);
201 $stati{$cobj->sequence_status()} = 1 if $cobj->sequence_status;
205 is scalar(keys %ctgs), 11;
209 is scalar(keys %stati), 5;