File: interpro.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (68 lines) | stat: -rw-r--r-- 2,264 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# -*-Perl-*- Test Harness script for Bioperl
# $Id: interpro.t 15112 2008-12-08 18:12:38Z sendu $

use strict;

BEGIN {
  use lib '.';
  use Bio::Root::Test;
  
  test_begin(-tests => 20,
			 -requires_module => 'XML::DOM::XPath');
  
  use_ok('Bio::SeqIO::interpro');
}

my $verbose = test_debug();

my $t_file = test_input_file('test.interpro');
my $a_in = Bio::SeqIO->new( -file => $t_file,
							-verbose => $verbose,
							-format => 'interpro');
isa_ok($a_in, 'Bio::SeqIO');

my $seq = $a_in->next_seq();
ok($seq, 'seq obj is defined');
isa_ok($seq, 'Bio::Seq::RichSeq');
is(scalar( $seq->get_SeqFeatures() ), 6, 'right number of SeqFeatures');

my($feat) = $seq->get_SeqFeatures();
isa_ok($feat,'Bio::SeqFeature::Generic');

is($feat->display_name,'Retinoblastoma-associated protein, B-box', 'display_name()');

ok($seq = $a_in->next_seq(), 'seq object is defined');
is(scalar( $seq->get_SeqFeatures() ),40, 'right number of SeqFeatures');

ok(!($seq = $a_in->next_seq()), 'there is no next_seq (correctly)');

# Bug 1908 (enhancement)
$t_file = test_input_file('interpro_ebi.xml');
my $b_in = Bio::SeqIO->new( -file => $t_file,
									 -verbose => $verbose,
									 -format => 'interpro');
$seq = $b_in->next_seq();
ok($seq, 'bug 1908');

my @features = $seq->get_SeqFeatures;
is(scalar @features, 2, 'right number of SeqFeatures');
is($features[0]->primary_tag, 'region', 'primary_tag()');
is($features[0]->display_name, 'Protein of unknown function DUF1021', 'display_name()');
is($features[0]->location->end, 78, 'location->end()');

my @dblinks = $features[0]->annotation->get_Annotations('dblink');
is(scalar @dblinks, 3, 'right number of dblinks');
is($dblinks[1]->primary_id, 'IPR009366', 'first primary_id');
is($dblinks[2]->primary_id, 'PF06257.1', 'second primary_id');

my $other_t_file = test_input_file('test.interpro-go.xml');
my $ipr_in = Bio::SeqIO->new( -file => $other_t_file,
                              -verbose => $verbose,
                              -format => 'interpro');

$seq = $ipr_in->next_seq();
@features = $seq->get_SeqFeatures;
@dblinks = $features[0]->annotation->get_Annotations('dblink');
is(scalar @dblinks, 4, 'right number of dblinks');
is($dblinks[3]->primary_id, 'GO:0003677', 'primary_id via dblinks');