1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 40);
11 use_ok('Bio::Map::Physical');
15 ok my $phm = Bio::Map::Physical->new();
16 is $phm->version(2), 2;
17 is $phm->version(), 2;
18 is $phm->modification_user('me'), 'me';
19 is $phm->modification_user(), 'me';
21 is $phm->group_type('xx'), 'xx';
22 is $phm->group_type(), 'xx';
24 is $phm->group_abbr('xx'), 'xx';
25 is $phm->group_abbr(), 'xx';
27 is $phm->core_exists, undef, 'code holds and returns a string, definition requires a boolean';
29 is $phm->core_exists(3), 1, 'code holds and returns a string, definition requires a boolean';
31 is $phm->core_exists(1), 1;
32 is $phm->core_exists(), 1;
34 my $fpcpath = test_input_file('biofpc.fpc');
36 # TODO? get Bio::MapIO::fpc to load from a Bio::MapIO call
37 my $mapio = Bio::MapIO->new(-format => "fpc", -species => 'demo', -readcor => 1, -file => $fpcpath);
38 my $fobj = $mapio->next_map();
40 is $fobj->group_abbr(), "Chr";
41 is $fobj->core_exists(), 1;
47 #########################################################
61 foreach my $mid ($f->each_markerid())
64 my $mobj = $f->get_markerobj($mid);
65 if (not defined $mobj)
70 my @remarks = split /\n/, $mobj->remark();
71 $nrem += scalar(@remarks);
72 $types{$mobj->type()} = 1;
76 $grps{$mobj->group()} = 1;
77 $pos += $mobj->global();
79 if ($mobj->framework())
83 foreach my $ctgid ($f->each_contigid())
85 push @ctgpos, $mobj->position($ctgid);
90 is scalar(keys %types), 2;
93 is scalar (keys %grps), 4;
97 $sum += $_ for @ctgpos;
101 #########################################################
114 foreach my $cid ($f->each_contigid())
117 my $cobj = $f->get_contigobj($cid);
118 if (not defined $cobj)
123 if ($cobj->chr_remark() ne "")
127 if ($cobj->user_remark() eq "test")
131 if ($cobj->trace_remark() eq "test")
137 $ncb += ($cobj->range()->end() - $cobj->range()->start() + 1);
141 $psum += $cobj->position();
142 $grps{$cobj->group()} = 1;
151 is scalar(keys %grps), 3;
154 #########################################################
166 foreach my $cid ($f->each_cloneid())
169 my $cobj = $f->get_cloneobj($cid);
170 if (not defined $cobj)
175 my $pbands = $cobj->bands();
176 $nbands += scalar(@$pbands);
177 $ctgs{$cobj->contigid()} = 1;
178 if ($cobj->contigid() > 0)
180 if (not defined $cobj->range()->start() or
181 not defined $cobj->range()->end() or
182 $cobj->range()->end() < $cobj->range()->start())
187 foreach my $mid ($cobj->each_markerid())
193 @remarks = split /\n/, $cobj->remark();
194 $nrem += scalar(@remarks);
196 if ($cobj->fpc_remark) {
197 @remarks = split /\n/, $cobj->fpc_remark();
198 $nfprem += scalar(@remarks);
200 $stati{$cobj->sequence_status()} = 1 if $cobj->sequence_status;
204 is scalar(keys %ctgs), 11;
208 is scalar(keys %stati), 5;