| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Annotation::Collection.pm | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # Cared for by Ewan Birney <birney@ebi.ac.uk> | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # Copyright Ewan Birney | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | Bio::Annotation::Collection - Default Perl implementation of | ||||||||||||||||||||||||||||||||||||||||||
| 17 | AnnotationCollectionI | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | # get an AnnotationCollectionI somehow, eg | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | $ac = $seq->annotation(); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | foreach $key ( $ac->get_all_annotation_keys() ) { | ||||||||||||||||||||||||||||||||||||||||||
| 26 | @values = $ac->get_Annotations($key); | ||||||||||||||||||||||||||||||||||||||||||
| 27 | foreach $value ( @values ) { | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # value is an Bio::AnnotationI, and defines a "as_text" method | ||||||||||||||||||||||||||||||||||||||||||
| 29 | print "Annotation ",$key," stringified value ",$value->as_text,"\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | # also defined hash_tree method, which allows data orientated | ||||||||||||||||||||||||||||||||||||||||||
| 32 | # access into this object | ||||||||||||||||||||||||||||||||||||||||||
| 33 | $hash = $value->hash_tree(); | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | Bioperl implementation for Bio::AnnotationCollectionI | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 46 | Bioperl modules. Send your comments and suggestions preferably to one | ||||||||||||||||||||||||||||||||||||||||||
| 47 | of the Bioperl mailing lists. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 50 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 59 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 60 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 61 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||
| 63 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 66 | the bugs and their resolution. Bug reports can be submitted via | ||||||||||||||||||||||||||||||||||||||||||
| 67 | the web: | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =head1 AUTHOR - Ewan Birney | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | Email birney@ebi.ac.uk | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | The rest of the documentation details each of the object | ||||||||||||||||||||||||||||||||||||||||||
| 78 | methods. Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | package Bio::Annotation::Collection; | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 314 | $Bio::Annotation::Collection::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 88 | 314 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 314 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | # Object preamble - inherits from Bio::Root::Root | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 314 | ▶ | use Bio::Annotation::TypeManager; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 314 | ▶ | use Bio::Annotation::SimpleValue; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | 314 | ▶ | use base qw(Bio::Root::Root Bio::AnnotationCollectionI Bio::AnnotationI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 104 | Usage : $coll = Bio::Annotation::Collection->new() | ||||||||||||||||||||||||||||||||||||||||||
| 105 | Function: Makes a new Annotation::Collection object. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | Returns : Bio::Annotation::Collection | ||||||||||||||||||||||||||||||||||||||||||
| 107 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | 2181 | ▶ | sub new{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 112 | 2181 | my ($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 2181 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 2181 | $self->{'_annotation'} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 2181 | $self->_typemap(Bio::Annotation::TypeManager->new()); | |||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||
| 119 | 2181 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | =head1 L<Bio::AnnotationCollectionI> implementing methods | ||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | =head2 get_all_annotation_keys | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | Title : get_all_annotation_keys | ||||||||||||||||||||||||||||||||||||||||||
| 130 | Usage : $ac->get_all_annotation_keys() | ||||||||||||||||||||||||||||||||||||||||||
| 131 | Function: gives back a list of annotation keys, which are simple text strings | ||||||||||||||||||||||||||||||||||||||||||
| 132 | Returns : list of strings | ||||||||||||||||||||||||||||||||||||||||||
| 133 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||
| 135 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | 600 | ▶ | sub get_all_annotation_keys{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_all_annotation_keys: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 138 | 600 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 600 | return keys %{$self->{'_annotation'}}; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | =head2 get_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | Title : get_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 145 | Usage : my @annotations = $collection->get_Annotations('key') | ||||||||||||||||||||||||||||||||||||||||||
| 146 | Function: Retrieves all the Bio::AnnotationI objects for one or more | ||||||||||||||||||||||||||||||||||||||||||
| 147 | specific key(s). | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | If no key is given, returns all annotation objects. | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | The returned objects will have their tagname() attribute set to | ||||||||||||||||||||||||||||||||||||||||||
| 152 | the key under which they were attached, unless the tagname was | ||||||||||||||||||||||||||||||||||||||||||
| 153 | already set. | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | Returns : list of Bio::AnnotationI - empty if no objects stored for a key | ||||||||||||||||||||||||||||||||||||||||||
| 156 | Args : keys (list of strings) for annotations (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||||||||||
| 160 | 3140 | ▶ | sub get_Annotations{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_Annotations: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 3140 | my ($self,@keys) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 3140 | my @anns = (); | |||||||||||||||||||||||||||||||||||||||||
| 164 | 3140 | ▶ | @keys = $self->get_all_annotation_keys() unless @keys; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 3140 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 166 | 3521 | ▶ | if(exists($self->{'_annotation'}->{$key})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | push(@anns, | ||||||||||||||||||||||||||||||||||||||||||
| 168 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 169 | 3947 | ▶ | $_->tagname($key) if ! $_->tagname(); $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 2273 | } @{$self->{'_annotation'}->{$key}}); | |||||||||||||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 3140 | return @anns; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | =head2 get_nested_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | Title : get_nested_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 180 | Usage : my @annotations = $collection->get_nested_Annotations( | ||||||||||||||||||||||||||||||||||||||||||
| 181 | '-key' => \@keys, | ||||||||||||||||||||||||||||||||||||||||||
| 182 | '-recursive => 1); | ||||||||||||||||||||||||||||||||||||||||||
| 183 | Function: Retrieves all the Bio::AnnotationI objects for one or more | ||||||||||||||||||||||||||||||||||||||||||
| 184 | specific key(s). If -recursive is set to true, traverses the nested | ||||||||||||||||||||||||||||||||||||||||||
| 185 | annotation collections recursively and returns all annotations | ||||||||||||||||||||||||||||||||||||||||||
| 186 | matching the key(s). | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | If no key is given, returns all annotation objects. | ||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | The returned objects will have their tagname() attribute set to | ||||||||||||||||||||||||||||||||||||||||||
| 191 | the key under which they were attached, unless the tagname was | ||||||||||||||||||||||||||||||||||||||||||
| 192 | already set. | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | Returns : list of Bio::AnnotationI - empty if no objects stored for a key | ||||||||||||||||||||||||||||||||||||||||||
| 195 | Args : -keys => arrayref of keys to search for (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 196 | -recursive => boolean, whether or not to recursively traverse the | ||||||||||||||||||||||||||||||||||||||||||
| 197 | nested annotations and return annotations with matching keys. | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 227 | ▶ | sub get_nested_Annotations { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_nested_Annotations: called CC=14 SCAR=29.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 227 | my ($self, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 227 | my ($keys, $recursive) = $self->_rearrange([qw(KEYS RECURSIVE)], @args); | |||||||||||||||||||||||||||||||||||||||||
| 204 | 227 | $self->verbose(1); | |||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 227 | my @anns = (); | |||||||||||||||||||||||||||||||||||||||||
| 207 | # if not recursive behave exactly like get_Annotations() | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 227 | ▶ | if (!$recursive) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | ▶ | my @keys = $keys? @$keys : $self->get_all_annotation_keys(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if(exists($self->{'_annotation'}->{$key})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | push(@anns, | ||||||||||||||||||||||||||||||||||||||||||
| 213 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | $_->tagname($key) if ! $_->tagname(); $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | } @{$self->{'_annotation'}->{$key}}); | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | # if recursive search for keys recursively | ||||||||||||||||||||||||||||||||||||||||||
| 220 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 221 | 227 | my @allkeys = $self->get_all_annotation_keys(); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 227 | foreach my $key (@allkeys) { | |||||||||||||||||||||||||||||||||||||||||
| 223 | 387 | my $keymatch = 0; | |||||||||||||||||||||||||||||||||||||||||
| 224 | 387 | foreach my $searchkey (@$keys) { | |||||||||||||||||||||||||||||||||||||||||
| 225 | 387 | ▶ | if ($key eq $searchkey) { $keymatch = 1;} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 387 | ▶ | if ($keymatch) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 36 | ▶ | if(exists($self->{'_annotation'}->{$key})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 229 | push(@anns, | ||||||||||||||||||||||||||||||||||||||||||
| 230 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 37 | ▶ | $_->tagname($key) if ! $_->tagname(); $_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 36 | } @{$self->{'_annotation'}->{$key}}); | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||
| 235 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 236 | 351 | my @annotations = @{$self->{'_annotation'}->{$key}}; | |||||||||||||||||||||||||||||||||||||||||
| 237 | 351 | foreach (@annotations) { | |||||||||||||||||||||||||||||||||||||||||
| 238 | 371 | ▶ | if ($_->isa("Bio::AnnotationCollectionI")) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 239 | 191 | push (@anns, | |||||||||||||||||||||||||||||||||||||||||
| 240 | $_->get_nested_Annotations('-keys' => $keys, '-recursive' => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 241 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 227 | return @anns; | |||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | =head2 get_all_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | Title : get_all_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 253 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 254 | Function: Similar to get_Annotations, but traverses and flattens nested | ||||||||||||||||||||||||||||||||||||||||||
| 255 | annotation collections. This means that collections in the | ||||||||||||||||||||||||||||||||||||||||||
| 256 | tree will be replaced by their components. | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | Keys will not be passed on to nested collections. I.e., if the | ||||||||||||||||||||||||||||||||||||||||||
| 259 | tag name of a nested collection matches the key, it will be | ||||||||||||||||||||||||||||||||||||||||||
| 260 | flattened in its entirety. | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | Hence, for un-nested annotation collections this will be identical | ||||||||||||||||||||||||||||||||||||||||||
| 263 | to get_Annotations. | ||||||||||||||||||||||||||||||||||||||||||
| 264 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 265 | Returns : an array of L<Bio::AnnotationI> compliant objects | ||||||||||||||||||||||||||||||||||||||||||
| 266 | Args : keys (list of strings) for annotations (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 7 | ▶ | sub get_all_Annotations{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_all_Annotations: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 7 | my ($self,@keys) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | return map { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 7 | ▶ | $_->isa("Bio::AnnotationCollectionI") ? | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 276 | $_->get_all_Annotations() : $_; | ||||||||||||||||||||||||||||||||||||||||||
| 277 | } $self->get_Annotations(@keys); | ||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | =head2 get_num_of_annotations | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||
| 283 | Title : get_num_of_annotations | ||||||||||||||||||||||||||||||||||||||||||
| 284 | Usage : my $count = $collection->get_num_of_annotations() | ||||||||||||||||||||||||||||||||||||||||||
| 285 | Function: Returns the count of all annotations stored in this collection | ||||||||||||||||||||||||||||||||||||||||||
| 286 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 287 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | sub get_num_of_annotations{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_num_of_annotations: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 1 | my $count = 0; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | map { $count += scalar @$_ } values %{$self->{'_annotation'}}; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | return $count; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | =head1 Implementation specific functions - mainly for adding | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | =head2 add_Annotation | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | Title : add_Annotation | ||||||||||||||||||||||||||||||||||||||||||
| 306 | Usage : $self->add_Annotation('reference',$object); | ||||||||||||||||||||||||||||||||||||||||||
| 307 | $self->add_Annotation($object,'Bio::MyInterface::DiseaseI'); | ||||||||||||||||||||||||||||||||||||||||||
| 308 | $self->add_Annotation($object); | ||||||||||||||||||||||||||||||||||||||||||
| 309 | $self->add_Annotation('disease',$object,'Bio::MyInterface::DiseaseI'); | ||||||||||||||||||||||||||||||||||||||||||
| 310 | Function: Adds an annotation for a specific key. | ||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | If the key is omitted, the object to be added must provide a value | ||||||||||||||||||||||||||||||||||||||||||
| 313 | via its tagname(). | ||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | If the archetype is provided, this and future objects added under | ||||||||||||||||||||||||||||||||||||||||||
| 316 | that tag have to comply with the archetype and will be rejected | ||||||||||||||||||||||||||||||||||||||||||
| 317 | otherwise. | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 320 | Args : annotation key ('disease', 'dblink', ...) | ||||||||||||||||||||||||||||||||||||||||||
| 321 | object to store (must be Bio::AnnotationI compliant) | ||||||||||||||||||||||||||||||||||||||||||
| 322 | [optional] object archetype to map future storage of object | ||||||||||||||||||||||||||||||||||||||||||
| 323 | of these types to | ||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||
| 325 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||
| 327 | 5827 | ▶ | sub add_Annotation{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_Annotation: called CC=14 SCAR=28.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 328 | 5827 | my ($self,$key,$object,$archetype) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||
| 330 | # if there's no key we use the tagname() as key | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 5827 | ▶ | if(ref($key) && $key->isa("Bio::AnnotationI") && (!ref($object))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref $key and $key->isa("Bio::AnnotationI") and not ref $object
ref $key and $key->isa("Bio::AnnotationI")
MC/DC33%1/3
ref $key and $key->isa("Bio::AnnotationI") and not ref $object
ref $key
$key->isa("Bio::AnnotationI")
not ref $object
Truth table50%2/4
A and B and not(C)
A= ref $keyB= $key->isa("Bio::AnnotationI")C= not ref $object
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 2095 | ▶ | $archetype = $object if defined($object); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 333 | 2095 | $object = $key; | |||||||||||||||||||||||||||||||||||||||||
| 334 | 2095 | $key = $object->tagname(); | |||||||||||||||||||||||||||||||||||||||||
| 335 | 2095 | ▶ | $key = $key->name() if ref($key); # OntologyTermI | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 336 | 2095 | ▶ | $self->throw("Annotation object must have a tagname if key omitted") | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 337 | unless $key; | ||||||||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||
| 340 | 5827 | ▶ | if( !defined $object ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | $self->throw("Must have at least key and object in add_Annotation"); | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | 5827 | ▶ | if( !ref $object ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | $self->throw("Must add an object. Use Bio::Annotation::{Comment,SimpleValue,OntologyTerm} for simple text additions"); | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 5827 | ▶ | if( !$object->isa("Bio::AnnotationI") ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $self->throw("object must be AnnotationI compliant, otherwise we won't add it!"); | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | # ok, now we are ready! If we don't have an archetype, set it | ||||||||||||||||||||||||||||||||||||||||||
| 353 | # from the type of the object | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | 5827 | ▶ | if( !defined $archetype ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 356 | 5827 | $archetype = ref $object; | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | # check typemap, storing if needed. | ||||||||||||||||||||||||||||||||||||||||||
| 360 | 5827 | my $stored_map = $self->_typemap->type_for_key($key); | |||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||
| 362 | 5827 | ▶ | if( defined $stored_map ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 363 | # check validity, irregardless of archetype. A little cheeky | ||||||||||||||||||||||||||||||||||||||||||
| 364 | # this means isa stuff is executed correctly | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 3659 | ▶ | if( !$self->_typemap()->is_valid($key,$object) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | $self->throw("Object $object was not valid with key $key. ". | |||||||||||||||||||||||||||||||||||||||||
| 368 | "If you were adding new keys in, perhaps you want to make use\n". | ||||||||||||||||||||||||||||||||||||||||||
| 369 | "of the archetype method to allow registration to a more basic type"); | ||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 372 | 2168 | $self->_typemap->_add_type_map($key,$archetype); | |||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | # we are ok to store | ||||||||||||||||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||||||||||||||||
| 377 | 5827 | ▶ | if( !defined $self->{'_annotation'}->{$key} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | 2567 | $self->{'_annotation'}->{$key} = []; | |||||||||||||||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||||||||||||||
| 381 | 5827 | push(@{$self->{'_annotation'}->{$key}},$object); | |||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||
| 383 | 5827 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | =head2 remove_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | Title : remove_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 389 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 390 | Function: Remove the annotations for the specified key from this collection. | ||||||||||||||||||||||||||||||||||||||||||
| 391 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 392 | Returns : an array Bio::AnnotationI compliant objects which were stored | ||||||||||||||||||||||||||||||||||||||||||
| 393 | under the given key(s) | ||||||||||||||||||||||||||||||||||||||||||
| 394 | Args : the key(s) (tag name(s), one or more strings) for which to | ||||||||||||||||||||||||||||||||||||||||||
| 395 | remove annotations (optional; if none given, flushes all | ||||||||||||||||||||||||||||||||||||||||||
| 396 | annotations) | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 21 | ▶ | sub remove_Annotations{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_Annotations: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 21 | my ($self, @keys) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 21 | ▶ | @keys = $self->get_all_annotation_keys() unless @keys; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 21 | my @anns = $self->get_Annotations(@keys); | |||||||||||||||||||||||||||||||||||||||||
| 406 | # flush | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 21 | foreach my $key (@keys) { | |||||||||||||||||||||||||||||||||||||||||
| 408 | 22 | delete $self->{'_annotation'}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | 22 | delete $self->{'_typemap'}->{'_type'}->{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | 21 | return @anns; | |||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | =head2 flatten_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||
| 416 | Title : flatten_Annotations | ||||||||||||||||||||||||||||||||||||||||||
| 417 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 418 | Function: Flattens part or all of the annotations in this collection. | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | This is a convenience method for getting the flattened | ||||||||||||||||||||||||||||||||||||||||||
| 421 | annotation for the given keys, removing the annotation for | ||||||||||||||||||||||||||||||||||||||||||
| 422 | those keys, and adding back the flattened array. | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | This should not change anything for un-nested collections. | ||||||||||||||||||||||||||||||||||||||||||
| 425 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 426 | Returns : an array Bio::AnnotationI compliant objects which were stored | ||||||||||||||||||||||||||||||||||||||||||
| 427 | under the given key(s) | ||||||||||||||||||||||||||||||||||||||||||
| 428 | Args : list of keys (strings) the annotation for which to flatten, | ||||||||||||||||||||||||||||||||||||||||||
| 429 | defaults to all keys if not given | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 1 | ▶ | sub flatten_Annotations{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flatten_Annotations: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 1 | my ($self,@keys) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | my @anns = $self->get_all_Annotations(@keys); | |||||||||||||||||||||||||||||||||||||||||
| 438 | 1 | my @origanns = $self->remove_Annotations(@keys); | |||||||||||||||||||||||||||||||||||||||||
| 439 | 1 | foreach (@anns) { | |||||||||||||||||||||||||||||||||||||||||
| 440 | 7 | $self->add_Annotation($_); | |||||||||||||||||||||||||||||||||||||||||
| 441 | } | ||||||||||||||||||||||||||||||||||||||||||
| 442 | 1 | return @origanns; | |||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | =head1 Bio::AnnotationI methods implementations | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | This is to allow nested annotation: you can use a collection as an | ||||||||||||||||||||||||||||||||||||||||||
| 448 | annotation object for an annotation collection. | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||||||||||||
| 452 | =head2 as_text | ||||||||||||||||||||||||||||||||||||||||||
| 453 | |||||||||||||||||||||||||||||||||||||||||||
| 454 | Title : as_text | ||||||||||||||||||||||||||||||||||||||||||
| 455 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 456 | Function: See L<Bio::AnnotationI> | ||||||||||||||||||||||||||||||||||||||||||
| 457 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 458 | Returns : a string | ||||||||||||||||||||||||||||||||||||||||||
| 459 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | sub as_text{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
as_text: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | my $txt = "Collection consisting of "; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 0 | my @texts = (); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | foreach my $ann ($self->get_Annotations()) { | |||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | push(@texts, $ann->as_text()); | |||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | if(@texts) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | $txt .= join(", ", map { '['.$_.']'; } @texts); | |||||||||||||||||||||||||||||||||||||||||
| 474 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | $txt .= "no elements"; | |||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | return $txt; | |||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | =head2 display_text | ||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | Title : display_text | ||||||||||||||||||||||||||||||||||||||||||
| 483 | Usage : my $str = $ann->display_text(); | ||||||||||||||||||||||||||||||||||||||||||
| 484 | Function: returns a string. Unlike as_text(), this method returns a string | ||||||||||||||||||||||||||||||||||||||||||
| 485 | formatted as would be expected for te specific implementation. | ||||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | One can pass a callback as an argument which allows custom text | ||||||||||||||||||||||||||||||||||||||||||
| 488 | generation; the callback is passed the current instance and any text | ||||||||||||||||||||||||||||||||||||||||||
| 489 | returned | ||||||||||||||||||||||||||||||||||||||||||
| 490 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 491 | Returns : a string | ||||||||||||||||||||||||||||||||||||||||||
| 492 | Args : [optional] callback | ||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | { | ||||||||||||||||||||||||||||||||||||||||||
| 497 | # this just calls the default display_text output for | ||||||||||||||||||||||||||||||||||||||||||
| 498 | # any AnnotationI | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | my $DEFAULT_CB = sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $obj = shift; | |||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | my $txt; | |||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | foreach my $ann ($obj->get_Annotations()) { | |||||||||||||||||||||||||||||||||||||||||
| 503 | 0 | $txt .= $ann->display_text()."\n"; | |||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | return $txt; | |||||||||||||||||||||||||||||||||||||||||
| 506 | 314 | }; | |||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | ▶ | sub display_text { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
display_text: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | my ($self, $cb) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | ▶ | $cb ||= $DEFAULT_CB; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$cb ||= $DEFAULT_CB
MC/DC0%0/2
$cb ||= $DEFAULT_CB
$cb
$DEFAULT_CB
Truth table0%0/3
A ||= B
A= $cbB= $DEFAULT_CB
| |||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | ▶ | $self->throw("") if ref $cb ne 'CODE'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | return $cb->($self); | |||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||
| 514 | } | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | =head2 hash_tree | ||||||||||||||||||||||||||||||||||||||||||
| 518 | |||||||||||||||||||||||||||||||||||||||||||
| 519 | Title : hash_tree | ||||||||||||||||||||||||||||||||||||||||||
| 520 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 521 | Function: See L<Bio::AnnotationI> | ||||||||||||||||||||||||||||||||||||||||||
| 522 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 523 | Returns : a hash reference | ||||||||||||||||||||||||||||||||||||||||||
| 524 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||
| 527 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | 314 | ▶ | sub hash_tree{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hash_tree: not called CC=2 SCAR=14.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 530 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 531 | 0 | my $tree = {}; | |||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||
| 533 | 0 | foreach my $key ($self->get_all_annotation_keys()) { | |||||||||||||||||||||||||||||||||||||||||
| 534 | # all contained objects will support hash_tree() | ||||||||||||||||||||||||||||||||||||||||||
| 535 | # (they are AnnotationIs) | ||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | $tree->{$key} = [$self->get_Annotations($key)]; | |||||||||||||||||||||||||||||||||||||||||
| 537 | } | ||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | return $tree; | |||||||||||||||||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||
| 541 | =head2 tagname | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | Title : tagname | ||||||||||||||||||||||||||||||||||||||||||
| 544 | Usage : $obj->tagname($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 545 | Function: Get/set the tagname for this annotation value. | ||||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | Setting this is optional. If set, it obviates the need to | ||||||||||||||||||||||||||||||||||||||||||
| 548 | provide a tag to Bio::AnnotationCollectionI when adding | ||||||||||||||||||||||||||||||||||||||||||
| 549 | this object. When obtaining an AnnotationI object from the | ||||||||||||||||||||||||||||||||||||||||||
| 550 | collection, the collection will set the value to the tag | ||||||||||||||||||||||||||||||||||||||||||
| 551 | under which it was stored unless the object has a tag | ||||||||||||||||||||||||||||||||||||||||||
| 552 | stored already. | ||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 555 | Returns : value of tagname (a scalar) | ||||||||||||||||||||||||||||||||||||||||||
| 556 | Args : new value (a scalar, optional) | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | 1057 | ▶ | sub tagname{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tagname: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 562 | 1057 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 1057 | ▶ | return $self->{'tagname'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 565 | 757 | return $self->{'tagname'}; | |||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||||||||||||
| 569 | =head1 Backward compatible functions | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | Functions put in for backward compatibility with old | ||||||||||||||||||||||||||||||||||||||||||
| 572 | Bio::Annotation.pm stuff | ||||||||||||||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||||||||||||||
| 574 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | =head2 description | ||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||
| 578 | Title : description | ||||||||||||||||||||||||||||||||||||||||||
| 579 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 580 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 581 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 582 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 583 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||
| 588 | 0 | ▶ | sub description{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | Carp::carp("old style annotation called on new Annotation::Collection object"); | |||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | my $val = Bio::Annotation::SimpleValue->new(); | |||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $val->value($value); | |||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | $self->add_Annotation('description',$val); | |||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | 0 | my ($desc) = $self->get_Annotations('description'); | |||||||||||||||||||||||||||||||||||||||||
| 600 | |||||||||||||||||||||||||||||||||||||||||||
| 601 | # If no description tag exists, do not attempt to call value on undef: | ||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | ▶ | return $desc ? $desc->value : undef; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | =head2 add_gene_name | ||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||
| 608 | Title : add_gene_name | ||||||||||||||||||||||||||||||||||||||||||
| 609 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 610 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 611 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 612 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 613 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | sub add_gene_name{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_gene_name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | Carp::carp("Old style add_gene_name called on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | my $val = Bio::Annotation::SimpleValue->new(); | |||||||||||||||||||||||||||||||||||||||||
| 624 | 0 | $val->value($value); | |||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | $self->add_Annotation('gene_name',$val); | |||||||||||||||||||||||||||||||||||||||||
| 626 | } | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | =head2 each_gene_name | ||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||
| 630 | Title : each_gene_name | ||||||||||||||||||||||||||||||||||||||||||
| 631 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 632 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 633 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 634 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 635 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||
| 640 | 0 | ▶ | sub each_gene_name{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each_gene_name: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 642 | |||||||||||||||||||||||||||||||||||||||||||
| 643 | 0 | Carp::carp("Old style each_gene_name called on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | my @out; | |||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | my @gene = $self->get_Annotations('gene_name'); | |||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | foreach my $g ( @gene ) { | |||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | push(@out,$g->value); | |||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | return @out; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | =head2 add_Reference | ||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | Title : add_Reference | ||||||||||||||||||||||||||||||||||||||||||
| 658 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 659 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 660 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 661 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 662 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | sub add_Reference{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_Reference: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | my ($self, @values) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | Carp::carp("add_Reference (old style Annotation) on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | # Allow multiple (or no) references to be passed, as per old method | ||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | foreach my $value (@values) { | |||||||||||||||||||||||||||||||||||||||||
| 674 | 0 | $self->add_Annotation('reference',$value); | |||||||||||||||||||||||||||||||||||||||||
| 675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 676 | } | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | =head2 each_Reference | ||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||
| 680 | Title : each_Reference | ||||||||||||||||||||||||||||||||||||||||||
| 681 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 682 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 683 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 684 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 685 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||
| 688 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||
| 690 | 0 | ▶ | sub each_Reference{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each_Reference: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | Carp::carp("each_Reference (old style Annotation) on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | return $self->get_Annotations('reference'); | |||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | =head2 add_Comment | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | Title : add_Comment | ||||||||||||||||||||||||||||||||||||||||||
| 702 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 703 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 704 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 705 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 706 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||||||||||||||||
| 709 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | sub add_Comment{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_Comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | Carp::carp("add_Comment (old style Annotation) on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | $self->add_Annotation('comment',$value); | |||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | =head2 each_Comment | ||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | Title : each_Comment | ||||||||||||||||||||||||||||||||||||||||||
| 723 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 724 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 725 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 726 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 727 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | sub each_Comment{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each_Comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | Carp::carp("each_Comment (old style Annotation) on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | return $self->get_Annotations('comment'); | |||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | =head2 add_DBLink | ||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | Title : add_DBLink | ||||||||||||||||||||||||||||||||||||||||||
| 745 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 746 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 747 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 748 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 749 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||
| 752 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | ▶ | sub add_DBLink{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_DBLink: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | Carp::carp("add_DBLink (old style Annotation) on new style Annotation::Collection"); | |||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $self->add_Annotation('dblink',$value); | |||||||||||||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | =head2 each_DBLink | ||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||
| 765 | Title : each_DBLink | ||||||||||||||||||||||||||||||||||||||||||
| 766 | Usage : | ||||||||||||||||||||||||||||||||||||||||||
| 767 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 768 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 769 | Returns : | ||||||||||||||||||||||||||||||||||||||||||
| 770 | Args : | ||||||||||||||||||||||||||||||||||||||||||
| 771 | |||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | sub each_DBLink{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each_DBLink: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||||||||||||
| 778 | 0 | Carp::carp("each_DBLink (old style Annotation) on new style Annotation::Collection - use get_Annotations('dblink')"); | |||||||||||||||||||||||||||||||||||||||||
| 779 | |||||||||||||||||||||||||||||||||||||||||||
| 780 | 0 | return $self->get_Annotations('dblink'); | |||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||||||||||||||
| 785 | =head1 Implementation management functions | ||||||||||||||||||||||||||||||||||||||||||
| 786 | |||||||||||||||||||||||||||||||||||||||||||
| 787 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | =head2 _typemap | ||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||
| 791 | Title : _typemap | ||||||||||||||||||||||||||||||||||||||||||
| 792 | Usage : $obj->_typemap($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 793 | Function: | ||||||||||||||||||||||||||||||||||||||||||
| 794 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 795 | Returns : value of _typemap | ||||||||||||||||||||||||||||||||||||||||||
| 796 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 13839 | ▶ | sub _typemap{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_typemap: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 802 | 13839 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 803 | 13839 | ▶ | if( defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | 2185 | $self->{'_typemap'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 805 | } | ||||||||||||||||||||||||||||||||||||||||||
| 806 | 13839 | return $self->{'_typemap'}; | |||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | } | ||||||||||||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||||||||||||
| 810 | 314 | 1; | |||||||||||||||||||||||||||||||||||||||||