~ubuntu-branches/ubuntu/oneiric/bioperl/oneiric

« back to all changes in this revision

Viewing changes to t/LocalDB/BlastIndex.t

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2009-03-10 07:19:11 UTC
  • mfrom: (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090310071911-ever3si2bbzx1iks
Tags: 1.6.0-2
* Removed patch system (not used):
  - removed instuctions in debian/rules;
  - removed quilt from Build-Depends in debian/control.
* Re-enabled tests:
  - uncommented test command in debian/rules;
  - uncommented previously missing build-dependencies in debian/control.
  - Re-enabled tests and uncommented build-dependencies accordingly.
* Removed libmodule-build-perl and libtest-harness-perl from
  Build-Depends-Indep (provided by perl-modules).
* Better cleaning of empty directories using find -type d -empty -delete
  instead of rmdir in debian/rules (LP: #324001).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*-Perl-*- Test Harness script for Bioperl
 
2
# $Id: BlastIndex.t 15112 2008-12-08 18:12:38Z sendu $
 
3
 
 
4
use strict;
 
5
 
 
6
BEGIN {
 
7
        use lib '.';
 
8
        use Bio::Root::Test;
 
9
        
 
10
        test_begin(-tests => 26,
 
11
                                  -requires_module => 'IO::String');
 
12
    
 
13
        use_ok('Cwd');
 
14
        use_ok('Bio::SearchIO');
 
15
        use_ok('Bio::Index::Blast');
 
16
}
 
17
 
 
18
END {  unlink qw( Wibbl Wibbl.pag Wibbl.dir Wibbl.index); }
 
19
 
 
20
# BLASTP
 
21
 
 
22
my $index = Bio::Index::Blast->new(-filename => 'Wibbl',
 
23
                                                                                          -write_flag => 1);
 
24
ok($index);
 
25
 
 
26
$index->make_index(test_input_file('multi_blast.bls'));
 
27
($index->dbm_package eq 'SDBM_File') ? 
 
28
        (ok(-e "Wibbl.pag" && -e "Wibbl.dir")) :
 
29
        (ok(-e "Wibbl"));
 
30
 
 
31
foreach my $id ( qw(CATH_RAT PAPA_CARPA) ) {
 
32
        my $fh = $index->get_stream($id);
 
33
        ok($fh);
 
34
        ok( ! eof($fh) );
 
35
        my $report = Bio::SearchIO->new(-noclose => 1,
 
36
                                   -format  => 'blast',
 
37
                                   -fh      => $fh);
 
38
        my $result = $report->next_result;
 
39
        like($result->query_name, qr/$id/);
 
40
        ok( $result->next_hit);
 
41
        
 
42
        like( $index->fetch_report($id)->query_name, qr/$id/);
 
43
}
 
44
 
 
45
# RPS-BLAST
 
46
 
 
47
$index = Bio::Index::Blast->new(-filename => 'Wibbl.index',
 
48
                                                                                  -write_flag => 1);
 
49
ok($index);
 
50
 
 
51
$index->make_index(test_input_file('rpsblast.bls'));
 
52
 
 
53
foreach my $id ( qw(orf20 orf40) ) {
 
54
        my $fh = $index->get_stream($id);
 
55
        ok($fh);
 
56
        ok( ! eof($fh) );
 
57
        my $report = Bio::SearchIO->new(-noclose => 1,
 
58
                                   -format  => 'blast',
 
59
                                   -fh      => $fh);
 
60
        my $result = $report->next_result;
 
61
        like($result->query_name, qr/$id/);
 
62
        ok( $result->next_hit);
 
63
        
 
64
        like( $index->fetch_report($id)->query_name, qr/$id/);
 
65
}