1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SearchIO_erpin.t 14672 2008-04-22 21:42:50Z cjfields $
9 test_begin(-tests => 91);
11 use_ok('Bio::SearchIO');
14 my ($searchio, $result, $iter, $hit, $hsp, $algorithm, $meta);
16 $searchio = Bio::SearchIO->new( -format => 'erpin',
17 -file => test_input_file('testfile.erpin'),
18 -model => 'stem-loop',
23 $result = $searchio->next_result;
24 isa_ok($result, 'Bio::Search::Result::ResultI');
25 $algorithm = $result->algorithm;
26 is($result->algorithm, 'ERPIN', "Result $algorithm");
27 is($result->algorithm_reference, undef, "Result $algorithm reference");
28 is($result->algorithm_version, 5.5, "Result $algorithm version");
29 is($result->available_parameters, 2, "Result parameters");
30 is($result->available_statistics, 1, "Result statistics");
31 is($result->database_entries, '', "Result entries");
32 is($result->database_letters, '', "Result letters");
33 is($result->database_name, 'AE016879.fna', "Result database_name");
34 is($result->num_hits, 1, "Result num_hits");
35 is($result->program_reference, undef, "Result program_reference");
36 is($result->query_accession, 'test', "Result query_accession");
37 is($result->query_description, '40 sequences of length 43', "Result query_description");
38 is($result->query_name, '/home/Administrator/pyrR.epn', "Result query_name");
40 $hit = $result->next_hit;
41 isa_ok($hit, 'Bio::Search::Hit::HitI');
42 is($hit->accession, 'AE016879.1', "Hit accession");
43 is($hit->ncbi_gi, '30260185', "Hit GI");
44 is($hit->algorithm, 'ERPIN', "Hit algorithm");
45 is($hit->bits, 31.64, "Hit bits");
46 is($hit->description, 'Bacillus anthracis str. Ames, complete genome',
47 "Hit description"); # no hit descs yet
48 is($hit->length, 0, "Hit length");
49 is($hit->locus, '', "Hit locus");
50 is($hit->n, 4, "Hit n");
51 is($hit->name, 'gi|30260185|gb|AE016879.1|', "Hit name");
52 is($hit->num_hsps, 4, "Hit num_hsps");
53 is($hit->overlap, 0, "Hit overlap");
54 is($hit->query_length, undef, "Hit query_length");
55 is($hit->rank, 1, "Hit rank");
56 is($hit->raw_score, 31.64, "Hit raw_score");
57 is($hit->score, 31.64, "Hit score");
58 float_is($hit->significance, 4.44e-06);
60 $hsp = $hit->next_hsp;
61 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
62 is($hsp->algorithm, 'ERPIN', "HSP algorithm");
63 float_is($hsp->evalue, 1.68e-05);
64 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
65 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
66 is($hsp->frame('query'), 0, "HSP frame");
67 is($hsp->gaps, 2, "HSP gaps");
68 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
70 'CTTT.aacc--.CAACC.CCGTGA.GGTTG.a.GAAG',
72 is($hsp->homology_string,
74 "HSP homology_string");
75 is($hsp->hsp_group, undef, "HSP hsp_group");
76 is($hsp->hsp_length, 37, "HSP hsp_length");
77 is($hsp->length, 37, "HSP length");
78 is($hsp->links, undef, "HSP links");
79 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity', "HSP query");
80 is($hsp->query_string,
83 is($hsp->range, 37, "HSP range");
84 is($hsp->rank, 1, "HSP rank");
85 float_is($hsp->significance, 1.68e-05);
86 float_is($hsp->expect, '1.68e-05', "HSP expect");
87 isa_ok($hsp->seq, 'Bio::LocatableSeq');
91 is($hsp->start, 1, "HSP start");
92 is($hsp->custom_score, undef, "HSP custom_score");
93 is($hsp->meta, undef, "HSP meta");
94 is($hsp->meta, undef);
95 is($hsp->meta, undef);
96 is($hsp->strand('hit'), 1, "HSP strand");
97 is($hsp->meta, undef);
98 is($hsp->meta, undef);
100 # ERPIN lacks sequence for query, will spit back a warning..
102 like($@, qr'Missing query string, can\'t build alignment','ERPIN get_aln warning');
104 $hsp = $hit->next_hsp;
105 isa_ok($hsp, 'Bio::Search::HSP::HSPI');
106 is($hsp->algorithm, 'ERPIN', "HSP algorithm");
107 float_is($hsp->evalue, 5.61e-05);
108 isa_ok($hsp->feature1, 'Bio::SeqFeature::Similarity');
109 isa_ok($hsp->feature2, 'Bio::SeqFeature::Similarity');
110 is($hsp->frame('query'), 0, "HSP frame");
111 is($hsp->gaps, 1, "HSP gaps");
112 isa_ok($hsp->hit, 'Bio::SeqFeature::Similarity', "HSP hit");
114 'CTTT.taatt-.CAGTC.CTGTGA.GACCG.g.AAAG',
116 is($hsp->homology_string,
118 "HSP homology_string");
119 is($hsp->query_string,
122 is($hsp->hsp_group, undef, "HSP hsp_group");
123 is($hsp->hsp_length, 37, "HSP hsp_length");
124 is($hsp->length, 37, "HSP length");
125 is($hsp->links, undef, "HSP links");
126 isa_ok($hsp->query, 'Bio::SeqFeature::Similarity');
127 is($hsp->range, 37, "HSP range");
128 is($hsp->rank, 2, "HSP rank");
129 float_is($hsp->significance, 5.61e-05);
130 is($hsp->end, 37, "HSP end");
131 float_is($hsp->expect, '5.61e-05', "HSP expect");
132 isa_ok($hsp->seq, 'Bio::LocatableSeq');
133 is($hsp->seq_str, '', "HSP seq_str");
134 is($hsp->start, 1, "HSP start");
135 is($hsp->custom_score, undef, "HSP custom_score");
136 is($hsp->meta, undef);
137 is($hsp->meta, undef);
138 is($hsp->strand('hit'), -1, "HSP strand");