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

« back to all changes in this revision

Viewing changes to t/HNN.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:
4
4
# $Id: HNN.t,v 1.1 2003/07/23 
5
5
# Before `make install' is performed this script should be runnable with
6
6
# `make test'. After `make install' it should work as `perl test.t'
 
7
 
7
8
use strict;
8
 
use vars qw($NUMTESTS $DEBUG $ERROR $METAERROR);
9
 
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
 
9
use vars qw($NUMTESTS $DEBUG);
 
10
 
10
11
BEGIN {
11
 
    # to handle systems with no installed Test module
12
 
    # we include the t dir (where a copy of Test.pm is located)
13
 
    # as a fallback
14
 
    eval { require Test; };
15
 
    $ERROR = 0;
16
 
    if( $@ ) {
17
 
        use lib 't';
18
 
    }
19
 
    use Test;
20
 
 
21
 
    $NUMTESTS = 13;
22
 
    plan tests => $NUMTESTS;
23
 
 
24
 
    eval {
25
 
        require IO::String; 
26
 
        require LWP::UserAgent;
27
 
        
28
 
    }; 
29
 
    if( $@ ) {
30
 
        warn("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests");
31
 
        $ERROR = 1;
32
 
    }
33
 
        #check this is available, set error flag if not.
 
12
        $NUMTESTS = 13;
 
13
        $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
 
14
        
 
15
        eval {require Test::More;};
 
16
        if ($@) {
 
17
                use lib 't/lib';
 
18
        }
 
19
        use Test::More;
 
20
        
34
21
        eval {
35
 
                require Bio::Seq::Meta::Array;
36
 
                };
 
22
                require IO::String; 
 
23
                require LWP::UserAgent;
 
24
        };
37
25
        if ($@) {
38
 
                warn ("Bio::Seq::Meta::Array not installed - will skip tests using meta sequences");
39
 
                $METAERROR = 1;
40
 
                }
41
 
}
42
 
 
43
 
END {
44
 
    foreach ( $Test::ntest..$NUMTESTS) {
45
 
        skip('unable to run all of the tests depending on web access',1);
46
 
    }
47
 
}
48
 
 
49
 
exit 0 if $ERROR ==  1;
50
 
 
51
 
use Data::Dumper;
52
 
 
53
 
use Bio::PrimarySeq;
54
 
use Bio::Seq;
55
 
require Bio::Tools::Analysis::Protein::HNN;
56
 
 
57
 
ok 1;
58
 
 
59
 
my $verbose = 0;
60
 
$verbose = 1 if $DEBUG;
61
 
 
62
 
ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
63
 
 
64
 
my $seq = Bio::PrimarySeq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
65
 
                               -display_id => 'test2',
66
 
                              );
67
 
ok $tool = Bio::Tools::Analysis::Protein::HNN->new( -seq=>$seq,
68
 
                                                  );
69
 
if( $DEBUG ) {
70
 
    ok $tool->run ();
71
 
    exit if $tool->status eq 'TERMINATED_BY_ERROR';
72
 
    ok my $raw    = $tool->result('');
 
26
                plan skip_all => 'IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests';
 
27
        }
 
28
        else {
 
29
                plan tests => $NUMTESTS;
 
30
        }
 
31
        
 
32
        use_ok("Bio::Seq");
 
33
        use_ok("Bio::Tools::Analysis::Protein::HNN");
 
34
}
 
35
 
 
36
#       eval {require Bio::Seq::Meta::Array;};
 
37
#       "Bio::Seq::Meta::Array not installed - will skip tests using meta sequences"
 
38
 
 
39
my $verbose = $DEBUG;
 
40
 
 
41
my $seq = Bio::Seq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
 
42
                        -display_id => 'test2');
 
43
ok my $tool = Bio::Tools::Analysis::Protein::HNN->new(-seq=>$seq->primary_seq);
 
44
 
 
45
SKIP: {
 
46
        skip "Skipping tests which require remote servers, set BIOPERLDEBUG=1 to test", 10 unless $DEBUG;
 
47
    ok $tool->run();
 
48
        skip "Skipping tests since we got terminated by a server error", 9 if $tool->status eq 'TERMINATED_BY_ERROR';
 
49
    ok my $raw = $tool->result('');
73
50
    ok my $parsed = $tool->result('parsed');
74
 
    ok ($parsed->[0]{'coil'}, '1000');
75
 
    my @res       = $tool->result('Bio::SeqFeatureI');
 
51
    is $parsed->[0]{'coil'}, '1000';
 
52
    my @res = $tool->result('Bio::SeqFeatureI');
76
53
    if (scalar @res > 0) {
77
 
        ok 1;
78
 
    } else {
79
 
        skip('No network access - could not connect to HNN server', 1);
80
 
    }
 
54
                ok 1;
 
55
    }
 
56
        else {
 
57
                skip 'No results - could not connect to HNN server?', 6;
 
58
    }
 
59
    
81
60
    ok my $meta = $tool->result('meta');
82
61
    ok my $seqobj = Bio::Seq->new(-primary_seq => $meta, display_id=>"a");
83
62
    ok $seqobj->add_SeqFeature($tool->result('Bio::SeqFeatureI'));
84
 
    if (!$METAERROR) { #if Bio::Seq::Meta::Array available
85
 
        ok ( $meta->named_submeta_text('HNN_helix',1,2), '0 111');
86
 
        ok ( $meta->seq, 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS');
87
 
    }
88
 
} else { 
89
 
    for ( $Test::ntest..$NUMTESTS) {
90
 
        skip("Skipping tests which require remote servers - set env variable BIOPERLDEBUG to test",1);
91
 
    }
 
63
    
 
64
    eval {require Bio::Seq::Meta::Array;};
 
65
        skip "Bio::Seq::Meta::Array not installed - will skip tests using meta sequences", 2 if $@;
 
66
        is $meta->named_submeta_text('HNN_helix',1,2), '0 111';
 
67
        is $meta->seq, 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS';
92
68
}