1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 25,
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('cds_sample.embl');
48 $result = $db->build_index(glob($dir));
50 is ($db->get_all_primary_ids, 1);
51 #is ($db->get_all_accs, 1);
53 $seq = $db->get_Seq_by_id('EAL24309');
57 # deal with wantarray conditions
58 $seq = $db->get_Seq_by_acc('CH236947.1');
59 ok($seq && ref($seq));
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');
82 test_skip(-tests => 4, -requires_module => 'Data::Stag');
83 $db = Bio::DB::Flat->new(-directory => $tmpdir,
84 -index => 'binarysearch',
86 -dbname => 'mybinswiss',
90 $dir= test_input_file('swiss.dat');
91 $result = $db->build_index($dir);
94 $seq = $db->get_Seq_by_id('ACON_CAEEL');
98 $seq = $db->get_Seq_by_id('ACON_CAEEL');
99 ok($seq && ref($seq));
103 $db = Bio::DB::Flat->new(-directory => $tmpdir,
104 -index => 'binarysearch',
106 -dbname => 'myfasta',
107 -verbose => $verbose,
110 $dir = test_input_file('tmp.fst');
111 $result = $db->build_index(glob($dir));
113 $seq = $db->get_Seq_by_id('TEST00004');
118 $db = Bio::DB::Flat->new(-directory => $tmpdir,
121 -dbname => 'mybfasta',
122 -verbose => $verbose,
125 $dir = test_input_file('tmp.fst');
126 $result = $db->build_index(glob($dir));
128 for my $id ( qw(TEST00001 TEST00002 TEST00003 TEST00004) ) {
129 $seq = $db->get_Seq_by_id($id);