Skip to content

Commit

Permalink
Implemented and tested is_circular attribute/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Takadonet committed Mar 31, 2011
1 parent a972417 commit d608201
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
16 changes: 8 additions & 8 deletions lib/Bio/SeqFeature/Lite.pm
Expand Up @@ -73,6 +73,7 @@ has $.refseq is rw;

has @!segments is rw;

has Bool $!is_circular is rw;

# usage:
# Bio::SeqFeature::Lite->new(
Expand Down Expand Up @@ -105,7 +106,7 @@ method new(*%args is copy) {
#list of arguments that need attributes : url seq phase desc attributes primary_id

# is_circular is needed for Bio::PrimarySeqI compliance
%args{'is_circular'} = %args{'is_circular'} || 0;
%args{'is_circular'} = %args{'is_circular'} || False;

# fix start, stop
if (defined %args{'stop'} && defined %args{'start'}
Expand Down Expand Up @@ -285,13 +286,12 @@ method strand($value?) {
# return self->end - self->start + 1;
# }

# #is_circular is needed for Bio::PrimarySeqI
# method is_circular {
# my $self = shift;
# my $d = self->{is_circular};
# self->{is_circular} = shift if @_;
# $d;
# }
#is_circular is needed for Bio::PrimarySeqI
method is_circular(Bool $value?) {
my $d = $!is_circular;
$!is_circular = $value if $value;
$d;
}

method seq() {
my $seq = defined $!seq ?? $!seq !! '';
Expand Down
5 changes: 4 additions & 1 deletion t/SeqFeature/Lite.t
Expand Up @@ -4,7 +4,7 @@ BEGIN {
}

use Test;
plan 30;
plan 37;
eval_lives_ok 'use Bio::SeqFeature::Lite', 'Can use Bio::SeqFeature::Lite';

use Bio::SeqFeature::Lite;
Expand Down Expand Up @@ -52,7 +52,10 @@ is($lite.strand,0);
is($lite.class,'Sequence');
is($lite.type,'gapped_alignment');
is($lite.feature_count,3);
is($lite.is_circular,False);

for ($lite.segments) -> $x {
is($x.name,'ABC-3');
is($x.type,'similarity');
is($x.is_circular,False);
}

0 comments on commit d608201

Please sign in to comment.