Bio::Tools::Analysis::Protein::Scansite: move to separate distribution
[bioperl-live.git] / t / Tools / Analysis / Protein / Domcut.t
blobebf4b6ff84c223ea6e3d0b67f12412da75c2e69d
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
4 use strict;
6 BEGIN {
7         use Bio::Root::Test;
8         
9         test_begin(-tests => 26,
10                            -requires_modules => [qw(IO::String
11                                                                             LWP::UserAgent)],
12                            -requires_networking => 1);
13         
14         use_ok('Bio::PrimarySeq');
15         use_ok('Bio::Tools::Analysis::Protein::Domcut');
18 my $verbose = test_debug();
20 ok my $tool = Bio::WebAgent->new(-verbose =>$verbose);
22 SKIP: {
23         ######## test using PrimarySeq object ##############
24         my $seq = Bio::PrimarySeq->new(-seq        => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS',
25                                                                    -display_id => 'test2');
26         
27         ok $tool = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq);
28         ok $tool->run ();
29         if ($tool->status eq 'TERMINATED_BY_ERROR') {
30                 skip('Problem with DomCut run, check status', 21);
31         }
32         
33         ok my $raw    = $tool->result('');
34         ok my $parsed = $tool->result('parsed');
35         is ($parsed->[23]{'score'}, '-0.209');
36         my @res       = $tool->result('Bio::SeqFeatureI');
37         if (scalar @res > 0) {
38                 ok 1;
39         } else {
40                 skip('No network access - could not connect to Domcut server', 18);
41         }
42         ok my $meta = $tool->result('meta');
43         
44         SKIP: {
45                 test_skip(-tests => 2, -requires_module => 'Bio::Seq::Meta::Array');
46                 is($meta->named_submeta_text('Domcut', 1,2), "0.068 0.053");
47                 is ($meta->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQPPPPPPPPPPPPPDQRS");
48         }
49         
50         ########## test using Bio::Seq object ##############
51         ok my $tool2 = Bio::WebAgent->new(-verbose =>$verbose);
52         
53         ok my $seq2  = Bio::Seq->new(-seq => 'MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS',
54                                  -display_id => 'test2');
55         
56         ok $tool2 = Bio::Tools::Analysis::Protein::Domcut->new( -seq=>$seq2->primary_seq);
57         ok $tool2->run ();
58         
59         @res = $tool2->result('Bio::SeqFeatureI');
60         
61         if (scalar @res > 0) {
62                 ok 1;
63         } else {
64                 skip('No network access - could not connect to Domcut server', 10);
65         }
66         
67         ok my $parsed2 = $tool2->result('parsed');
68         is ($parsed2->[23]{'score'}, '-0.209');
69         
70         ok my $meta2 = $tool2->result('meta');
71         
72         is($meta2->named_submeta_text('Domcut', 1,2), "0.068 0.053");
73         is ($meta2->seq, "MSADQRWRQDSQDSFGDSFDGDPPPPPPPPFGDSFGDGFSDRSRQDQRS");
74         
75         ok my $seq4 = Bio::Seq->new();
76         ok $seq2->primary_seq($meta2);
77         for (@res) {
78                 ok $seq2->add_SeqFeature($_);
79         }
80         ok $seq2->primary_seq->named_submeta_text('Domcut', 1,2);