2
## Bioperl Test Harness Script for Modules
3
## $Id: ClusterIO.t,v 1.5 2006/06/08 08:44:26 heikki Exp $
5
# Before `make install' is performed this script should be runnable with
6
# `make test'. After `make install' it should work as `perl test.t'
10
use vars qw($SKIPXML $LASTXMLTEST);
15
# to handle systems with no installed Test module
16
# we include the t dir (where a copy of Test.pm is located)
18
eval { require Test; };
28
plan tests => $NTESTS;
30
eval { require XML::Parser::PerlSAX; };
33
print STDERR "XML::Parser::PerlSAX not loaded. This means ClusterIO::dbsnp test cannot be executed. Skipping\n";
34
foreach ( $Test::ntest..$LASTXMLTEST ) {
35
skip('No XML::Parser::PerlSAX loaded',1);
46
use Bio::Cluster::ClusterFactory;
48
my ($clusterio, $result,$hit,$hsp);
50
$clusterio = new Bio::ClusterIO ('-tempfile' => 0,
52
'-file' => Bio::Root::IO->catfile('t','data','LittleChrY.dbsnp.xml'));
54
$result = $clusterio->next_cluster;
56
ok($result->observed eq 'C/T');
57
ok($result->type eq 'notwithdrawn');
60
my @ss = $result->each_subsnp;
62
ok($ss[0]->handle eq 'CGAP-GAI');
63
ok($ss[1]->handle eq 'LEE');
64
# ok($result->heterozygous == 0.208738461136818);
65
# ok($result->heterozygous_SE == 0.0260274689436777);
68
###################################
69
# ClusterFactory tests #
70
###################################
72
my $fact = Bio::Cluster::ClusterFactory->new();
73
# auto-recognize implementation class
74
my $clu = $fact->create_object(-display_id => 'Hs.2');
75
ok $clu->isa("Bio::Cluster::UniGeneI");
76
$clu = $fact->create_object(-namespace => "UNIGENE");
77
ok $clu->isa("Bio::Cluster::UniGeneI");