1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 27,
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));
64 $db = Bio::DB::Flat->new(-directory => $tmpdir,
65 -index => 'binarysearch',
72 $dir = test_input_file('dbfa', '1.fa');
73 $result = $db->build_index($dir);
75 $seq = $db->get_Seq_by_id('AW057119');
77 is($seq->length, 808);
78 $seq = $db->get_Seq_by_id('AW057118');
80 is($seq->length, 299);
85 test_skip(-tests => 4, -requires_module => 'Data::Stag');
86 $db = Bio::DB::Flat->new(-directory => $tmpdir,
87 -index => 'binarysearch',
89 -dbname => 'mybinswiss',
93 $dir= test_input_file('swiss.dat');
94 $result = $db->build_index($dir);
97 $seq = $db->get_Seq_by_id('ACON_CAEEL');
101 $seq = $db->get_Seq_by_id('ACON_CAEEL');
102 ok($seq && ref($seq));
106 $db = Bio::DB::Flat->new(-directory => $tmpdir,
107 -index => 'binarysearch',
109 -dbname => 'myfasta',
110 -verbose => $verbose,
113 $dir = test_input_file('tmp.fst');
114 $result = $db->build_index(glob($dir));
116 $seq = $db->get_Seq_by_id('TEST00004');
121 $db = Bio::DB::Flat->new(-directory => $tmpdir,
124 -dbname => 'mybfasta',
125 -verbose => $verbose,
128 $dir = test_input_file('tmp.fst');
129 $result = $db->build_index(glob($dir));
131 for my $id ( qw(TEST00001 TEST00002 TEST00003 TEST00004) ) {
132 $seq = $db->get_Seq_by_id($id);