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