File: Perl.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 (131 lines) | stat: -rw-r--r-- 2,769 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# -*-Perl-*- Test Harness script for Bioperl
# $Id: Perl.t 15112 2008-12-08 18:12:38Z sendu $

use strict;

BEGIN { 
	use lib '.';
    use Bio::Root::Test;
    
    test_begin(-tests => 29,
			   -requires_module => 'IO::String');
	
	use_ok('Bio::Perl');
}

# Bio::Perl isn't OO so we don't see Bio::Perl->new() here

my ($seq_object,$filename,@seq_object_array);

# will guess file format from extension
$filename = test_input_file('cysprot1.fa');
ok ($seq_object = read_sequence($filename));
isa_ok $seq_object, 'Bio::SeqI';

# forces genbank format
$filename = test_input_file('AF165282.gb');
ok  ($seq_object = read_sequence($filename,'genbank'));
isa_ok $seq_object, 'Bio::SeqI';

# reads an array of sequences
$filename = test_input_file('amino.fa');
is (@seq_object_array = read_all_sequences($filename,'fasta'), 2);
isa_ok $seq_object_array[0], 'Bio::SeqI';
isa_ok $seq_object_array[1], 'Bio::SeqI';

$filename = test_output_file();
ok write_sequence(">$filename",'genbank',$seq_object);
ok ($seq_object = new_sequence("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA","myname","AL12232"));
isa_ok $seq_object, 'Bio::SeqI';

my $trans;

ok ($trans = translate($seq_object));

isa_ok $trans, 'Bio::SeqI';

ok ($trans = translate("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA"));

isa_ok $trans, 'Bio::PrimarySeqI';

ok ($trans = translate_as_string($seq_object));

is $trans, 'IGLGTQFVCYM';

$trans = '';

ok ($trans = translate_as_string("ATTGGTTTGGGGACCCAATTTGTGTGTTATATGTA"));

is $trans, 'IGLGTQFVCYM';

# we need to keep tests that depend on net connection at the end
# these now run only with BIOPERLDEBUG set

SKIP: {
	test_skip(-tests => 10, -requires_networking => 1);
	
	# swissprot
	SKIP: {
		eval {
			$seq_object = get_sequence('swissprot',"ROA1_HUMAN");
		};
		if ($@) {
			skip("problem connecting to SwissProt:$@",2);
		} else {
			ok $seq_object;
			isa_ok $seq_object, 'Bio::SeqI';
		}
	}
	
    # embl
	SKIP: {
		eval {
			$seq_object = get_sequence('embl',"BUM");
		};
		if ($@) {
			skip("problem connecting to EMBL:$@",2);
		} else {
			ok $seq_object;
			isa_ok $seq_object, 'Bio::SeqI';
		}
	}

	# genbank	
	SKIP: {
		eval {
			$seq_object = get_sequence('genbank',"AI129902");
		};
		if ($@) {
			skip("problem connecting to GenBank:$@",2);
		} else {
			ok $seq_object;
			isa_ok $seq_object, 'Bio::SeqI';
		}
	}

    # refseq
	SKIP: {
		eval {
			$seq_object = get_sequence('genbank',"NM_006732");
		};
		if( $@ ) {
			skip("problem connecting to RefSeq:$@",2);
		} else {
			ok $seq_object;
			isa_ok $seq_object, 'Bio::SeqI';
		}
	}
	
	# genpept
	SKIP: {
		eval {
			$seq_object = get_sequence('genpept',"AAC06201");
		};
		if ($@) {
			skip("problem connecting to RefSeq:$@",2);
		} else {
			ok $seq_object;
			isa_ok $seq_object, 'Bio::SeqI';
		}
	}
}