1 # -*-Perl-*- Test Harness script for Bioperl
9 test_begin(-tests => 27);
11 use_ok('Bio::Tools::Run::Hmmer');
13 use_ok('Bio::AlignIO');
16 my $verbose = test_debug();
17 my $quiet = $verbose > 0 ? 0 : 1;
19 my $db = test_input_file('pfam_sample_R11');
20 my @params = ('DB'=>$db,'E'=>5,'program'=>'hmmpfam','A'=>2,'-verbose' => $verbose, -quiet => $quiet);
23 my $factory = Bio::Tools::Run::Hmmer->new(@params);
24 isa_ok($factory, 'Bio::Tools::Run::Hmmer');
27 is $factory->hmm, $db;
28 my $prot_file = test_input_file('hmmpfam_protein_input');
30 my $seqstream = Bio::SeqIO->new(-file => $prot_file,
32 my $seq1 = $seqstream->next_seq();
35 # here we assume if hmmpfam isn't present, nothing is present
36 test_skip(-requires_executable => $factory,
39 my $searchio = $factory->run($seq1);
42 while (my $result = $searchio->next_result){
43 while(my $hit = $result->next_hit){
44 while (my $hsp = $hit->next_hsp){
50 isa_ok $feat[0], 'Bio::SeqFeatureI';
51 is ($feat[0]->feature1->start,25);
52 is ($feat[0]->feature1->end,92);
53 is ($feat[0]->feature2->start,1);
54 is ($feat[0]->feature2->end,124);
57 @params = ('HMM'=>$db,'E'=>5,'program'=>'hmmsearch','-verbose' => $verbose, -quiet => $quiet);
58 $factory = Bio::Tools::Run::Hmmer->new(@params);
59 isa_ok $factory, 'Bio::Tools::Run::Hmmer';
63 test_skip(-requires_executable => $factory,
66 my $searchio = $factory->run($seq1);
68 while (my $result = $searchio->next_result){
69 while(my $hit = $result->next_hit){
70 while (my $hsp = $hit->next_hsp){
76 isa_ok $feat[0], 'Bio::SeqFeatureI';
77 is ($feat[0]->feature1->start,1);
78 is ($feat[0]->feature1->end,124);
79 is ($feat[0]->feature2->start,25);
80 is ($feat[0]->feature2->end,92);
84 my $hmmout = test_output_file();
86 @params = ('HMM'=>$hmmout,'program'=>'hmmbuild', -verbose => $verbose, -quiet => $quiet);
87 $factory = Bio::Tools::Run::Hmmer->new(@params);
88 isa_ok $factory, 'Bio::Tools::Run::Hmmer';
89 is $factory->quiet, 1;
90 my $aln_file = test_input_file('cysprot.msf');
91 my $aio = Bio::AlignIO->new(-file=>$aln_file,-format=>'msf');
92 my $aln = $aio->next_aln;
95 test_skip(-requires_executable => $factory,
97 ok $factory->run($aln);
101 #test HMMCALIBRATE, and from now on, alternate (preferred) run method calling,
102 #though we need to check the executables are present in the normal way first
103 $factory->program_name('hmmcalibrate');
106 test_skip(-requires_executable => $factory,
108 ok $factory->hmmcalibrate();
111 $factory->program_name('hmmalign');
114 my $seqfile = test_input_file('cysprot1a.fa');
115 my $seqio = Bio::SeqIO->new(-file => $seqfile,
118 while( my $seq = $seqio->next_seq ) {
123 test_skip(-requires_executable => $factory,
125 $aio = $factory->hmmalign(@seqs);
126 ok $aln = $aio->next_aln;
127 is($aln->each_seq, 3);
130 $factory->program_name('hmmemit');
134 test_skip(-requires_executable => $factory,
136 my $seqio = $factory->hmmemit();
138 while (my $seq = $seqio->next_seq) {
141 is @seqs, 10; # emits 10 seqs by default