2
## Bioperl Test Harness Script for Modules
3
## $Id: Genpred.t,v 1.15.8.1 2006/10/02 23:10:40 sendu Exp $
5
# Before `make install' is performed this script should be runnable with
6
# `make test'. After `make install' it should work as `perl test.t'
10
# to handle systems with no installed Test module
11
# we include the t dir (where a copy of Test.pm is located)
13
eval { require Test; };
21
use Bio::Tools::Genscan;
22
use Bio::Tools::Genemark;
23
use Bio::Tools::Glimmer;
29
my $genscan = Bio::Tools::Genscan->new('-file' => Bio::Root::IO->catfile("t","data","genomic-seq.genscan"));
33
my $seqin = Bio::SeqIO->new('-file' => Bio::Root::IO->catfile("t","data","genomic-seq.fasta"),
34
'-format' => "fasta");
36
my $seq = $seqin->next_seq();
40
# scan through the report
43
my ($prtseq, $cds, $tr_cds);
44
while(my $gene = $genscan->next_prediction()) {
45
$gene->attach_seq($seq) if $seq;
49
$fea = ($gene->exons())[0];
50
ok $fea->strand(), -1,
51
"strand mismatch (".$fea->strand()." instead of -1)";
52
$fea = ($gene->poly_A_site());
53
ok $fea->score(), 1.05,
54
"score mismatch (".$fea->score()." instead of 1.05)";
57
$fea = ($gene->exons("Initial"))[0];
59
"strand mismatch (".$fea->strand()." instead of 1)";
60
ok $fea->score(), 4.46,
61
"score mismatch (".$fea->score()." instead of 4.46)";
64
my @exons = $gene->exons("Initial");
66
"initial exons (".scalar(@exons)." instead of 0)";
67
$fea = ($gene->exons())[0];
68
ok $fea->score(), 1.74,
69
"score mismatch (".$fea->score()." instead of 1.74)";
72
$prtseq = $gene->predicted_protein()->seq();
74
ok($cds) || print STDERR "# no CDS for prediction $pred_num; protein: $prtseq\n";
75
$tr_cds = $cds->translate()->seq();
77
ok( lc($prtseq), lc($tr_cds),
78
"predicted and extracted protein seqs don't match");
82
# Genscan report with no genes predicted
83
my $null_genscan = Bio::Tools::Genscan->new('-file' => Bio::Root::IO->catfile("t","data","no-genes.genscan"));
85
my $no_gene = $null_genscan->next_prediction;
86
my @exons = $no_gene->exons;
90
my $mzef = Bio::Tools::MZEF->new('-file' => Bio::Root::IO->catfile("t","data","genomic-seq.mzef"));
94
my $gene = $mzef->next_prediction();
99
my $genemark = Bio::Tools::Genemark->new('-file' => Bio::Root::IO->catfile(qw(t data genemark.out)));
101
my $gmgene = $genemark->next_prediction();
102
ok $gmgene->seq_id(), "Hvrn.contig8";
103
ok $genemark->analysis_date(), "Thu Mar 22 10:25:00 2001";
106
my @num_exons = (1,5,2,1,9,5,3,2,3,2,1,2,7);
107
while($gmgene = $genemark->next_prediction()) {
109
my @gmexons = $gmgene->exons();
110
ok scalar(@gmexons), $num_exons[$i];
113
my $gmstart = $gmexons[0]->start();
116
my $gmend = $gmexons[0]->end();
121
# Glimmer testing (GlimmerM)
122
my $glimmer = new Bio::Tools::Glimmer('-file' => Bio::Root::IO->catfile(qw(t data glimmer.out)));
123
my $glimmergene = $glimmer->next_prediction;
126
ok($glimmergene->seq_id, 'BAC1Contig11');
127
ok($glimmergene->source_tag, 'GlimmerM_3.0');
128
ok($glimmergene->primary_tag, 'transcript');
129
ok(($glimmergene->get_tag_values('Group'))[0], 'GenePrediction1');
130
my @glim_exons = $glimmergene->exons;
131
ok(scalar (@glim_exons), 5);
132
ok($glim_exons[0]->start, 13907);
133
ok($glim_exons[0]->end, 13985);
134
ok($glim_exons[0]->strand, 1);
135
ok(($glim_exons[0]->get_tag_values('Group'))[0], 'GenePrediction1');
137
@num_exons = (0,5,3, 1, 6, 3);
139
while($glimmergene = $glimmer->next_prediction()) {
141
ok(($glimmergene->get_tag_values('Group'))[0],"GenePrediction$i");
142
@glim_exons = $glimmergene->exons();
143
ok scalar(@glim_exons), $num_exons[$i];
145
ok $glim_exons[1]->start, 30152;
146
ok $glim_exons[1]->end, 30235;
147
ok $glim_exons[1]->strand, -1;
151
# Glimmer testing (GlimmerM)
152
my $ghmm = Bio::Tools::Glimmer->new('-file' => Bio::Root::IO->catfile(qw(t data GlimmerHMM.out)));
153
my $ghmmgene = $ghmm->next_prediction;
156
ok($ghmmgene->seq_id, 'gi|23613028|ref|NC_004326.1|');
157
ok($ghmmgene->source_tag, 'GlimmerHMM');
158
ok($ghmmgene->primary_tag, 'transcript');
159
ok($ghmmgene->exons == 1);
161
@num_exons = qw(0 1 2 4 2 2 1 1 1 2 2 2 10 4 1 1); # only first few tested
163
while ($ghmmgene = $ghmm->next_prediction) {
165
my @ghmm_exons = $ghmmgene->exons;
166
ok(scalar(@ghmm_exons), $num_exons[$i]) if $i <= $#num_exons;
168
ok( $ghmm_exons[1]->start, 5538 );
169
ok( $ghmm_exons[1]->end, 5647 );
170
ok( $ghmm_exons[1]->strand > 0 );