1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 27,
10 -requires_module => 'DB_File');
12 use_ok('Bio::DB::Flat');
15 my $verbose = test_debug();
17 # First of all we need to create an flat db
19 my $tmpdir = test_output_dir();
21 my $db = Bio::DB::Flat->new(-directory => $tmpdir,
28 my $dir = test_input_file('AAC12660.fa');
29 my $result = $db->build_index(glob($dir));
32 # Now let's get the sequence out again
33 my $seq = $db->get_Seq_by_id('AAC12660');
38 $db = Bio::DB::Flat->new(-directory => $tmpdir,
45 $dir= test_input_file('cds_sample.embl');
47 $result = $db->build_index(glob($dir));
49 is ($db->get_all_primary_ids, 1);
50 #is ($db->get_all_accs, 1);
52 $seq = $db->get_Seq_by_id('EAL24309');
56 # deal with wantarray conditions
57 $seq = $db->get_Seq_by_acc('CH236947.1');
58 ok($seq && ref($seq));
63 $db = Bio::DB::Flat->new(-directory => $tmpdir,
64 -index => 'binarysearch',
71 $dir = test_input_file('dbfa', '1.fa');
72 $result = $db->build_index($dir);
74 $seq = $db->get_Seq_by_id('AW057119');
76 is($seq->length, 808);
77 $seq = $db->get_Seq_by_id('AW057118');
79 is($seq->length, 299);
84 test_skip(-tests => 4, -requires_module => 'Data::Stag');
85 $db = Bio::DB::Flat->new(-directory => $tmpdir,
86 -index => 'binarysearch',
88 -dbname => 'mybinswiss',
92 $dir= test_input_file('swiss.dat');
93 $result = $db->build_index($dir);
96 $seq = $db->get_Seq_by_id('ACON_CAEEL');
100 $seq = $db->get_Seq_by_id('ACON_CAEEL');
101 ok($seq && ref($seq));
105 $db = Bio::DB::Flat->new(-directory => $tmpdir,
106 -index => 'binarysearch',
108 -dbname => 'myfasta',
109 -verbose => $verbose,
112 $dir = test_input_file('tmp.fst');
113 $result = $db->build_index(glob($dir));
115 $seq = $db->get_Seq_by_id('TEST00004');
120 $db = Bio::DB::Flat->new(-directory => $tmpdir,
123 -dbname => 'mybfasta',
124 -verbose => $verbose,
127 $dir = test_input_file('tmp.fst');
128 $result = $db->build_index(glob($dir));
130 for my $id ( qw(TEST00001 TEST00002 TEST00003 TEST00004) ) {
131 $seq = $db->get_Seq_by_id($id);