1# -*-Perl-*- Test Harness script for Bioperl
2# $Id$
3
4use strict;
5
6BEGIN {
7    use lib '.';
8	use Bio::Root::Test;
9
10	test_begin(-tests => 12,
11			   -requires_module => 'Time::HiRes');
12
13	use_ok('Bio::ClusterIO');
14	use_ok('Bio::Cluster::ClusterFactory');
15}
16
17SKIP: {
18	test_skip(-tests => 8, -requires_module => 'XML::SAX');
19
20	my ($clusterio, $result,$hit,$hsp);
21	$clusterio = Bio::ClusterIO->new('-tempfile' => 0,
22					'-format' => 'dbsnp',
23					'-file'   => test_input_file('LittleChrY.dbsnp.xml'));
24
25	$result = $clusterio->next_cluster;
26	ok($result);
27	is($result->observed, 'C/T');
28	is($result->type, 'notwithdrawn');
29	ok($result->seq_5);
30	ok($result->seq_3);
31	my @ss = $result->each_subsnp;
32	is scalar @ss,  5;
33	is($ss[0]->handle, 'CGAP-GAI');
34	is($ss[1]->handle, 'LEE');
35
36	# don't know if these were ever meant to work... cjf 3/7/07
37	#is($result->heterozygous, 0.208738461136818);
38	#is($result->heterozygous_SE, 0.0260274689436777);
39}
40
41###################################
42# ClusterFactory tests            #
43###################################
44
45my $fact = Bio::Cluster::ClusterFactory->new();
46# auto-recognize implementation class
47my $clu = $fact->create_object(-display_id => 'Hs.2');
48isa_ok($clu, "Bio::Cluster::UniGeneI");
49$clu = $fact->create_object(-namespace => "UNIGENE");
50isa_ok($clu, "Bio::Cluster::UniGeneI");
51