1 # -*-Perl-*- Test Harness script for Bioperl
10 test_begin(-tests => 14);
12 $ENV{OBDA_SEARCH_PATH} = 't/data/registry/flat;t/data/registry/bdb';
14 use_ok('Bio::DB::Registry');
15 use_ok('Bio::DB::Flat');
18 # we need a temp directory t/tmp since t/tmp is specified in the registry files
19 my $tmpdir = File::Spec->catfile(qw(t tmp));
23 skip "unable to create temp dir '$tmpdir', skipping tests", 12 unless -d $tmpdir;
25 my $flat = Bio::DB::Flat->new(-directory => $tmpdir,
26 -dbname => 'testflat',
28 -index => 'binarysearch',
30 my $entries = $flat->build_index(test_input_file('cysprot.fa'));
34 test_skip(-tests => 2, -requires_modules => [qw(DB_File)]);
36 my $bdb = Bio::DB::Flat->new(-directory => $tmpdir,
42 $entries = $bdb->build_index(test_input_file('cysprot.fa'));
47 test_skip(-tests => 9,
48 -requires_modules => [qw(LWP::UserAgent HTTP::Request::Common)],
49 -requires_networking => 1);
51 my $registry = Bio::DB::Registry->new();
52 ok defined($registry);
53 my @available_services = $registry->services;
55 ok grep /testflat/,@available_services;
56 my $db = $registry->get_database('testflat');
58 my $seq = $db->get_Seq_by_id("ALEU_HORVU");
60 my $sequence = $seq->seq;
61 is $sequence, "MAHARVLLLALAVLATAAVAVASSSSFADSNPIRPVTDRAASTLESAVLGALGRTRHALRFARFAVRYGKSYESAAEVRRRFRIFSESLEEVRSTNRKGLPYRLGINRFSDMSWEEFQATRLGAAQTCSATLAGNHLMRDAAALPETKDWREDGIVSPVKNQAHCGSCWTFSTTGALEAAYTQATGKNISLSEQQLVDCAGGFNNFGCNGGLPSQAFEYIKYNGGIDTEESYPYKGVNGVCHYKAENAAVQVLDSVNITLNAEDELKNAVGLVRPVSVAFQVIDGFRQYKSGVYTSDHCGTTPDDVNHAVLAVGYGVENGVPYWLIKNSWGADWGDNGYFKMEMGKNMCAIATCASYPVVAA";
64 test_skip(-tests => 4, -requires_modules => [qw(DB_File)]);
66 ok grep /testbdb/,@available_services;
67 $db = $registry->get_database('testbdb');
69 $seq = $db->get_Seq_by_id("ALEU_HORVU");
71 $sequence = $seq->seq;
72 is $sequence, "MAHARVLLLALAVLATAAVAVASSSSFADSNPIRPVTDRAASTLESAVLGALGRTRHALRFARFAVRYGKSYESAAEVRRRFRIFSESLEEVRSTNRKGLPYRLGINRFSDMSWEEFQATRLGAAQTCSATLAGNHLMRDAAALPETKDWREDGIVSPVKNQAHCGSCWTFSTTGALEAAYTQATGKNISLSEQQLVDCAGGFNNFGCNGGLPSQAFEYIKYNGGIDTEESYPYKGVNGVCHYKAENAAVQVLDSVNITLNAEDELKNAVGLVRPVSVAFQVIDGFRQYKSGVYTSDHCGTTPDDVNHAVLAVGYGVENGVPYWLIKNSWGADWGDNGYFKMEMGKNMCAIATCASYPVVAA";
78 File::Path::rmtree($tmpdir) if ($tmpdir && (-d $tmpdir));