~ubuntu-branches/ubuntu/hoary/bioperl/hoary

« back to all changes in this revision

Viewing changes to t/consed.t

  • Committer: Bazaar Package Importer
  • Author(s): Matt Hope
  • Date: 2004-04-18 14:24:11 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040418142411-gr92uexquw4w8liq
Tags: 1.4-1
* New upstream release
* Examples and working code are installed by default to usr/bin,
  this has been moved to usr/share/doc/bioperl/bin

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*-Perl-*-
2
2
## Bioperl Test Harness Script for Modules
3
 
## $Id: consed.t,v 1.2 2001/12/21 19:11:32 jason Exp $
 
3
## $Id: consed.t,v 1.5 2002/10/30 14:21:59 heikki Exp $
4
4
#
5
5
#####
6
6
#
9
9
#
10
10
#####
11
11
 
12
 
 
13
 
use ExtUtils::testlib;
14
12
use strict;
15
 
require 'dumpvar.pl';
16
 
 
 
13
use vars qw($TESTCOUNT);
17
14
BEGIN {
18
15
    # to handle systems with no installed Test module
19
16
    # we include the t dir (where a copy of Test.pm is located)
23
20
        use lib 't';
24
21
    }
25
22
    use Test;
26
 
    plan tests => 12;
 
23
    $TESTCOUNT = 16;
 
24
    plan tests => $TESTCOUNT;
27
25
}
28
26
 
29
27
use Bio::Root::IO;
31
29
use vars qw($DEBUG);
32
30
$DEBUG = $ENV{'BIOPERLDEBUG'} || -1;
33
31
 
 
32
if( $^O =~ /mswin/i ) {
 
33
    for ( $Test::ntest..$TESTCOUNT ) {
 
34
        skip("Cannot run consed module on windows",1,1);        
 
35
    }
 
36
    exit(0);
 
37
}
34
38
print("Checking if the Bio::Tools::Alignment::Consed module could be used...\n") if $DEBUG > 0;
35
39
        # test 1
36
40
ok(1);
45
49
ok defined $o_consed;
46
50
 
47
51
        # set the verbosity to a valid value (1)
48
 
my $verbosity = $o_consed->verbose(1);
 
52
ok my $verbosity = $o_consed->verbose(1);
49
53
 
50
54
# set the verbosity to "none"
51
55
$o_consed->verbose(0);
83
87
print("Checking if the number of singletons can be retrieved and if that number is correct (3)...\n") if($DEBUG > 0);
84
88
@singletons = $o_consed->get_singletons();
85
89
ok (scalar(@singletons), 3);
86
 
 
87
 
print("Finding out, via grep, how many sequences there are in the acefile _and_ in the singlets file...\n") if($DEBUG > 0);
88
 
$invoker = $o_consed->count_sequences_with_grep();
89
 
my $total_grep_sequences = $invoker;
90
 
print("($total_grep_sequences)\n")if($DEBUG > 0) ;
 
90
my($total_object_sequences, $total_grep_sequences);
 
91
print("Finding out, via grep, how many sequences there are in the acefile _and_ in the singlets file...\n") if $DEBUG > 0; 
 
92
ok($total_grep_sequences = $o_consed->count_sequences_with_grep(), 179);
91
93
 
92
94
print("Getting the statistics from the Bio::Tools::Alignment::Consed object to compare the total number of sequences accounted for there to the number of sequences found via grep...\n") if($DEBUG > 0);
93
 
$invoker = $o_consed->sum_lets("total_only");
94
 
my $total_object_sequences = $invoker;
95
 
$total_object_sequences =~ s/.*,//;
96
 
print("($total_object_sequences)\n") if($DEBUG > 0) ;
 
95
ok($total_object_sequences = $o_consed->sum_lets("total_only"),179);
97
96
print("Match?\n") if($DEBUG > 0) ;
98
97
ok ($total_object_sequences, $total_grep_sequences);
99
98
 
100
99
print("These are the statistics. Look right? ".$o_consed->sum_lets()."\n") if($DEBUG > 0);
101
 
 
 
100
ok($o_consed->sum_lets(),'Singt/singn/doub/pair/mult/total : 65,3,45(90),1(2),4(19),179');
102
101
 
103
102
print("Dumping out the hash in a compact way...\n")if($DEBUG > 0)  ;
104
 
$o_consed->dump_hash_compact()if($DEBUG > 0)  ;
 
103
$o_consed->dump_hash_compact() if($DEBUG > 0)  ;
105
104
 
106
105
# print("Dumping out the hash in an ugly way...\n");
107
106
# $o_consed->dump_hash();