1 # -*-Perl-*- Test Harness script for Bioperl
5 use File::Temp qw(tempdir);
11 test_begin(-tests => 17,
12 -requires_module => 'DB_File');
14 use_ok('Bio::DB::Flat');
17 my $verbose = test_debug();
19 #First of all we need to create an flat db
21 my $tmpdir = tempdir( CLEANUP => 1 );
23 my $db = Bio::DB::Flat->new(-directory => $tmpdir,
31 my $dir = test_input_file('AAC12660.fa');
32 my $result = $db->build_index(glob($dir));
35 #Now let's get the sequence out again
36 my $seq = $db->get_Seq_by_id('AAC12660');
41 $db = Bio::DB::Flat->new(-directory => $tmpdir,
49 $dir= test_input_file('factor7.embl');
51 $result = $db->build_index(glob($dir));
53 $seq = $db->get_Seq_by_id('HSCFVII');
55 is($seq->length,12850);
57 # deal with wantarray conditions
58 $seq = $db->get_Seq_by_acc('J02933');
59 ok($seq && ref($seq));
60 is($seq->length,12850);
65 $db = Bio::DB::Flat->new(-directory => $tmpdir,
66 -index => 'binarysearch',
73 $dir= test_input_file('dbfa', '1.fa');
74 $result = $db->build_index($dir);
76 $seq = $db->get_Seq_by_id('AW057119');
81 $db = Bio::DB::Flat->new(-directory => $tmpdir,
82 -index => 'binarysearch',
84 -dbname => 'mybinswiss',
88 $dir= test_input_file('swiss.dat');
89 $result = $db->build_index($dir);
92 $seq = $db->get_Seq_by_id('ACON_CAEEL');
96 $seq = $db->get_Seq_by_id('ACON_CAEEL');
97 ok($seq && ref($seq));