diff --git a/lib/Bio/Role/Describable.pm6 b/lib/Bio/Role/Describable.pm6 index acf45f3..2c3923f 100644 --- a/lib/Bio/Role/Describable.pm6 +++ b/lib/Bio/Role/Describable.pm6 @@ -4,15 +4,5 @@ role Bio::Role::Describable { has Str $.display-name is rw = 'new-id'; has Str $.description is rw; - - # TODO: best way would to have aliased working again - takadonet - # Working again but not on roles - cjfields - - #has Str $.description is rw is aliased; - - method desc ($desc?) { - self.description = $desc if $desc; - return self.description; - } - + } diff --git a/lib/Bio/Role/Identifiable.pm6 b/lib/Bio/Role/Identifiable.pm6 index 89c54ed..691d3b7 100644 --- a/lib/Bio/Role/Identifiable.pm6 +++ b/lib/Bio/Role/Identifiable.pm6 @@ -8,19 +8,14 @@ role Bio::Role::Identifiable { # Do we need other IDs here? Or should we use a simple key-value store with # custom ID types allowed? - has Str $.id is rw; + + has Str $.display-id is rw; has Str $.primary-id is rw; has Int $.version is rw; has Str $.authority is rw; has Str $.namespace is rw; has Str $.accession is rw; - # 'display_id' is an alias of 'id' - method display-id($id?) { - $.id = $id if $id; - $.id - } - method object-id() { self.accession || ~self } @@ -39,14 +34,24 @@ role Bio::Role::Identifiable { } -=begin object_id +=begin display-id + + Title : display-id + Usage : $string = $obj.display-id() + Function: + Returns : A scalar Str + Status : Virtual + +=end display-id + +=begin object-id - Title : object_id - Usage : $string = $obj.object_id() + Title : object-id + Usage : $string = $obj.object-id() Function: a string which represents the stable primary identifier in this namespace of this object. For DNA sequences this is its accession, similarly for protein sequences Returns : A scalar Status : Virtual -=end object_id +=end object-id diff --git a/lib/Bio/Role/PrimarySeq.pm6 b/lib/Bio/Role/PrimarySeq.pm6 index 5f6df91..c77260b 100644 --- a/lib/Bio/Role/PrimarySeq.pm6 +++ b/lib/Bio/Role/PrimarySeq.pm6 @@ -3,7 +3,8 @@ use Bio::Tools::CodonTable; role Bio::Role::PrimarySeq { -# below is intended to disambiguate seq (raw sequence) from # needs some type-checking, just simple for now +# below is intended to disambiguate seq (raw sequence) from +# needs some type-checking, just simple for now has Str $.seq is rw; has SequenceType $.alphabet is rw = dna; has Bool $.is-circular is rw = False; @@ -11,21 +12,6 @@ has Bool $.is-circular is rw = False; # this is mainly to deal with display-id being an alias for 'id', and 'desc' being shorthand for 'description' # This probabky should be re-thought, at least until we can create an 'is aliased' trait again -method new(*%args) { - #allow for both 'id' and 'display-id' to initialize $!id attributes - if (%args{'display-id'}:exists) { - %args{'id'}= %args{'display-id'}; - %args{'display-id'}:delete; - } - - #allow for both 'desc' and 'description' to initalize $.description attributes - if (%args{'desc'}:exists) { - %args{'description'} = %args{'desc'}; - %args{'desc'}:delete; - } - return self.bless(|%args); -} - # TODO: lazily set the alphabet; left here until we decide on proper semantics, but # the default 'always guess' is not really great for performance method set-alphabet() { diff --git a/t/PrimarySeq.t b/t/PrimarySeq.t index 8aaf8df..7f2212a 100644 --- a/t/PrimarySeq.t +++ b/t/PrimarySeq.t @@ -12,7 +12,7 @@ my $seq = Bio::PrimarySeq.new( seq => 'TTGGTGGCGTCAACT', display-id => 'new-id', alphabet => dna, - accession => 'X677667', + accession => 'X677667', description => 'Sample Bio::Seq object' ); @@ -224,15 +224,6 @@ $seq.seq = 'TTGGTGGCG?CAACT'; # test for character '?' in the sequence string is($seq.seq, 'TTGGTGGCG?CAACT'); -# test for some aliases -$seq = Bio::PrimarySeq.new( - id => 'aliasid' , - description => 'Alias desc' -); -is( $seq.description, 'Alias desc' ); -is( $seq.desc('new desc'), 'new desc' ); -is( $seq.display-id, 'aliasid' ); - # test that x's are ignored and n's are assumed to be dna no longer true! # See Bug 2438. There are protein sequences floating about which are all 'X' # (unknown aa)