test
[bioperl-run.git] / t / Genscan.t
blobc63e2862e82c789542952bbc36e1b0b6fa598850
1 #!/usr/local/bin/perl
2 #-*-Perl-*-
3 # ## Bioperl Test Harness Script for Modules
5 use strict;
6 BEGIN {
7 eval { require Test; };
8 if( $@ ) {
9 use lib 't';
11 use Test;
12 use vars qw($NTESTS);
13 $NTESTS = 4;
14 plan tests => $NTESTS;
17 END {
18 foreach ( $Test::ntest..$NTESTS ) {
19 skip('Unable to run Genscan tests, exe may not be installed',1);
23 use Bio::Tools::Run::Genscan;
24 use Bio::Root::IO;
27 if(! $ENV{'GENSCANDIR'}){
28 warn("Need to define env variable GENSCANDIR to run test");
29 exit(0);
32 my $paramfile = Bio::Root::IO->catfile($ENV{'GENSCANDIR'},"HumanIso.smat");
33 my @params = ('MATRIX',$paramfile);
34 my $factory = Bio::Tools::Run::Genscan->new(@params);
35 ok $factory->isa('Bio::Tools::Run::Genscan');
36 ok $factory->matrix;
38 my $inputfilename = Bio::Root::IO->catfile("t","data","Genscan.FastA");
39 my $seq1 = Bio::Seq->new();
40 my $seqstream = Bio::SeqIO->new(-file => $inputfilename, -format => 'Fasta');
41 $seq1 = $seqstream->next_seq();
43 my $genscan_present = $factory->executable();
45 unless ($genscan_present) {
46 warn("Genscan program not found. Skipping tests $Test::ntest to $NTESTS.\n");
47 exit 0;
49 $factory->quiet(1);
50 my @feat = $factory->predict_genes($seq1);
52 my $protein = $feat[0]->predicted_protein();
54 ok $feat[0]->isa("Bio::SeqFeatureI");
55 ok $protein->isa("Bio::PrimarySeqI");