From e9bd0fad035f0976772600c1061454e1b421e926 Mon Sep 17 00:00:00 2001 From: Florent Angly Date: Wed, 31 Oct 2012 12:20:55 +1000 Subject: [PATCH] Avoid new() just to revcom() a sequence ... use Bio::PrimarySeqI::_revcom_from_string instead --- Bio/PrimarySeq.pm | 14 +++++++------- t/Seq/PrimarySeq.t | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Bio/PrimarySeq.pm b/Bio/PrimarySeq.pm index 3cf012583..a53169126 100644 --- a/Bio/PrimarySeq.pm +++ b/Bio/PrimarySeq.pm @@ -378,15 +378,15 @@ sub subseq { if( ref($start) && $start->isa('Bio::LocationI') ) { my $loc = $start; - my $seq = ""; + my $seq = ''; foreach my $subloc ($loc->each_Location()) { - my $piece = $self->subseq(-START => $subloc->start(), - -END => $subloc->end(), - -REPLACE_WITH => $replace, - -NOGAP => $nogap); + my $piece = $self->subseq(-start => $subloc->start(), + -end => $subloc->end(), + -replace_with => $replace, + -nogap => $nogap); $piece =~ s/[$GAP_SYMBOLS]//g if $nogap; - if($subloc->strand() < 0) { - $piece = Bio::PrimarySeq->new( -seq => $piece)->revcom()->seq(); + if ($subloc->strand() < 0) { + $piece = $self->_revcom_from_string($piece, $self->alphabet); } $seq .= $piece; } diff --git a/t/Seq/PrimarySeq.t b/t/Seq/PrimarySeq.t index aa93875b5..549a125fe 100644 --- a/t/Seq/PrimarySeq.t +++ b/t/Seq/PrimarySeq.t @@ -8,7 +8,7 @@ BEGIN { use lib '.'; use Bio::Root::Test; - test_begin( -tests => 163 ); + test_begin( -tests => 164 ); use_ok('Bio::PrimarySeq'); use_ok('Bio::Location::Simple'); -- 2.11.4.GIT