~ubuntu-branches/ubuntu/saucy/bioperl/saucy-proposed

« back to all changes in this revision

Viewing changes to t/ClusterIO.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090310071911-fukqzw54pyb1f0bd
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*-Perl-*-
2
 
## Bioperl Test Harness Script for Modules
3
 
## $Id: ClusterIO.t,v 1.5 2006/06/08 08:44:26 heikki Exp $
4
 
 
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'
7
 
 
8
 
my $error;
9
 
 
10
 
use vars qw($SKIPXML $LASTXMLTEST); 
11
 
use strict;
12
 
use lib '.';
13
 
 
14
 
BEGIN {     
15
 
    # to handle systems with no installed Test module
16
 
    # we include the t dir (where a copy of Test.pm is located)
17
 
    # as a fallback
18
 
    eval { require Test; };
19
 
    if( $@ ) {
20
 
        use lib 't';
21
 
    }
22
 
    use vars qw($NTESTS);
23
 
    $NTESTS = 10;
24
 
    $LASTXMLTEST = 8;
25
 
    $error = 0;
26
 
 
27
 
    use Test;
28
 
    plan tests => $NTESTS; 
29
 
 
30
 
    eval { require XML::Parser::PerlSAX; };
31
 
    if( $@ ) {
32
 
        $SKIPXML = 1;
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);
36
 
        }
37
 
    }
38
 
}
39
 
 
40
 
if( $error == 1 ) {
41
 
    exit(0);
42
 
}
43
 
 
44
 
use Bio::ClusterIO;
45
 
use Bio::Root::IO;
46
 
use Bio::Cluster::ClusterFactory;
47
 
 
48
 
my ($clusterio, $result,$hit,$hsp);
49
 
if( ! $SKIPXML ) {
50
 
        $clusterio = new Bio::ClusterIO ('-tempfile' => 0,
51
 
                                        '-format' => 'dbsnp',
52
 
                                        '-file'   => Bio::Root::IO->catfile('t','data','LittleChrY.dbsnp.xml'));
53
 
    
54
 
        $result = $clusterio->next_cluster;
55
 
        ok($result);    
56
 
        ok($result->observed eq 'C/T');
57
 
        ok($result->type eq 'notwithdrawn');
58
 
        ok($result->seq_5);
59
 
        ok($result->seq_3);
60
 
        my @ss = $result->each_subsnp;
61
 
        ok scalar @ss,  5;
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);
66
 
}
67
 
 
68
 
###################################
69
 
# ClusterFactory tests            #
70
 
###################################
71
 
 
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");