~ubuntu-branches/ubuntu/raring/bioperl/raring

« back to all changes in this revision

Viewing changes to t/ESEfinder.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2008-03-18 14:44:57 UTC
  • mfrom: (4 hardy)
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20080318144457-1jjoztrvqwf0gruk
* debian/control:
  - Removed MIA Matt Hope (dopey) from the Uploaders field.
    Thank you for your work, Matt. I hope you are doing well.
  - Downgraded some recommended package to the 'Suggests' priority,
    according to the following discussion on Upstream's mail list.
    http://bioperl.org/pipermail/bioperl-l/2008-March/027379.html
    (Closes: #448890)
* debian/copyright converted to machine-readable format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# This is -*-Perl-*- code
2
2
## Bioperl Test Harness Script for Modules
3
3
##
4
 
# $Id: ESEfinder.t,v 1.9 2003/12/18 03:03:26 jason Exp $ 
 
4
# $Id: ESEfinder.t,v 1.13.6.5 2006/11/08 17:25:55 sendu Exp $ 
5
5
 
6
6
# Before `make install' is performed this script should be runnable with
7
7
# `make test'. After `make install' it should work as `perl test.t'
 
8
 
8
9
use strict;
9
 
use vars qw($NUMTESTS $DEBUG $ERROR $METAERROR);
10
 
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
 
10
use vars qw($NUMTESTS $DEBUG);
 
11
 
11
12
BEGIN {
12
 
    # to handle systems with no installed Test module
13
 
    # we include the t dir (where a copy of Test.pm is located)
14
 
    # as a fallback
15
 
    eval { require Test; };
16
 
    $ERROR = 0;
17
 
    if( $@ ) {
18
 
        use lib 't';
19
 
    }
20
 
    use Test;
21
 
 
22
 
    $NUMTESTS = 12;
23
 
    plan tests => $NUMTESTS;
24
 
 
25
 
    eval {
26
 
        require IO::String; 
27
 
        require LWP::UserAgent;
28
 
        require Bio::WebAgent;
29
 
        require HTML::HeadParser;
30
 
    }; 
31
 
    if( $@ ) {
32
 
        warn("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests");
33
 
        $ERROR = 1;
34
 
    }
 
13
        $NUMTESTS = 14;
 
14
        $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
 
15
        
 
16
        eval {require Test::More;};
 
17
        if ($@) {
 
18
                use lib 't/lib';
 
19
        }
 
20
        use Test::More;
 
21
        
35
22
        eval {
36
 
        require Bio::Seq::Meta::Array;
37
 
                };
 
23
                require IO::String; 
 
24
                require LWP::UserAgent;
 
25
                require Bio::WebAgent;
 
26
                require HTML::HeadParser;
 
27
                require HTTP::Request::Common;
 
28
        };
38
29
        if ($@) {
39
 
                warn ("Bio::Seq::Meta::Array not installed - will skip tests using meta sequences");
40
 
                $METAERROR = 1;
41
 
        }
42
 
 
43
 
}
44
 
 
45
 
END {
46
 
    foreach ( $Test::ntest..$NUMTESTS) {
47
 
        skip('unable to run all of the tests depending on web access',1);
48
 
    }
49
 
}
50
 
 
51
 
exit 0 if $ERROR ==  1;
52
 
 
53
 
use Data::Dumper;
54
 
 
55
 
use Bio::Tools::Analysis::DNA::ESEfinder;
56
 
use Bio::PrimarySeq;
57
 
use Bio::Seq;
58
 
use Bio::WebAgent;
59
 
 
60
 
ok 1;
61
 
 
62
 
my $verbose = $DEBUG;
63
 
my $tool;
64
 
 
 
30
                plan skip_all => 'IO::String, LWP::UserAgent, Bio::WebAgent, HTML::HeadParser, or HTTP::Request::Common not installed. This means that the module is not usable. Skipping tests';
 
31
        }
 
32
        else {
 
33
                plan tests => $NUMTESTS;
 
34
        }
 
35
        
 
36
        use_ok('Bio::Tools::Analysis::DNA::ESEfinder');
 
37
        use_ok('Data::Dumper');
 
38
        use_ok('Bio::PrimarySeq');
 
39
    use_ok('Bio::Seq');
 
40
}
65
41
 
66
42
#######all these tests work with 1ary seq########
67
43
my $seq = Bio::PrimarySeq->new(-id=>'bioperl',
68
44
                               -seq=>'atcgatgctatgcatgctatgggtgtgattcgatgcgactgttcatcgtagccccccccccccccctttt');
 
45
ok my $tool = Bio::Tools::Analysis::DNA::ESEfinder->new(-seq => $seq);
69
46
 
70
 
ok $tool = Bio::Tools::Analysis::DNA::ESEfinder->new(-verbose =>$verbose, -seq => $seq);
71
 
if( $DEBUG ) {
72
 
    ok $tool->run ( );
 
47
SKIP: {
 
48
        skip "Skipping tests which require remote servers, set BIOPERLDEBUG=1 to test", 9 unless $DEBUG;
 
49
        eval {$tool->run;};
 
50
        skip "Could not connect to ESEfinder server, skipping those tests", 9 if $@;
73
51
    ok my @res = $tool->result('Bio::SeqFeatureI');
 
52
        ok @res > 0;
74
53
    ok my $raw = $tool->result('');
75
54
    ok my $parsed = $tool->result('parsed');
76
55
    ok my $meta = $tool->result('all');
77
 
    ok ($parsed->[0][1], 41);
78
 
    if (scalar @res > 0) {
79
 
        ok 1;
80
 
    } else {
81
 
        skip('No network access - could not connect to ESEfinder server', 1);
82
 
    }
83
 
    if (!$METAERROR) {              #if Bio::Seq::Meta::Array available
84
 
        ok($meta->{'seq'}, "atcgatgctatgcatgctatgggtgtgattcgatgcgactgttcatcgtagccccccccccccccctttt" );
85
 
        ok( $meta->named_submeta_text('ESEfinder_SRp55', 1,2), "-3.221149 -1.602223");
86
 
        ok ($meta->seq, "atcgatgctatgcatgctatgggtgtgattcgatgcgactgttcatcgtagccccccccccccccctttt" );
87
 
    }
88
 
} else { 
89
 
   for ( $Test::ntest..$NUMTESTS) {
90
 
        skip("Skipping tests which require remote servers - set env variable BIOPERLDEBUG to test",1);
91
 
    }
 
56
    is $parsed->[0][1], 41;
 
57
        
 
58
    eval {require Bio::Seq::Meta::Array;};
 
59
        skip "Bio::Seq::Meta::Array not installed. Skipping tests using meta sequences", 3 if $@;
 
60
        is $meta->{'seq'}, "atcgatgctatgcatgctatgggtgtgattcgatgcgactgttcatcgtagccccccccccccccctttt";
 
61
        is $meta->named_submeta_text('ESEfinder_SRp55', 1,2), "-3.221149 -1.602223";
 
62
        is $meta->seq, "atcgatgctatgcatgctatgggtgtgattcgatgcgactgttcatcgtagccccccccccccccctttt";
92
63
}