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'
8
use vars qw($NUMTESTS $DEBUG $ERROR $METAERROR);
9
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
9
use vars qw($NUMTESTS $DEBUG);
11
# to handle systems with no installed Test module
12
# we include the t dir (where a copy of Test.pm is located)
14
eval { require Test; };
22
plan tests => $NUMTESTS;
26
require LWP::UserAgent;
30
warn("IO::String or LWP::UserAgent not installed. This means that the module is not usable. Skipping tests");
33
#check this is available, set error flag if not.
13
$DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
15
eval {require Test::More;};
35
require Bio::Seq::Meta::Array;
23
require LWP::UserAgent;
38
warn ("Bio::Seq::Meta::Array not installed - will skip tests using meta sequences");
44
foreach ( $Test::ntest..$NUMTESTS) {
45
skip('unable to run all of the tests depending on web access',1);
49
exit 0 if $ERROR == 1;
55
require Bio::Tools::Analysis::Protein::HNN;
60
$verbose = 1 if $DEBUG;
62
ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
64
my $seq = Bio::PrimarySeq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
65
-display_id => 'test2',
67
ok $tool = Bio::Tools::Analysis::Protein::HNN->new( -seq=>$seq,
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';
29
plan tests => $NUMTESTS;
33
use_ok("Bio::Tools::Analysis::Protein::HNN");
36
# eval {require Bio::Seq::Meta::Array;};
37
# "Bio::Seq::Meta::Array not installed - will skip tests using meta sequences"
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);
46
skip "Skipping tests which require remote servers, set BIOPERLDEBUG=1 to test", 10 unless $DEBUG;
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) {
79
skip('No network access - could not connect to HNN server', 1);
57
skip 'No results - could not connect to HNN server?', 6;
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');
89
for ( $Test::ntest..$NUMTESTS) {
90
skip("Skipping tests which require remote servers - set env variable BIOPERLDEBUG to test",1);
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';