Supply TEMPLATE and SUFFIX for temporary query sequence files.
[bioperl-run.git] / t / Genemark.hmm.prokaryotic.t
blob2fd5eb0f3215d6c597f3bb46f194dcb4f687e7e2
1 #-*-Perl-*-
2 # ## Bioperl Test Harness Script for Modules
3 # #
4 use strict;
6 BEGIN {
7     use Bio::Root::Test;
8     test_begin(-tests => 99,
9                -requires_modules => [qw(IPC::Run)]);
11     use_ok('Bio::Tools::Run::Genemark');
12     use_ok('Bio::Root::IO');
13     use_ok('Bio::Seq');
16 my $verbose   = test_debug();
17 my $model_dir = $ENV{'GENEMARK_MODELS'} if $ENV{'GENEMARK_MODELS'};
19 SKIP: {
20     my $fasta_file = test_input_file('H_pylori_J99.fasta');
21     test_skip(-tests => 96,
22                           -requires_env => 'GENEMARK_MODELS');
23     my $model_file = '';
24         
25         for my $mod (qw(Helicobacter_pylori_26695.mod Helicobacter_pylori.mod)) {
26                 my $modpath = Bio::Root::IO->catfile($model_dir, 'Helicobacter_pylori_26695.mod');
27                 if (-e $modpath) {
28                         $model_file = $modpath;
29                         last;
30                 }
31         }
32         
33         ok($model_file, "Found model file: $model_file");
34         
35         skip('Test model file not found', 95) if !$model_file;
36         
37     my $factory    = Bio::Tools::Run::Genemark->new( -m => $model_file,
38                         -program => 'gmhmmp');
39     test_skip(-tests => 95,
40                           -requires_executable => $factory);
41         
42     isa_ok $factory, 'Bio::Tools::Run::Genemark';
43     
44     my $seqstream = Bio::SeqIO->new(-file => $fasta_file, -format => 'fasta');
45     my $seq = $seqstream->next_seq();
46     
47     my $gmhmmp = $factory->run($seq);
48     isa_ok $gmhmmp,'Bio::Tools::Genemark';
50     my $first_gene = $gmhmmp->next_prediction();
51     isa_ok $first_gene, 'Bio::Tools::Prediction::Gene';
52     is $first_gene->seq_id(), 'gi|15611071|ref|NC_000921.1|';
53     
54         my $ct = 0;
55         # may fluctuate based on the model, stop after 91 checks
56     while (my $gene = $gmhmmp->next_prediction()) {
57         isa_ok $gene, 'Bio::Tools::Prediction::Gene';
58                 last if $ct++ == 90;
59     }
62 1;