1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 24,
11 -requires_module => 'DB_File');
13 use_ok('Bio::DB::Flat');
16 my $verbose = test_debug();
18 # First of all we need to create an flat db
20 my $tmpdir = test_output_dir();
22 my $db = Bio::DB::Flat->new(-directory => $tmpdir,
29 my $dir = test_input_file('AAC12660.fa');
30 my $result = $db->build_index(glob($dir));
33 # Now let's get the sequence out again
34 my $seq = $db->get_Seq_by_id('AAC12660');
39 $db = Bio::DB::Flat->new(-directory => $tmpdir,
46 $dir= test_input_file('factor7.embl');
48 $result = $db->build_index(glob($dir));
50 $seq = $db->get_Seq_by_id('HSCFVII');
52 is($seq->length,12850);
54 # deal with wantarray conditions
55 $seq = $db->get_Seq_by_acc('J02933');
56 ok($seq && ref($seq));
57 is($seq->length,12850);
62 $db = Bio::DB::Flat->new(-directory => $tmpdir,
63 -index => 'binarysearch',
70 $dir= test_input_file('dbfa', '1.fa');
71 $result = $db->build_index($dir);
73 $seq = $db->get_Seq_by_id('AW057119');
78 $db = Bio::DB::Flat->new(-directory => $tmpdir,
79 -index => 'binarysearch',
81 -dbname => 'mybinswiss',
85 $dir= test_input_file('swiss.dat');
86 $result = $db->build_index($dir);
89 $seq = $db->get_Seq_by_id('ACON_CAEEL');
93 $seq = $db->get_Seq_by_id('ACON_CAEEL');
94 ok($seq && ref($seq));
98 $db = Bio::DB::Flat->new(-directory => $tmpdir,
99 -index => 'binarysearch',
101 -dbname => 'myfasta',
102 -verbose => $verbose,
105 $dir = test_input_file('tmp.fst');
106 $result = $db->build_index(glob($dir));
108 $seq = $db->get_Seq_by_id('TEST00004');
113 $db = Bio::DB::Flat->new(-directory => $tmpdir,
116 -dbname => 'mybfasta',
117 -verbose => $verbose,
120 $dir = test_input_file('tmp.fst');
121 $result = $db->build_index(glob($dir));
123 for my $id ( qw(TEST00001 TEST00002 TEST00003 TEST00004) ) {
124 $seq = $db->get_Seq_by_id($id);