[bug 2262]
[bioperl-live.git] / t / SearchIO_fasta.t
blob2ca7d82c2aa680bd1c6db4a357b3479bbcbee51f
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SearchIO_fasta.t 14995 2008-11-16 06:20:00Z cjfields $
4 use strict;
6 BEGIN {
7         use lib 't/lib';
8     use BioperlTest;
9     
10     test_begin(-tests => 261);
11         
12         use_ok('Bio::SearchIO');
13         use_ok('Bio::SearchIO::Writer::HitTableWriter');
14         use_ok('Bio::SearchIO::Writer::HTMLResultWriter');
17 my ($searchio, $result, $hit, $hsp);
19 # simple FASTA
20 $searchio = Bio::SearchIO->new(-format => 'fasta',
21                                  -file   => test_input_file('HUMBETGLOA.FASTA'));
22 $result = $searchio->next_result;
23 like($result->database_name, qr/dros_clones.2.5/);
24 is($result->database_letters, 112936249);
25 is($result->database_entries, 657);
26 is($result->algorithm, 'FASTN');
27 is($result->algorithm_version, '3.3t08');
28 is($result->query_name, "HUMBETGLOA");
29 is($result->query_description, "Human haplotype C4 beta-globin gene, complete cds.");
30 is($result->query_length, 3002);
31 is($result->get_parameter('gapopen'), -16);
32 is($result->get_parameter('gapext'), -4);
33 is($result->get_parameter('ktup'), 6);
35 is($result->get_statistic('lambda'), 0.0823);
36 is($result->get_statistic('dbletters'), 112936249);
37 is($result->get_statistic('dbentries'), 657);
39 my @valid = ( [ 'BACR21I23', 73982, 'BACR21I23', '0.017', 44.2],
40            [ 'BACR40P19', 73982, 'BACR40P19', '0.017', 44.2],
41            [ 'BACR30L17', 32481, 'BACR30L17', '0.018', 44.1]);
42 my $count = 0;
44 while( my $hit = $result->next_hit ) {
45     my $d = shift @valid;
46     is($hit->name, shift @$d);
47     is($hit->length, shift @$d);
48     is($hit->accession, shift @$d);
49     is($hit->significance, shift @$d );
50     is($hit->raw_score, shift @$d );
51     is($hit->rank, $count + 1);
52     if( $count == 0 ) {
53         my $hsps_left = 1;
54         while( my $hsp = $hit->next_hsp ) {
55             is($hsp->query->start, 31);
56             is($hsp->query->end, 289);
57             is($hsp->query->strand, -1);
58             is($hsp->hit->end, 65167);
59             is($hsp->hit->start, 64902);
60             is($hsp->hit->strand, 1);
61             is($hsp->length('total'), 267);         
62             is($hsp->evalue , 0.017);
63             is($hsp->score, 134.5);
64             is($hsp->bits,44.2);
65             is(sprintf("%.2f",$hsp->percent_identity), '57.30');
66             is(sprintf("%.4f",$hsp->frac_identical('query')), 0.5907); 
67             is(sprintf("%.4f",$hsp->frac_identical('hit')), 0.5752);
68                         # these are really UNGAPPED values not CONSERVED
69                         # otherwise ident and conserved would be identical for
70                         # nucleotide alignments
71                         is(sprintf("%.4f",$hsp->frac_conserved('total')), 0.5955); 
72                         is(sprintf("%.4f",$hsp->frac_conserved('query')), 0.6139); 
73                         is(sprintf("%.4f",$hsp->frac_conserved('hit')), 0.5977); 
74             is($hsp->query->frame(), 0);
75             is($hsp->hit->frame(), 0);
76             TODO: {
77                 local $TODO = 'Is this correct for gap total?';
78                 is($hsp->gaps('total'), 9);
79             }
80             is($hsp->gaps('query'), 8);
81             is($hsp->gaps('hit'),1);
82             is($hsp->query_string, 'GATTAAAACCTTCTGGTAAGAAAAGAAAAAATATATATATATATATATGTGTATATGTACACACATACATATACATATATATGCATTCATTTGTTGTTGTTTTTCTTAATTTGCTCATGCATGCTA----ATAAATTATGTCTAAAAATAGAAT---AAATACAAATCAATGTGCTCTGTGCATTA-GTTACTTATTAGGTTTTGGGAAACAAGAGGTAAAAAACTAGAGACCTCTTAATGCAGTCAAAAATACAAATAAATAAAAAGTCACTTACAACCCAAAGTGTGACTATCAATGGGGTAATCAGTGGTGTCAAATAGGAGGT');
83             is($hsp->hit_string, 'GATGTCCTTGGTGGATTATGGTGTTAGGGTATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATATAATATAATACAAAATATAATACAAAATATAATACAAAATATAATACAAAATATAATACAAAATATAATACAAAATATAATACAAAATATAATATAAAATATAATATAAAATATAATATAAAATAAAATATAAAATAAAATATAAAATAAAATATAAAATAAAATATAAAATAAAATAT-AATATAAAATATAAAATAAAATATAATATAAAATATAATATAAAATATAATATAAAATATAATATAAAATA');
84             is($hsp->homology_string, '                              :::::::::::::::::: : ::::: :: : : ::: ::::: ::::::::  ::  :: : :   : : : : :  ::    : :: ::   ::    : ::: :::     :::::: :::   ::::: ::  :::  :    :    : ::   :::  : ::   : :   : : :: :   :: : : :: : :       ::  : : ::: ::: ::  ::::: ::: : :  :: ::   ::: : : : ::: ::   '.' 'x60);
85             is(join(' ', $hsp->seq_inds('query', 'nomatch',1)), '33 37 39 41 43 47-49 52 55 56 58 60 64 70 71 74 78 82 84 86 87 90-96 98 100 103 105 107 110-112 114 117 119 121-123 125 127-129 132 134 135 139 140 143 145-148 150-153 155 156 160 161 164 173 180-184 188 192 196-198 201 204 206-209 212 213 215 217 219 221 223-225 227 229 232 233 236 237 246 252 256 258 260 263 269 271');
86             is(join(' ', $hsp->seq_inds('query', 'mismatch',1)), '33 37 41 43 47-49 52 55 56 58 60 64 70 71 74 78 82 84 86 87 90-96 98 100 103 105 107 110-112 114 117 119 121-123 125 127-129 132 134 135 139 140 143 145-148 150-153 155 156 160 161 164 173 180-184 188 192 196-198 201 204 206-209 212 213 215 217 219 221 223-225 227 229 232 233 236 237 246 252 256 258 260 263 269 271');
87             is(join(' ', $hsp->seq_inds('query', 'conserved',1)), '31 32 34-36 38 40 42 44-46 50 51 53 54 57 59 61-63 65-69 72 73 75-77 79-81 83 85 88 89 97 99 101 102 104 106 108 109 113 115 116 118 120 124 126 130 131 133 136-138 141 142 144 149 154 157-159 162 163 165-172 174-179 185-187 189-191 193-195 199 200 202 203 205 210 211 214 216 218 220 222 226 228 230 231 234 235 238-245 247-251 253-255 257 259 261 262 264-268 270 272-289');
88             is(join(' ', $hsp->seq_inds('hit', 'nomatch',1)), '64920 64922 64928 64931 64933 64935 64939 64945 64954 64955 64958 64959 64962 64964 64966-64968 64970 64972 64974 64976 64978 64979 64982-64985 64987 64990 64993-64995 64998-65001 65003 65007 65011-65015 65022 65026-65028 65034 65037 65038 65042 65043 65045-65048 65050-65053 65055 65058-65060 65064 65065 65067 65070-65072 65074 65076-65078 65080 65082 65085 65087-65089 65092 65094 65096 65099 65101 65103-65109 65112 65113 65115 65117 65121 65125 65128 65129 65135 65139 65141 65143 65144 65147 65150-65152 65156 65158 65161 65165');
89             is(join(' ', $hsp->seq_inds('hit', 'mismatch',1)), '64920 64922 64928 64931 64933 64935 64939 64945 64954 64955 64958 64959 64962 64964 64966-64968 64970 64972 64974 64976 64978 64979 64982-64985 64987 64990 64993-64995 65003 65007 65011-65015 65022 65034 65037 65038 65042 65043 65045-65048 65050-65053 65055 65059 65060 65064 65065 65067 65070-65072 65074 65076-65078 65080 65082 65085 65087-65089 65092 65094 65096 65099 65101 65103-65109 65112 65113 65115 65117 65121 65125 65128 65129 65135 65139 65141 65143 65144 65147 65150-65152 65156 65158 65161 65165');
90             is(join(' ', $hsp->seq_inds('hit', 'conserved',1)), '64902-64919 64921 64923-64927 64929 64930 64932 64934 64936-64938 64940-64944 64946-64953 64956 64957 64960 64961 64963 64965 64969 64971 64973 64975 64977 64980 64981 64986 64988 64989 64991 64992 64996 64997 65002 65004-65006 65008-65010 65016-65021 65023-65025 65029-65033 65035 65036 65039-65041 65044 65049 65054 65056 65057 65061-65063 65066 65068 65069 65073 65075 65079 65081 65083 65084 65086 65090 65091 65093 65095 65097 65098 65100 65102 65110 65111 65114 65116 65118-65120 65122-65124 65126 65127 65130-65134 65136-65138 65140 65142 65145 65146 65148 65149 65153-65155 65157 65159 65160 65162-65164 65166 65167');            
91             is(join(' ', $hsp->seq_inds('query', 'gap',1)), '141 170 194');
92             is($hsp->ambiguous_seq_inds, '');
93             # note: the reason this is not the same percent id above
94             # is we are calculating average percent id
95             is(sprintf("%.2f",$hsp->get_aln->percentage_identity()), '59.30');
96             $hsps_left--;
97         }
98         is($hsps_left, 0);
99     }
100     last if( $count++ > @valid );
102 is(@valid, 0);
104 $searchio = Bio::SearchIO->new(-format => 'fasta',
105                                  -file   => test_input_file('cysprot1.FASTA'));
106 $result = $searchio->next_result;
107 like($result->database_name, qr/ecoli.aa/);
108 is($result->database_letters, 1358987);
109 is($result->database_entries, 4289);
110 is($result->algorithm, 'FASTP');
111 is($result->algorithm_version, '3.3t08');
112 is($result->query_name, 'CYS1_DICDI');
113 is($result->query_length, 343);
114 is($result->get_parameter('gapopen'), -12);
115 is($result->get_parameter('gapext'), -2);
116 is($result->get_parameter('ktup'), 2);
118 is($result->get_statistic('lambda'), 0.1456);
119 is($result->get_statistic('dbletters'), 1358987);
120 is($result->get_statistic('dbentries'), 4289);
123 @valid = ( [ 'gi|1787478|gb|AAC74309.1|', 512, 'AAC74309', 1787478, 1.2, 29.2],
124            [ 'gi|1790635|gb|AAC77148.1|', 251, 'AAC77148', 1790635, 2.1, 27.4],
125            [ 'gi|1786590|gb|AAC73494.1|', 94, 'AAC73494', 1786590, 2.1, 25.9]);
126 $count = 0;
128 while( my $hit = $result->next_hit ) {
129     my $d = shift @valid;
130     is($hit->name, shift @$d);
131     is($hit->length, shift @$d);
132     is($hit->accession, shift @$d);
133     is($hit->ncbi_gi, shift @$d);
134     is($hit->significance, shift @$d );
135     is($hit->raw_score, shift @$d );
137     if( $count == 0 ) {
138         my $hsps_left = 1;
139         while( my $hsp = $hit->next_hsp ) {
140             is($hsp->query->start, 125);
141             is($hsp->query->end, 305);
142             is($hsp->query->strand, 0);
143             is($hsp->hit->start, 2);
144             is($hsp->hit->end, 181);
145             is($hsp->hit->strand, 0);
146             is($hsp->length('total'), 188);         
147             is($hsp->evalue , 1.2);
148             is($hsp->score, 109.2);
149             is($hsp->bits,29.2);
150             is(sprintf("%.2f",$hsp->percent_identity), 23.94);
151             is(sprintf("%.4f",$hsp->frac_identical('query')), 0.2486);
152             is(sprintf("%.4f",$hsp->frac_identical('hit')), '0.2500');
153             is(sprintf("%.4f",$hsp->frac_conserved('query')), '0.2707');
154             is(sprintf("%.4f",$hsp->frac_conserved('hit')), '0.2722');
155             # there is slight rounding different here so file says 26.012%
156             # but with the rounding this ends up as 0.2606
157             is(sprintf("%.4f",$hsp->frac_conserved('total')), '0.2606');
158             is($hsp->query->frame(), 0);
159             is($hsp->hit->frame(), 0);
160             is($hsp->gaps('query'), 7);
161             is($hsp->gaps, 49);     
162             is($hsp->query_string, 'NKEAIFTDDLPVADYLDDEFINSIPTAFDWRTRGAVTPVKNQGQCGSCWSFSTT-GNV----EGQHFISQNKLVSLSEQNLVDCDHECME-YEGEEACDEGCNGGLQPNAYNYIIKNGGIQTESSYPYTAETGTQCNFNSANIGAKISNFTMIPKNETVMAGYIVSTGP-LAIAADAVEWQFYIGGVFDIPCNPNSLDHGILIVGYSAKNTIFRKNMPYWIVKNSWGADWGEQGYIYLRRGKNTCGVSNFVSTSII');
163             is($hsp->hit_string, (' 'x29).'MKIRSQVGMVLNLDKCIGCHTCSVTCKNVWTSREGVEYAWFNNVETKPGQGF-PTDWENQEKYKGGWI--RKINGKLQPRMGNRAMLLGKIFANPHLPGIDDYYEPFDFDYQNLHTAPEG----SKSQPIARPRSLITGERMAKIEKGPNWEDDLGGEFDKLAKDKNFDN-IQKAMYSQFENTFMMYLPRLCEHCLNPACVATCPSGAIYKREEDGIVLIDQDKCRGWRMCITGCPYKKIYFNWKSGKSEKCIFCYPRIEAGQPTVCSETC');
164             is($hsp->homology_string, '                              . :. :  : :  .: .: . :.:  ::    :: ..   :.. .   :..   : : .: :.:     .  :: :::   :  .  : : ..   :   .     .:.  :. .   .     :.. .     . ::  .:    . .:.  .:: ::   . ...:. :  . ::  .. :   .:                      '.' 'x60);
165             # note: the reason this is not the same percent id above
166             # is we are calculating average percent id
167             is(sprintf("%.2f",$hsp->get_aln->percentage_identity()), 26.01);
168             $hsps_left--;
169         }
170         is($hsps_left, 0);
171     }
172     last if( $count++ > @valid );
174 is(@valid, 0);
176 is($result->hits, 8);
177 $searchio = Bio::SearchIO->new(-format => 'fasta',
178                                  -file   => test_input_file('cysprot_vs_gadfly.FASTA'));
179 $result = $searchio->next_result;
180 like($result->database_name, qr/gadflypep2/);
181 is($result->database_letters, 7177762);
182 is($result->database_entries, 14334);
183 is($result->algorithm, 'FASTP');
184 is($result->algorithm_version, '3.3t08');
185 is($result->query_name, 'cysprot.fa');
186 is($result->query_length, 2385);
187 is($result->get_parameter('gapopen'), -12);
188 is($result->get_parameter('gapext'), -2);
189 is($result->get_parameter('ktup'), 2);
190 is($result->get_parameter('matrix'), 'BL50');
192 is($result->get_statistic('lambda'), 0.1397);
193 is($result->get_statistic('dbletters'), 7177762 );
194 is($result->get_statistic('dbentries'), 14334);
197 @valid = ( [ 'Cp1|FBgn0013770|pp-CT20780|FBan0006692', 341, 
198              'FBan0006692', '3.1e-59', 227.8],
199            [ 'CG11459|FBgn0037396|pp-CT28891|FBan0011459', 336, 
200              'FBan0011459', '6.4e-41',  166.9],
201            [ 'CG4847|FBgn0034229|pp-CT15577|FBan0004847', 390, 
202              'FBan0004847',  '2.5e-40', 165.2]);
203 $count = 0;
205 while( my $hit = $result->next_hit ) {
206     my $d = shift @valid;
208     is($hit->name, shift @$d);
209     is($hit->length, shift @$d);
210     is($hit->accession, shift @$d);
211     is(sprintf("%g",$hit->significance), sprintf("%g",shift @$d) );
212     is($hit->raw_score, shift @$d );
214     if( $count == 0 ) {
215         my $hsps_left = 1;
216         while( my $hsp = $hit->next_hsp ) {
217             is($hsp->query->start, 1373);
218             is($hsp->query->end, 1706);
219             is($hsp->query->strand, 0);
220             is($hsp->hit->start, 5);
221             is($hsp->hit->end, 341);
222             is($hsp->hit->strand, 0);
223             is($hsp->length('total'), 345);         
224             is(sprintf("%g",$hsp->evalue), sprintf("%g",'3.1e-59') );
225             is($hsp->score, 1170.6);
226             is($hsp->bits,227.8);
227             is(sprintf("%.2f",$hsp->percent_identity), 53.04);
228             is(sprintf("%.4f",$hsp->frac_identical('query')), 0.5479);
229             is(sprintf("%.4f",$hsp->frac_identical('hit')), '0.5430');
230             is($hsp->query->frame(), 0);
231             is($hsp->hit->frame(), 0);
232             is($hsp->gaps('query'), 11);
233             is($hsp->gaps, 194);
234             is($hsp->hit_string, (' 'x26).'MRTAVLLPLLAL----LAVAQA-VSFADVVMEEWHTFKLEHRKNYQDETEERFRLKIFNENKHKIAKHNQRFAEGKVSFKLAVNKYADLLHHEFRQLMNGFNYTLHKQLRAADESFKGVTFISPAHVTLPKSVDWRTKGAVTAVKDQGHCGSCWAFSSTGALEGQHFRKSGVLVSLSEQNLVDCSTKYGNNGCNGGLMDNAFRYIKDNGGIDTEKSYPYEAIDDSCHFNKGTVGATDRGFTDIPQGDEKKMAEAVATVGPVSVAIDASHESFQFYSEGVYNEPQCDAQNLDHGVLVVGFGTDESGED---YWLVKNSWGTTWGDKGFIKMLRNKENQCGIASASSYPLV');
235             is($hsp->query_string, 'SNWGNNGYFLIERGKNMCGLAACASYPIPQVMNPTLILAAFCLGIASATLTFDHSLEAQWTKWKAMHNRLY-GMNEEGWRRAVWEKNMKMIELHNQEYREGKHSFTMAMNAFGDMTSEEFRQVMNGFQ---NRKPR------KGKVFQEPLFYEAPRSVDWREKGYVTPVKNQGQCGSCWAFSATGALEGQMFRKTGRLISLSEQNLVDCSGPQGNEGCNGGLMDYAFQYVQDNGGLDSEESYPYEATEESCKYNPKYSVANDTGFVDIPK-QEKALMKAVATVGPISVAIDAGHESFLFYKEGIYFEPDCSSEDMDHGVLVVGYGFESTESDNNKYWLVKNSWGEEWGMGGYVKMAKDRRNHCGIASAASYPTVMTPLLLLAVLCLGTALATPKFDQTFNAQWHQWKSTHRRLYGTNEE');
236             # note: the reason this is not the same percent id above
237             # is we are calculating average percent id
238             is(sprintf("%.2f",$hsp->get_aln->percentage_identity()), 56.13);
239             $hsps_left--;
240         }
241         is($hsps_left, 0);
242     }
243     last if( $count++ > @valid );
245 is(@valid, 0);
246 is($result->hits, 21);
248 # test on TFASTXY
249 $searchio = Bio::SearchIO->new(-format => 'fasta',
250                               -file   => test_input_file('5X_1895.FASTXY'));
251 $result = $searchio->next_result;
252 like($result->database_name, qr/yeast_nrpep.fasta/);
253 is($result->database_letters, 4215311);
254 is($result->database_entries, 9190);
255 is($result->algorithm, 'FASTY');
256 is($result->algorithm_version, '3.4t07');
257 is($result->query_name, '5X_1895.fa');
258 is($result->query_length, 7972);
259 is($result->get_parameter('gapopen'), -14);
260 is($result->get_parameter('gapext'), -2);
261 is($result->get_parameter('ktup'), 2);
262 is($result->get_parameter('matrix'), 'BL50');
264 is($result->get_statistic('lambda'), 0.1711);
265 is($result->get_statistic('dbletters'), 4215311);
266 is($result->get_statistic('dbentries'), 9190);
269 @valid = ( [ 'NR_SC:SW-YNN2_YEAST', 1056, 'NR_SC:SW-YNN2_YEAST','1.6e-154', '547.0'],
270            [ 'NR_SC:SW-MPCP_YEAST', 311, 'NR_SC:SW-MPCP_YEAST', '1.3e-25', 117.1],
271            [ 'NR_SC:SW-YEO3_YEAST', 300, 'NR_SC:SW-YEO3_YEAST', '5.7e-05', 48.5]);
272 $count = 0;
274 while( my $hit = $result->next_hit ) {
275     my $d = shift @valid;
277     is($hit->name, shift @$d);
278     is($hit->length, shift @$d);
279     is($hit->accession, shift @$d);
280     is(sprintf("%g",$hit->significance), sprintf("%g",shift @$d) );
281     is($hit->raw_score, shift @$d );
283     if ( $count == 1 ) {
284         my $hsps_left = 1;
285         while( my $hsp = $hit->next_hsp ) {
286             is($hsp->query->start, 6947);
287             is($hsp->query->end, 7938);
288             is($hsp->query->strand, -1);
289             is($hsp->hit->start, 19);
290             is($hsp->hit->end, 287);
291             is($hsp->hit->strand, 0);
292             is($hsp->length('total'), 330);
293             
294             is(sprintf("%g",$hsp->evalue), sprintf("%g",'1.3e-25'));
295             is($hsp->score, 563.4);
296             is($hsp->bits,'117.1');
297             is(sprintf("%.2f",$hsp->percent_identity), 51.67);
298             is(sprintf("%.4f",$hsp->frac_identical('query')), 0.5244);
299             is(sprintf("%.4f",$hsp->frac_identical('hit')), 0.5728);
300             is($hsp->query->frame(), 0);
301             is($hsp->hit->frame(), 0);
302             is($hsp->gaps, 220);
303             is($hsp->query_string, 'RFALAGALGCAVTHGALTPVDVVKTRIQLEPEVYNRVGRFFNSS*GF*EL*GVVLMSQT\KGMVASFRQIIAKEGAGALLTGFGPTAVGYAIQGAFKFGG*VMMSLQITA*SRANLPISYEFWKKKAIDLVGVDKARENRQAIYLGASAIAEFFADIALCPLEATRIRLVSQPSFANGLSGGFLRILREEGPAAFYAGFGPILFKQVPYTMAKFAV*VDRTA*\YQTFG*YYRSYEVAVEKILKATGKSKDSLTGGQLTGLNLTSGLIAGLAAAVISQPADTLLSKINKTKGAPGQSTTSRLVQMAGQLGVSGLFTGMTTRLVMIGTLTAGQ');
304             is($hsp->hit_string, 'KFALAGAIGCGSTHSSMVPIDVVKTRIQLEPTVYN-------------------------KGMVGSFKQIIAGEGAGALLTGFGPTLLGYSIQGAFKFGG-------------------YEVFKKFFIDNLGYDTASRYKNSVYMGSAAMAEFLADIALCPLEATRIRLVSQPQFANGLVGGFSRILKEEGIGSFYSGFTPILFKQIPYNIAKFLVFERASEF-YYGFAG------------------PKEKLSSTSTTLLNLLSGLTAGLAAAIVSQPADTLLSKVNKTKKAPGQSTVGLLAQLAKQLGFFGSFAGLPTRLVMVGTLTSLQ');
305             is($hsp->homology_string, '.::::::.::. ::....:.::::::::::: :::                         ::::.::.:::: ::::::::::::: .::.:::::::::                   :: .::  :: .: : : . ....:.:..:.:::.:::::::::::::::::::.::::: ::: :::.::: ..::.:: ::::::.::..::: :    .   :  :.                    :..:.. . : ::: ::: ::::::..::::::::::.:::: ::::::.. :.:.: :::  : :.:. :::::.::::. :');
306             # note: the reason this is not the same percent id above
307             # is we are calculating average percent id
308             is(sprintf("%.2f",$hsp->get_aln->overall_percentage_identity()),
309                '54.27');
310             is(sprintf("%.2f",$hsp->get_aln->average_percentage_identity()),
311                '67.42');
312             TODO: {
313                 local $TODO = 'calculating seq_inds for FASTA including frameshifts not supported yet';
314                 is(join(' ', $hsp->seq_inds('query', 'nomatch',1)), '');
315                 is(join(' ', $hsp->seq_inds('query', 'mismatch',1)), '');
316             }
317             is(join(' ', $hsp->seq_inds('hit', 'nomatch',1)), '30 50 66 80 96 100 101 104 107 109 111 113 154 158 166 174 189 191-194 196 197 199 200 203 204 211 213 215 219 223 247 256 262 266 267 269 274 286');
318             is(join(' ', $hsp->seq_inds('hit', 'mismatch',1)), '30 50 66 80 96 100 101 104 107 109 111 113 154 158 166 174 189 191-194 196 197 199 200 203 204 211 213 215 219 223 247 256 262 266 267 269 274 286');
319             is(join(' ', $hsp->seq_inds('query', 'gap',1)), '');
320             is(join(' ', $hsp->seq_inds('hit', 'gap',1)), '53 93 203');
321             is($hsp->ambiguous_seq_inds, 'query');
322             $hsps_left--;
323         }
324         is($hsps_left, 0);
325     }
326     last if( $count++ > @valid );
328 is(@valid, 0);
329 is($result->hits, 58);
331 # test FASTA v35.04, params encoding changed 
332 # test on TFASTXY
333 $searchio = Bio::SearchIO->new(-format => 'fasta',
334                               -file   => test_input_file('BOSS_DROME.FASTP_v35_04'));
335 $result = $searchio->next_result;
336 like($result->database_name, qr/wormpep190/, 'TFASTXY');
337 is($result->database_letters, 10449259);
338 is($result->database_entries, 23771);
339 is($result->algorithm, 'FASTA');
340 is($result->algorithm_version, '35.04');
341 is($result->query_name, 'BOSS_DROME');
342 is($result->query_length, 896);
343 is($result->get_parameter('gapopen'), -10);
344 is($result->get_parameter('gapext'), -2);
345 is($result->get_parameter('ktup'), 2);
346 is($result->get_parameter('matrix'), 'BL50');
347 is($result->get_parameter('wordsize'), 16);
348 is($result->get_parameter('filter'), '15:-5');
350 is($result->get_statistic('lambda'), 0.122629);
351 is($result->get_statistic('dbletters'), 10449259);
352 is($result->get_statistic('dbentries'), 23771);
353 is($result->get_statistic('effectivespace'),23771);
355 # bug 2473 - fasta3.4 parsing with -U option
357 $searchio = Bio::SearchIO->new(-format => 'fasta',
358                                                           -file   => test_input_file('bug2473.fasta'));
360 while(my $res = $searchio->next_result) {
361     is($res->query_name, 'total:39860_L:12096_-3:12346_0:617_+3:14801');
362     is($res->query_description, '');
363     is($res->query_length, 22);
364     is($res->algorithm, 'FASTN');