1 # -*-Perl-*- Test Harness script for Bioperl
2 # $Id: Hmmer.t 14989 2008-11-11 19:52:02Z cjfields $
10 test_begin(-tests => 29);
12 use_ok('Bio::Tools::HMMER::Domain');
13 use_ok('Bio::Tools::HMMER::Set');
14 use_ok('Bio::Tools::HMMER::Results');
17 my ($domain,$set,$homol,$rev,$res,$dom,@doms);
18 $domain = Bio::Tools::HMMER::Domain->new(-verbose=>1);
20 is ref($domain), 'Bio::Tools::HMMER::Domain';
28 $domain->evalue(0.0001);
29 $domain->seq_id('silly');
32 # test that we can get out forward and reverse homol_SeqFeatures
33 $homol = $domain->feature2();
34 is $homol->start(), 10;
40 $set = Bio::Tools::HMMER::Set->new();
41 $set->add_Domain($domain);
43 @doms = $set->each_Domain();
50 $set->name('sillyname');
52 $set->accession('fakeaccesssion');
54 is $set->evalue(), 0.0001;
55 is $set->name(), 'sillyname';
56 is $set->desc, 'a desc';
57 is $set->accession, 'fakeaccesssion';
59 $res = Bio::Tools::HMMER::Results->new( -file => test_input_file('hmmsearch.out') , -type => 'hmmsearch');
61 is $res->hmmfile, "HMM";
62 is $res->seqfile, "HMM.dbtemp.29591";
65 foreach $set ( $res->each_Set) {
66 foreach $domain ( $set->each_Domain ) {
67 #print STDERR "Got domain ",$domain->seq_id," start ",$domain->start," end ",$domain->end,"\n";
68 # do nothing for the moment
74 is $res->number, 1215;
76 $res = Bio::Tools::HMMER::Results->new( -file => test_input_file('hmmpfam.out') ,
83 $res = Bio::Tools::HMMER::Results->new( -file => test_input_file('L77119.hmmer'),
86 is $res->hmmfile, 'Pfam';
87 is $res->seqfile, 'L77119.faa';
88 foreach $set ( $res->each_Set) {
89 # only one set anyways
91 is($set->name, 'gi|1522636|gb|AAC37060.1|');
92 is($set->desc, 'M. jannaschii predicted coding region MJECS02 [Methanococcus jannaschii]');
93 is($set->accession, '[none]');
94 foreach $domain ( $set->each_Domain ) {
95 #print STDERR "Got domain ",$domain->seq_id," start ",$domain->start," end ",$domain->end,"\n";
96 # do nothing for the moment
97 is($domain->start, 280);
98 is($domain->end, 481);
99 is($domain->bits, -105.2);
100 is($domain->evalue, 0.0022 );
103 is ($res->number, 1);
105 # test for bugs #(1189,1034,1172)
106 $res = Bio::Tools::HMMER::Results->new( -file => test_input_file('hmmsearch.out') ,
107 -type => 'hmmsearch');
108 my $res2 = $res->filter_on_cutoff(100,50);
110 is($res2->number, 604);