New INSTALL.WIN doc (from wiki)
[bioperl-live.git] / t / Scansite.t
blobc15d37241509929f70453f3885b8f8ec80a5815a
1 # This is -*-Perl-*- code
2 ## Bioperl Test Harness Script for Modules
3 ##
4 # $Id: Scansite.t,v 1.1 2003/11/18 
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'
8 use strict;
9 use vars qw($NUMTESTS $DEBUG $ERROR);
10 $DEBUG = $ENV{'BIOPERLDEBUG'} || 0;
11 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;
22         $NUMTESTS = 12;
23         plan tests => $NUMTESTS;
25         eval {
26                 require IO::String; 
27                 require LWP::UserAgent;
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         }
35 END {
36         if ($DEBUG) {
37                 foreach ( $Test::ntest..$NUMTESTS) {
38                         skip('unable to run all of the Scansite tests',1);
39                 }
40         } else {
41                 foreach ( $Test::ntest..$NUMTESTS) {
42                         skip('set env BIOPERLDEBUG to run tests over web',1);
43                 }
44         }
47 exit 0 if $ERROR ==  1;
49 use Data::Dumper;
51 require Bio::Tools::Analysis::Protein::Scansite;
52 use Bio::SeqIO;
53 use Bio::PrimarySeq;
54 require Bio::WebAgent;
56 ok 1;
58 my $verbose = 0;
59 $verbose = 1 if $DEBUG;
61 ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
64 my $seqio=new Bio::SeqIO( -verbose => $verbose,
65                   -format => 'swiss',
66                   -file   => Bio::Root::IO->catfile('t','data', 'swiss.dat'));
68 my $seq = $seqio->next_seq();
69 ok $tool = Bio::Tools::Analysis::Protein::Scansite->new( 
70                                         -seq=>$seq->primary_seq);
71 ok $tool->stringency('Low');
72 ok $tool->stringency(), 'Low';
73 ok $tool->protein_id(), $tool->seq->display_id();
74 exit unless $DEBUG;
75 ok $tool->run ();
76 exit if $tool->status eq 'TERMINATED_BY_ERROR';
77 ok my $raw = $tool->result('');
78 print $raw if $verbose;
79 ok my $parsed = $tool->result('parsed');
80 ok $parsed->[0]{'site'}, 'T101';
81 ok my @res = $tool->result('Bio::SeqFeatureI');
82 ok $res[0]->start, 101;