[Bioperl-guts-l] [15697] bioperl-live/trunk: tests pass, but the code needs some extra tweaking

Christopher John Fields cjfields at dev.open-bio.org
Tue May 19 17:00:23 EDT 2009


Revision: 15697
Author:   cjfields
Date:     2009-05-19 17:00:23 -0400 (Tue, 19 May 2009)

Log Message:
-----------
tests pass, but the code needs some extra tweaking

Modified Paths:
--------------
    bioperl-live/trunk/Bio/Search/HSP/ModelHSP.pm
    bioperl-live/trunk/Bio/SearchIO/infernal.pm
    bioperl-live/trunk/t/SearchIO/infernal.t

Modified: bioperl-live/trunk/Bio/Search/HSP/ModelHSP.pm
===================================================================
--- bioperl-live/trunk/Bio/Search/HSP/ModelHSP.pm	2009-05-19 20:42:09 UTC (rev 15696)
+++ bioperl-live/trunk/Bio/Search/HSP/ModelHSP.pm	2009-05-19 21:00:23 UTC (rev 15697)
@@ -76,7 +76,6 @@
 package Bio::Search::HSP::ModelHSP;
 use strict;
 use Bio::Seq::Meta;
-use Data::Dumper;
 
 use base qw(Bio::Search::HSP::GenericHSP);
 

Modified: bioperl-live/trunk/Bio/SearchIO/infernal.pm
===================================================================
--- bioperl-live/trunk/Bio/SearchIO/infernal.pm	2009-05-19 20:42:09 UTC (rev 15696)
+++ bioperl-live/trunk/Bio/SearchIO/infernal.pm	2009-05-19 21:00:23 UTC (rev 15697)
@@ -124,6 +124,7 @@
         'Hit_accession' => 'HIT-accession',
         'Hit_def'       => 'HIT-description',
         'Hit_signif'    => 'HIT-significance', # evalues only in v0.81, optional
+        'Hit_p'         => 'HIT-p',            # pvalues in 1.0, optional
         'Hit_score'     => 'HIT-score', # best HSP bit score
         'Hit_bits'      => 'HIT-bits', # best HSP bit score
  
@@ -211,11 +212,12 @@
             -verbose   => $self->verbose
         )
     );
-    $model     && $self->model($model);
-    $database  && $self->database($database);
-    $accession && $self->query_accession($accession);
-    $convert   && $self->convert_meta($convert);
-    $desc      && $self->query_description($desc);
+	
+    defined $model     && $self->model($model);
+    defined $database  && $self->database($database);
+    defined $accession && $self->query_accession($accession);
+    defined $convert   && $self->convert_meta($convert);
+    defined $desc      && $self->query_description($desc);
     
     $version ||= $DEFAULT_VERSION;
     $self->version($version);
@@ -884,7 +886,8 @@
                     $self->element_hash({'Hit_score'    => $maxscore,
                                          'Hit_bits'     => $maxscore});
                     # don't know where to put minpval yet
-                    $self->element_hash({'Hit_signif'   => $mineval}) if $mineval; 
+                    $self->element_hash({'Hit_signif'   => $mineval}) if $mineval;
+                    $self->element_hash({'Hit_p'        => $minpval}) if $minpval;
                     $self->end_element({'Name' => 'Hit'});
                 }
                 last PARSER;

Modified: bioperl-live/trunk/t/SearchIO/infernal.t
===================================================================
--- bioperl-live/trunk/t/SearchIO/infernal.t	2009-05-19 20:42:09 UTC (rev 15696)
+++ bioperl-live/trunk/t/SearchIO/infernal.t	2009-05-19 21:00:23 UTC (rev 15697)
@@ -12,19 +12,15 @@
     use_ok('Bio::SearchIO');
 }
 
-my ($searchio, $result, $iter, $hit, $hsp, $algorithm, $meta);
+my ($result, $iter, $hit, $hsp, $algorithm, $meta);
 
 ### Infernal v. 1.0 ####
 
-$searchio = Bio::SearchIO->new( -format => 'infernal',
+my $searchio = Bio::SearchIO->new( -format => 'infernal',
                                 -file   => test_input_file('test2.infernal'),
-                                -hsp_minscore => 40,
-                                -verbose => 1
-                                # version is reset to the correct one by parser
-                                -model => 'Foo',
+                                -model => 'tRNAtest',
                                 -query_acc => 'RF01234',
                                 -query_desc => 'tRNA',
-                                #-convert_meta => 0,
                                );
 
 $result = $searchio->next_result;
@@ -41,7 +37,7 @@
 is($result->num_hits, 1, "Result num_hits");
 is($result->program_reference, undef, "Result program_reference");
 is($result->query_accession, 'RF01234', "Result query_accession");
-is($result->query_description, 'my RNA  ', "Result query_description");
+is($result->query_description, 'tRNA', "Result query_description");
 is($result->query_length, 72, "Result query_length");
 is($result->query_name, 'trna.5-1', "Result query_name");
 
@@ -121,7 +117,7 @@
 is($hit->rank, 1, "Hit rank");
 is($hit->raw_score, '78.06', "Hit raw_score");
 is($hit->score, '78.06', "Hit score");
-float_is($hit->p, '11.10', "Hit p");
+float_is($hit->p, '2.906e-26', "Hit p");
 float_is($hit->significance, '3.133e-21');
 
 $hsp = $hit->next_hsp;
@@ -296,7 +292,7 @@
 
 # p() works but there are no evalues yet for Infernal output, so catch and check...
 warning_like {$hit->p}
-    qr'P-value not defined. Using expect\(\) instead',
+    qr'P-value not defined. Using significance\(\) instead',
     "No p values";
 
 is($hit->length, 0, "Hit length");
@@ -538,7 +534,6 @@
 is($result->query_name, 'Purine', "Result query_name");
 
 $hit = $result->next_hit;
-$hit->verbose(2);
 isa_ok($hit, 'Bio::Search::Hit::HitI');
 is($hit->ncbi_gi, '633168', "Hit GI");
 is($hit->accession, 'X83878.1', "Hit accession");
@@ -551,9 +546,8 @@
 is($hit->num_hsps, 2, "Hit num_hsps");
 
 # p() works but there are no evalues yet for Infernal output, so catch and check...
-eval {$hit->p};
-like($@, qr'P-value not defined. Using expect\(\) instead',
-     "No p values");
+warnings_like {$hit->p} qr'P-value not defined. Using significance\(\) instead',
+     "No p values";
 
 is($hit->length, 0, "Hit length");
 is($hit->overlap, 0, "Hit overlap");




More information about the Bioperl-guts-l mailing list