File: RefSeq.t

package info (click to toggle)
bioperl 1.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 40,768 kB
  • ctags: 12,005
  • sloc: perl: 174,299; xml: 13,923; sh: 1,941; lisp: 1,803; asm: 109; makefile: 53
file content (59 lines) | stat: -rw-r--r-- 1,662 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*-Perl-*- Test Harness script for Bioperl
# $Id: RefSeq.t 15291 2009-01-05 04:22:36Z cjfields $

use strict;

BEGIN { 
	use lib '.';
    use Bio::Root::Test;
    
    test_begin(-tests => 16,
               -requires_modules => [qw(IO::String
                                        LWP::UserAgent
                                        HTTP::Request::Common)]);
    
	use_ok('Bio::DB::RefSeq');
    use_ok('Bio::DB::GenBank');
    use_ok('Bio::DB::EMBL');
}

my $verbose = test_debug() || -1;

my ($db,$seq,$db2,$seq2,$seqio);
# get a single seq

$seq = $seqio = undef;

#test redirection from GenBank and EMBL
#GenBank
ok $db = Bio::DB::GenBank->new('-verbose'=> $verbose, -redirect_refseq => 1);
#EMBL
ok $db2 = Bio::DB::EMBL->new('-verbose'=> $verbose, -redirect_refseq => 1);     

eval {
    $seq = $db->get_Seq_by_acc('NT_006732');
    $seq2 = $db2->get_Seq_by_acc('NT_006732');
};
ok $@;

SKIP: {
    test_skip(-tests => 10, -requires_networking => 1);
    
    eval {
        ok($seq = $db->get_Seq_by_acc('NM_006732'));
        is($seq->length, 3776);
        ok $seq2 = $db2->get_Seq_by_acc('NM_006732');
        is($seq2->length, 3776);
    };
    skip "Warning: Couldn't connect to RefSeq with Bio::DB::RefSeq.pm!", 10 if $@;
    
    eval { 
        ok defined($db = Bio::DB::RefSeq->new(-verbose=>$verbose)); 
        ok(defined($seq = $db->get_Seq_by_acc('NM_006732')));
        is( $seq->length, 3776);
        ok defined ($db->request_format('fasta'));
        ok(defined($seq = $db->get_Seq_by_acc('NM_006732')));
        is( $seq->length, 3776); 
    };
    skip "Warning: Couldn't connect to RefSeq with Bio::DB::RefSeq.pm!", 6 if $@;
}