[bug 2686]
[bioperl-live.git] / t / LiveSeq.t
blob114d31a1c77a60ee6774364d51018f6720b04360
1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id$
5 use strict;
7 BEGIN {     
8     use lib 't/lib';
9     use BioperlTest;
10     
11     test_begin(-tests => 48,
12                -requires_module => 'IO::String');
13         
14         use_ok('Bio::LiveSeq::IO::BioPerl');
17 my $loader=Bio::LiveSeq::IO::BioPerl->load(-db=>"EMBL", 
18                                            -file=>test_input_file('factor7.embl'));
19 ok $loader;
20 my $gene=$loader->gene2liveseq(-gene_name => "factor7");
21 ok $gene;
22 ok ref($gene), "Bio::LiveSeq::Gene";
23 is $gene->name, "factor7";
24 is $gene->get_DNA->alphabet, "dna";
25 is $gene->get_DNA->display_id, "HSCFVII";
26 is $gene->get_DNA->accession_number, "J02933";
27 is $gene, $gene->get_DNA->gene;
28 is $gene->get_DNA->desc, "Human blood coagulation factor VII gene, complete cds.";
29 is $gene->get_DNA->source, "Homo sapiens";
30 is $gene->get_DNA->start, 1;
31 is $gene->get_DNA->end, 12850;
32 is $gene->maxtranscript->start, 487;
33 is $gene->maxtranscript->end, 12686;
34 is $gene->upbound, 487;
35 is $gene->downbound, 12686;
36 ok not(defined($gene->get_Repeat_Units));
38 my @exons   = @{$gene->get_Exons};
39 my @introns = @{$gene->get_Introns};
40 is scalar(@exons), 9;
41 is scalar(@introns), 8;
42 is $introns[4]->desc, "Intron D";
43 is $introns[4]->start, 6592;
44 is $introns[4]->end, 8306;
45 is $exons[1]->desc, "optional";
46 is $exons[4]->end, 6591;
48 my $transcript  = $gene->get_Transcripts->[0];
49 my $translation = $gene->get_Translations->[0];
50 is $transcript , $translation->get_Transcript;
51 is $translation , $transcript->get_Translation;
53 @exons = $transcript->all_Exons;
54 is $exons[4]->end , 6591;
55 is $exons[4]->length , 114;
56 is $transcript->upstream_seq, "tcaacaggcaggggcagcactgcagagatttcatc";
57 is substr($transcript->downstream_seq,0,16), "cccagcagccctggcc";
58 is $transcript->position($transcript->label(666)), 666;
59 is $transcript->position($transcript->label(666),9419), 95;
60 is $transcript->labelsubseq(8447,undef,9419), "gt";
61 is $transcript->labelsubseq(8447,2), "gt";
62 is $gene->get_DNA->labelsubseq(8447,2), "gg";
63 is substr($gene->get_DNA->labelsubseq(8447,undef,9419),0,16), "ggtgaccaggcttcat";
64 is $gene->get_DNA, $transcript->{seq};
65 my ($nothing,$whichexon) = $transcript->in_which_Exon(9419);
66 is $whichexon , 7;
67 is $transcript->frame(9419) , 1;
68 is $transcript->frame(9420) , 2;
69 is substr($translation->seq,0,16), "MVSQALRLLCLLLGLQ";
70 is substr($transcript->seq,0,32), "atggtctcccaggccctcaggctcctctgcct";
71 ok $transcript->translation_table(2);
72 is $transcript->translation_table , 2;
73 is substr($translation->seq,0,16), "MVSQAL*"; # mitochondrial table creates stop codon
74 is $gene->verbose(2), 2;
75 ok $gene->delete_Obj(); # to free all memory, deleting circular references