Move HMMER related modules, tests, and programs to new distribution.
[bioperl-live.git] / t / SearchIO / Writer / HitTableWriter.t
blobc64b4fdc5a9916ea907465c35296a1dcecad37c1
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: SearchIO_HitTableWriter.t 14995 2008-11-16 06:20:00Z cjfields $
4 use strict;
6 BEGIN {
7     use lib '.';
8     use Bio::Root::Test;
9     
10     test_begin(-tests => 8);
11     
12     use_ok('Bio::SearchIO');
13     use_ok('Bio::SearchIO::Writer::HitTableWriter');
16 my ($searchio, $result, $hit, $hsp);
18 $searchio = Bio::SearchIO->new('-format' => 'blast',
19     '-file'   => test_input_file('HUMBETGLOA.tblastx'));
21 $result = $searchio->next_result;
23 isa_ok($result,'Bio::Search::Result::ResultI');
24 $hit = $result->next_hit;
25 is($hit->accession, 'AE000479');
26 is($hit->bits, 33.6);
27 $hsp = $hit->next_hsp;
28 is($hit->hsp->bits,$hsp->bits);
29 isa_ok($hsp->get_aln,'Bio::Align::AlignI');
31 my $writer = Bio::SearchIO::Writer::HitTableWriter->new( 
32     -columns => [qw(query_name
33                     query_length
34                     hit_name
35                     hit_length
36                     bits
37                     score
38                     frac_identical_query
39                     expect
40                     )]  );
42 my $outfile = test_output_file();
43 my $out = Bio::SearchIO->new(-writer => $writer,
44              -file   => ">$outfile");
45 $out->write_result($result, 1);
46 ok(-s $outfile);
48 # tests checking file output?