File: splicedseq.t

package info (click to toggle)
bioperl 1.4-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, sarge
  • size: 20,336 kB
  • ctags: 8,476
  • sloc: perl: 119,890; xml: 6,001; lisp: 121; makefile: 57
file content (66 lines) | stat: -rw-r--r-- 1,311 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
# -*-Perl-*-

use strict;
use vars qw($DEBUG $TESTCOUNT);
my $error;

BEGIN {     
    eval { require Test; };
    if( $@ ) {
	use lib 't';
    }
    use Test;
    $TESTCOUNT = 9;
    plan tests => $TESTCOUNT;
    $error = 0;
};

if( $error ==  1 ) {
    exit(0);
}


use Bio::Seq;
use Bio::SeqIO;


my $str = Bio::SeqIO->new( '-file'=> Bio::Root::IO->catfile("t","data",
							    "U58726.gb"), 
			'-format' => 'GenBank');
ok $str;
my $seq;

ok ( $seq = $str->next_seq() );

# Here is a cute way to verify the sequence by seeing if the
# the translation matches what is annotated in the file -js
foreach my $ft ( grep { $_->primary_tag eq 'CDS'} 
		 $seq->top_SeqFeatures ) {
    if( $ft->has_tag('translation') ) {
	my ($translation) = $ft->each_tag_value('translation');
	my $t = $ft->spliced_seq();
	my $pepseq = $t->translate()->seq();
	chop($pepseq);# chop is to remove stop codon
	ok($translation,$pepseq); 
    }	
}

eval { require Bio::DB::GenBank };
if( $@ ) {
    print STDERR "Skipping remote location tests\n";
    for( $Test::ntest..$TESTCOUNT ) {
	skip("Not possible to test remote locations without DB access",1);
    }
    exit(0);
} else { 
	
#my $db = Bio::DB::GenBank->new();
#
#foreach my $ft ( $seq->top_SeqFeatures ) {
#	my $t = $ft->spliced_seq();
#	print "Got ",$t->seq,"\n";
#}

}