3 # ## Bioperl Test Harness Script for Modules
7 eval { require Test
; };
14 plan tests => $NTESTS;
17 use Bio::Tools::Run::Hmmer;
24 foreach ( $Test::ntest..$NTESTS ) {
25 skip('Unable to run Hmmer tests, exe may not be installed',1);
27 unlink Bio::Root::IO->catfile(qw(t data hmmer.hmm));
31 my $verbose = 1 if $ENV{'BIOPERLDEBUG'};
33 my $db = Bio
::Root
::IO
->catfile("t","data","pfam_sample_R11");
34 my @params = ('DB'=>$db,'E'=>5,'program'=>'hmmpfam','A'=>2,'-verbose' => $verbose);
37 my $factory = Bio
::Tools
::Run
::Hmmer
->new(@params);
38 ok
$factory->isa('Bio::Tools::Run::Hmmer');
40 my $prot_file= Bio
::Root
::IO
->catfile("t","data","hmmpfam_protein_input");
42 my $seq1 = Bio
::Seq
->new();
43 my $seqstream = Bio
::SeqIO
->new(-file
=> $prot_file,
45 $seq1 = $seqstream->next_seq();
47 my $hmmpfam_present = $factory->executable();
49 unless ($hmmpfam_present) {
50 warn("hmmpfam program not found. Skipping tests $Test::ntest to $NTESTS.\n");
54 my $searchio = $factory->run($seq1);
57 while (my $result = $searchio->next_result){
58 while(my $hit = $result->next_hit){
59 while (my $hsp = $hit->next_hsp){
65 ok
$feat[0]->isa('Bio::SeqFeatureI');
66 ok
($feat[0]->feature1->start,25);
67 ok
($feat[0]->feature1->end,92);
68 ok
($feat[0]->feature2->start,1);
69 ok
($feat[0]->feature2->end,124);
72 @params = ('HMM'=>$db,'E'=>5,'program'=>'hmmsearch','-verbose' => $verbose);
73 $factory = Bio
::Tools
::Run
::Hmmer
->new(@params);
74 ok
$factory->isa('Bio::Tools::Run::Hmmer');
76 $prot_file= Bio
::Root
::IO
->catfile("t","data","hmmpfam_protein_input");
78 $seq1 = Bio
::Seq
->new();
79 $seqstream = Bio
::SeqIO
->new(-file
=> $prot_file,
81 $seq1 = $seqstream->next_seq();
83 my $hmmsearch = $factory->executable();
86 warn("hmmsearch program not found. Skipping tests $Test::ntest to $NTESTS.\n");
89 $searchio = $factory->run($seq1);
91 while (my $result = $searchio->next_result){
92 while(my $hit = $result->next_hit){
93 while (my $hsp = $hit->next_hsp){
99 ok
$feat[0]->isa('Bio::SeqFeatureI');
100 ok
($feat[0]->feature1->start,1);
101 ok
($feat[0]->feature1->end,124);
102 ok
($feat[0]->feature2->start,25);
103 ok
($feat[0]->feature2->end,92);
106 my $hmmout= Bio
::Root
::IO
->catfile("t","data","hmmer.hmm");
107 @params = ('HMM'=>$hmmout,'program'=>'hmmbuild');
108 $factory = Bio
::Tools
::Run
::Hmmer
->new(@params);
109 ok
$factory->isa('Bio::Tools::Run::Hmmer');
110 my $aln_file= Bio
::Root
::IO
->catfile("t","data","cysprot.msf");
111 my $aio = Bio
::AlignIO
->new(-file
=>$aln_file,-format
=>'msf');
112 my $aln = $aio->next_aln;
119 $hmmout= Bio
::Root
::IO
->catfile("t","data","hmmer.hmm");
120 @params = ('HMM'=>$hmmout,'program'=>'hmmalign');
121 $factory = Bio
::Tools
::Run
::Hmmer
->new(@params);
122 ok
$factory->isa('Bio::Tools::Run::Hmmer');
123 my $seqfile= Bio
::Root
::IO
->catfile("t","data","cysprot1a.fa");
124 my $seqio = Bio
::SeqIO
->new(-file
=> $seqfile,
127 while( my $seq = $seqio->next_seq ) {
130 $aio = $factory->run(@seqs);
131 $aln = $aio->next_aln;
133 #$aio = Bio::AlignIO->new(-format => 'clustalw');
134 #$aio->write_aln($aln);
135 ok
($aln->each_seq, 3);