[Bioperl-guts-l] [16894] bioperl-live/trunk: [bug 3018]

Christopher John Fields cjfields at dev.open-bio.org
Thu Mar 4 00:37:56 EST 2010


Revision: 16894
Author:   cjfields
Date:     2010-03-04 00:37:56 -0500 (Thu, 04 Mar 2010)
Log Message:
-----------
[bug 3018] 
* patch for catching homology_string and seq_inds (courtesy Kiran Mukhyala)

Modified Paths:
--------------
    bioperl-live/trunk/Bio/SearchIO/gmap_f9.pm
    bioperl-live/trunk/t/SearchIO/gmap_f9.t

Modified: bioperl-live/trunk/Bio/SearchIO/gmap_f9.pm
===================================================================
--- bioperl-live/trunk/Bio/SearchIO/gmap_f9.pm	2010-03-04 05:28:57 UTC (rev 16893)
+++ bioperl-live/trunk/Bio/SearchIO/gmap_f9.pm	2010-03-04 05:37:56 UTC (rev 16894)
@@ -234,6 +234,7 @@
     for my $c (@{$info}) {
 	$a->{-query_seq} .= $c->{query_base};
 	$a->{-hit_seq} .= $c->{hit_base};
+    $a->{-homology_seq} .= $c->{query_base} eq $c->{hit_base} ? $c->{hit_base} : ' ';
 	$identical++ if ( $c->{query_base} eq $c->{hit_base} );
     }
 

Modified: bioperl-live/trunk/t/SearchIO/gmap_f9.t
===================================================================
--- bioperl-live/trunk/t/SearchIO/gmap_f9.t	2010-03-04 05:28:57 UTC (rev 16893)
+++ bioperl-live/trunk/t/SearchIO/gmap_f9.t	2010-03-04 05:37:56 UTC (rev 16894)
@@ -4,17 +4,17 @@
 use strict;
 use warnings;
 BEGIN {
-	use lib '.';
+    use lib '.';
     use Bio::Root::Test;
     
-    test_begin(-tests => 47);
-	
-	use_ok('Bio::SearchIO');
+    test_begin(-tests => 51);
+    
+    use_ok('Bio::SearchIO');
 }
 
 my $searchio =
     Bio::SearchIO->new(-format => 'gmap_f9',
-		       -file   => 't/data/gmap_f9.txt');
+               -file   => 't/data/gmap_f9.txt');
 
 my $result = $searchio->next_result;
 isa_ok($result, 'Bio::Search::Result::GenericResult', 'Did we get a Result?');
@@ -25,29 +25,31 @@
 my $hit = $result->next_hit;
 isa_ok($hit, 'Bio::Search::Hit::GenericHit', 'Did we get a Hit?');
 _check_hit($hit, {name => '17',
-		  length => 4624,
-		  num_hsps => 27,
-		 } );
+          length => 4624,
+          num_hsps => 27,
+         } );
 
 my $hsp = $hit->next_hsp;
 _check_hsp($hsp, {algorithm => 'GMAP',
-		  query_gaps => 1,
-		  hit_gaps => 0,
-		  query_length => 310,
-		  hit_length => 311,
-		  qseq => 'GGAGGAGGTGGAGGAGGAGG', # first 20 bases
-		  hseq => 'GGAGGAGGTGGAGGAGGAGG', # ditto
-		  query => {start => 1,
-			    end => 310,
-			    strand => 1},
-		  hit => {start => 35109780,
-			  end =>  35110090,
-			  strand => 1},
-		 } );
+          query_gaps => 1,
+          hit_gaps => 0,
+          query_length => 310,
+          hit_length => 311,
+          qseq => 'GGAGGAGGTGGAGGAGGAGG', # first 20 bases
+          hseq => 'GGAGGAGGTGGAGGAGGAGG', # ditto
+          query => {start => 1,
+                end => 310,
+                strand => 1},
+          hit => {start => 35109780,
+              end =>  35110090,
+              strand => 1},
+          homology_string => 'GGAGGAGGTGGAGGAGGAGG',
+          seq_inds_query_gap => [(61)]
+         } );
 
 my $searchio_rev =
     Bio::SearchIO->new(-format => 'gmap_f9',
-		       -file   => 't/data/gmap_f9-reverse-strand.txt');
+               -file   => 't/data/gmap_f9-reverse-strand.txt');
 my $result_rev = $searchio_rev->next_result;
 isa_ok($result_rev,
        'Bio::Search::Result::GenericResult', 'Did we get a Result?');
@@ -58,29 +60,31 @@
 
 $hit = $result_rev->next_hit;
 _check_hit($hit, {name => '17',
-		  length => 4624,
-		  num_hsps => 27,
-		 } );
+          length => 4624,
+          num_hsps => 27,
+         } );
 
 $hsp = $hit->next_hsp;
 _check_hsp($hsp, {algorithm => 'GMAP',
-		  query_gaps => 0,
-		  hit_gaps => 0,
-		  query_length => 974,
-		  hit_length => 974,
-		  qseq => 'TAGCTGTTTTCCAAAATATA', # first 20 bases
-		  hseq => 'TAGCTGTTTTCCAAAATATA', # ditto
-		  query => {start => 1,
-			    end => 974,
-			    strand => 1},
-		  hit => {start => 35137468,
-			  end =>  35138441,
-			  strand => -1},
-		 } );
+          query_gaps => 0,
+          hit_gaps => 0,
+          query_length => 974,
+          hit_length => 974,
+          qseq => 'TAGCTGTTTTCCAAAATATA', # first 20 bases
+          hseq => 'TAGCTGTTTTCCAAAATATA', # ditto
+          query => {start => 1,
+                end => 974,
+                strand => 1},
+          hit => {start => 35137468,
+              end =>  35138441,
+              strand => -1},
+          homology_string => 'TAGCTGTTTTCCAAAATATA',
+          seq_inds_query_gap => [()]
+         } );
 
 
 $searchio =  Bio::SearchIO->new(-format => 'gmap_f9',
-				-file   => 't/data/gmap_f9-multiple_results.txt');
+                -file   => 't/data/gmap_f9-multiple_results.txt');
 
 my $result_count = 0;
 while (my $result = $searchio->next_result) {
@@ -114,6 +118,8 @@
     is($hsp->query->start, $info->{query}->{start}, "Check query start");
     is($hsp->query->end, $info->{query}->{end}, "Check query end");
     is($hsp->query->strand, $info->{query}->{strand}, "Check query end");
+    is(substr($hsp->homology_string, 0, 20), $info->{homology_string}, 'Check the homology string');
+    is_deeply([$hsp->seq_inds('query', 'gap')], $info->{seq_inds_query_gap}, 'Check seq_inds');
     is($hsp->hit->start, $info->{hit}->{start}, "Check hit start");
     is($hsp->hit->end, $info->{hit}->{end}, "Check hit end");
     is($hsp->hit->strand, $info->{hit}->{strand}, "Check hit end");



More information about the Bioperl-guts-l mailing list