EnsEMBL/IdMapping/ScoredMappingMatrix.pm untested

filter: Statementstmt 0.0% 0 / 207 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 28 Subroutinesub 0.0% 0 / 34 Podpod 0.0% 0 / 26 totaltotal 0.0% 0 / 325 CC 16 SCAR 20.7
CC
16
Cov
0%
merge
30.0
get_min_max_scores
20.0
sub_matrix
12.0
CRAP 7.9
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::IdMapping::ScoredMappingMatrix - object holding a list of scored
34 Entries
35  
36 =head1 SYNOPSIS
37  
38 # create a new ScoredMappingMatrix
39 my $gene_scores = Bio::EnsEMBL::IdMapping::ScoredMappingMatrix->new(
40 -DUMP_PATH => $dump_path,
41 -CACHE_FILE => 'gene_scores.ser',
42 );
43  
44 # add entries
45 my $gene_scores->add_Entry($entry1);
46  
47 # serialise to file
48 $gene_scores->write_to_file;
49  
50 # later, read these gene_scores from file
51 my $gene_scores1 = Bio::EnsEMBL::IdMapping::ScoredMappingMatrix->new(
52 -DUMP_PATH => $dump_path,
53 -CACHE_FILE => 'gene_gene_scores.ser',
54 );
55 $gene_scores1->read_from_file;
56  
57 =head1 DESCRIPTION
58  
59 This object represents a collection of scores between source and target
60 objects. It holds a list of Bio::EnsEMBL::IdMapping::Entry objects and
61 has methods to retrieve indiviual or all Entries, as well as derived
62 data like number of unique sources or targets, or various counts and
63 averages.
64  
65 It is the main collection for dealing with scored relationships in the
66 stable Id mapping application.
67  
68 =head1 METHODS
69  
70 new
71 flush
72 sub_matrix
73 add_Entry
74 update_Entry
75 remove_Entry
76 add_score
77 set_score
78 get_Entry
79 get_score
80 get_targets_for_source
81 get_Entries_for_source
82 get_sources_for_target
83 get_Entries_for_target
84 get_all_Entries
85 get_all_sources
86 get_all_targets
87 get_entry_count
88 size
89 get_source_count
90 get_target_count
91 get_min_max_scores
92 get_average_score
93 merge
94 log
95 to_string
96  
97 =cut
98  
99 package Bio::EnsEMBL::IdMapping::ScoredMappingMatrix;
100 $Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::VERSION = '114.0.0_50'; # TRIAL
101 $Bio::EnsEMBL::IdMapping::ScoredMappingMatrix::VERSION = '114.0.050';
102 use strict;
103 use warnings;
104 no warnings 'uninitialized';
105  
106 use Bio::EnsEMBL::IdMapping::Serialisable;
107 our @ISA = qw(Bio::EnsEMBL::IdMapping::Serialisable);
108  
109 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
110 use Bio::EnsEMBL::Utils::Exception qw(throw warning);
111 use Bio::EnsEMBL::Utils::ScriptUtils qw(path_append);
112 use Bio::EnsEMBL::IdMapping::Entry;
113  
114  
115 =head2 new
116  
117 Arg[1-N] : see superclass
118 Example : my $gene_scores = Bio::EnsEMBL::IdMapping::ScoredMappingMatrix->new(
119 -DUMP_PATH => $dump_path,
120 -CACHE_FILE => 'gene_scores.ser',
121 );
122 Description : Constructor.
123 Return type : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix
124 Exceptions : none
125 Caller : general
126 Status : At Risk
127 : under development
128  
129 =cut
130  
131 sub new {
132 my $caller = shift;
133 my $class = ref($caller) || $caller;
134 my $self = $class->SUPER::new(@_);
135  
136 # initialise internal datastructure
137 unless ($self->loaded) {
138 $self->{'cache'}->{'matrix'} = {};
139 $self->{'cache'}->{'source_list'} = {};
140 $self->{'cache'}->{'target_list'} = {};
141 }
142  
143 return $self;
144 }
145  
146  
147 =head2 flush
148  
149 Example : $gene_scores->flush;
150 Description : Flushes (empties) the scoring matrix.
151 Return type : none
152 Exceptions : none
153 Caller : general
154 Status : At Risk
155 : under development
156  
157 =cut
158  
159 sub flush {
160 my $self = shift;
161  
162 # reset caches
163 $self->{'cache'}->{'matrix'} = {};
164 $self->{'cache'}->{'source_list'} = {};
165 $self->{'cache'}->{'target_list'} = {};
166 }
167  
168  
169 =head2 sub_matrix
170  
171 Arg[1] : Int $start - start index (inclusive)
172 Arg[2] : Int $end - end index (inclusive)
173 Example : # get the first 1000 elements in the matrix
174 my $sub_matrix = $gene_scores->sub_matrix(1, 1000);
175 Description : Returns a sub-matrix of the ScoredMappingMatrix. The arguments
176 ($start and $end) specify the position of the first and last
177 element to return (inclusive, counting starts with element 1,
178 not 0)
179 Return type : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix
180 Exceptions : none
181 Caller : general
182 Status : At Risk
183 : under development
184  
185 =cut
186  
187 sub sub_matrix {
188 my $self = shift;
189 my $start = shift;
190 my $end = shift;
191  
192 # default to returning the full matrix if no start/end provided
193 $start ||= 1;
194 $end ||= $self->size;
195  
196 my $sub_matrix = Bio::EnsEMBL::IdMapping::ScoredMappingMatrix->new(
197 -DUMP_PATH => $self->dump_path,
198 -CACHE_FILE => $self->cache_file_name,
199 );
200 my $i = 0;
201  
202 foreach my $key (sort keys %{ $self->{'cache'}->{'matrix'} }) {
203 $i++;
204 next if ($i < $start);
205 last if ($i > $end);
206  
207 my ($source, $target) = split(/:/, $key);
208 $sub_matrix->add_score($source, $target,
209 $self->{'cache'}->{'matrix'}->{$key});
210 }
211  
212 return $sub_matrix;
213 }
214  
215  
216 =head2 add_Entry
217  
218 Arg[1] : Bio::EnsEMBL::IdMapping::Entry $entry - Entry to add
219 Example : $gene_scores->add_Entry($entry);
220 Description : Adds an Entry to the scoring matrix.
221 Return type : Float - the Entry's score
222 Exceptions : thrown on wrong or missing argument
223 Caller : general
224 Status : At Risk
225 : under development
226  
227 =cut
228  
229 sub add_Entry {
230 my $self = shift;
231 my $entry = shift;
232  
233 unless ($entry and $entry->isa('Bio::EnsEMBL::IdMapping::Entry')) {
234 throw("Need a Bio::EnsEMBL::IdMapping::Entry");
235 }
236  
237 return $self->add_score($entry->source, $entry->target, $entry->score);
238 }
239  
240  
241 =head2 update_Entry
242  
243 Arg[1] : Bio::EnsEMBL::IdMapping::Entry $entry - Entry to update
244 Example : $gene_scores->update_Entry($entry);
245 Description : Updates an Entry (or rather its score) in the scoring matrix.
246 Actually delegates to add_Entry(), only there as an intuitively
247 named wrapper.
248 Return type : Float - the Entry's score
249 Exceptions : thrown on wrong or missing argument
250 Caller : general
251 Status : At Risk
252 : under development
253  
254 =cut
255  
256 sub update_Entry {
257 return $_[0]->add_Entry($_[1]);
258 }
259  
260  
261 #
262 # not needed in the current application, so not implemented
263 #
264 sub remove_Entry {
265 warning('Method ScoredMappingMatrix->remove_Entry not implemented (yet).');
266 }
267  
268  
269 =head2 add_score
270  
271 Arg[1] : Int $source - source object's internal Id ("dbID")
272 Arg[2] : Int $target - target object's internal Id ("dbID")
273 Arg[3] : Float $score - score for source/target pair
274 Example : $gene_scores->add_score(1234, 5678, 0.997);
275 Description : Adds a score for a source/target pair to the scoring matrix.
276 This is a low-level version of add_Entry().
277 Return type : Float - the score
278 Exceptions : none
279 Caller : general
280 Status : At Risk
281 : under development
282  
283 =cut
284  
285 sub add_score {
286 my $self = shift;
287 my $source = shift;
288 my $target = shift;
289 my $score = shift;
290
291 # make sure you don't put duplicates on the source and target lists
292 unless (exists($self->{'cache'}->{'matrix'}->{"$source:$target"})) {
293 push @{ $self->{'cache'}->{'source_list'}->{$source} }, $target;
294 push @{ $self->{'cache'}->{'target_list'}->{$target} }, $source;
295 }
296  
297 $self->{'cache'}->{'matrix'}->{"$source:$target"} = $score;
298 }
299  
300  
301 =head2 set_score
302  
303 Arg[1] : Int $source - source object's internal Id ("dbID")
304 Arg[2] : Int $target - target object's internal Id ("dbID")
305 Arg[3] : Float $score - score for source/target pair
306 Example : $gene_scores->set_score(1234, 5678, 0.997);
307 Description : Sets the score for a source/target pair in the scoring matrix.
308 This method is similar to add_score, but assumes that the Entry
309 has been added before, so won't update the sources and target
310 lists.
311 Return type : Float - the score
312 Exceptions : none
313 Caller : general
314 Status : At Risk
315 : under development
316  
317 =cut
318  
319 sub set_score {
320 my $self = shift;
321 my $source = shift;
322 my $target = shift;
323 my $score = shift;
324
325 $self->{'cache'}->{'matrix'}->{"$source:$target"} = $score;
326 }
327  
328  
329 =head2 get_Entry
330  
331 Arg[1] : Int $source - source object's internal Id ("dbID")
332 Arg[2] : Int $target - target object's internal Id ("dbID")
333 Example : my $entry = $gene_scores->get_Entry($source_gene->id,
334 $target_gene->id);
335 Description : Gets an Entry from the scoring matrix for a given source and
336 target object.
337 Return type : Bio::EnsEMBL::IdMapping::Entry or undef
338 Exceptions : none
339 Caller : general
340 Status : At Risk
341 : under development
342  
343 =cut
344  
345 sub get_Entry {
346 my $self = shift;
347 my $source = shift;
348 my $target = shift;
349  
350 if (exists($self->{'cache'}->{'matrix'}->{"$source:$target"})) {
351 return Bio::EnsEMBL::IdMapping::Entry->new_fast(
352 [$source, $target, $self->{'cache'}->{'matrix'}->{"$source:$target"}]
353 );
354 } else {
355 return undef;
356 }
357 }
358  
359  
360 =head2 get_score
361  
362 Arg[1] : Int $source - source object's internal Id ("dbID")
363 Arg[2] : Int $target - target object's internal Id ("dbID")
364 Example : my $score = $gene_scores->get_score($source_gene->id,
365 $target_gene->id);
366 Description : Gets the score from the scoring matrix for a given source and
367 target object.
368 Return type : Float or undef
369 Exceptions : none
370 Caller : general
371 Status : At Risk
372 : under development
373  
374 =cut
375  
376 sub get_score {
377 my $self = shift;
378 my $source = shift;
379 my $target = shift;
380  
381  
382 if (exists($self->{'cache'}->{'matrix'}->{"$source:$target"})) {
383 return $self->{'cache'}->{'matrix'}->{"$source:$target"};
384 } else {
385 return undef;
386 }
387 }
388  
389  
390 =head2 get_targets_for_source
391  
392 Arg[1] : Int $source - source object's internal Id ("dbID")
393 Example : my @targets = @{ $gene_scores->get_targets_for_source(1234) };
394 Description : Returns a list of all targets which have a score against a given
395 source object.
396 Return type : Arrayref of Int (target objects' internal Ids)
397 Exceptions : none
398 Caller : general
399 Status : At Risk
400 : under development
401  
402 =cut
403  
404 sub get_targets_for_source {
405 my $self = shift;
406 my $source = shift;
407  
408 return $self->{'cache'}->{'source_list'}->{$source} || [];
409 }
410  
411  
412 =head2 get_Entries_for_source
413  
414 Arg[1] : Int $source - source object's internal Id ("dbID")
415 Example : my @entries = @{ $gene_scores->get_Entries_for_source(1234) };
416 Description : Returns a list of all Entries in the scoring matrix for a given
417 source object.
418 Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
419 Exceptions : none
420 Caller : general
421 Status : At Risk
422 : under development
423  
424 =cut
425  
426 sub get_Entries_for_source {
427 my $self = shift;
428 my $source = shift;
429  
430 return [ map { $self->get_Entry($source, $_) }
431 @{ $self->{'cache'}->{'source_list'}->{$source} || [] } ];
432 }
433  
434  
435 =head2 get_sources_for_target
436  
437 Arg[1] : Int $target - target object's internal Id ("dbID")
438 Example : my @sources = @{ $gene_scores->get_sources_for_target(5678) };
439 Description : Returns a list of all sources which have a score against a given
440 target object.
441 Return type : Arrayref of Int (source objects' internal Ids)
442 Exceptions : none
443 Caller : general
444 Status : At Risk
445 : under development
446  
447 =cut
448  
449 sub get_sources_for_target {
450 my $self = shift;
451 my $target = shift;
452  
453 return $self->{'cache'}->{'target_list'}->{$target} || [];
454 }
455  
456  
457 =head2 get_Entries_for_target
458  
459 Arg[1] : Int $target - target object's internal Id ("dbID")
460 Example : my @entries = @{ $gene_scores->get_Entries_for_target(5678) };
461 Description : Returns a list of all Entries in the scoring matrix for a given
462 target object.
463 Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
464 Exceptions : none
465 Caller : general
466 Status : At Risk
467 : under development
468  
469 =cut
470  
471 sub get_Entries_for_target {
472 my $self = shift;
473 my $target = shift;
474  
475 return [ map { $self->get_Entry($_, $target) }
476 @{ $self->{'cache'}->{'target_list'}->{$target} || [] } ];
477 }
478  
479  
480 =head2 get_all_Entries
481  
482 Example : foreach my $entry (@{ $gene_scores->get_all_Entries }) {
483 # do something with the entry
484 }
485 Description : Returns a list of all Entries in the scoring matrix.
486 Return type : Arrayref of Bio::EnsEMBL::IdMapping::Entry objects
487 Exceptions : none
488 Caller : general
489 Status : At Risk
490 : under development
491  
492 =cut
493  
494 sub get_all_Entries {
495 my $self = shift;
496  
497 my @result = ();
498
499 foreach my $key (keys %{ $self->{'cache'}->{'matrix'} }) {
500 my ($source, $target) = split(/:/, $key);
501 push @result, Bio::EnsEMBL::IdMapping::Entry->new_fast(
502 [$source, $target, $self->{'cache'}->{'matrix'}->{$key}]
503 );
504 }
505  
506 return \@result;
507 }
508  
509  
510 =head2 get_all_sources
511  
512 Example : my @sources = @{ $gene_scores->get_all_sources };
513 Description : Returns a list of all sources in the scoring matrix.
514 Return type : Arrayref of Int (source objects' internal Ids)
515 Exceptions : none
516 Caller : general
517 Status : At Risk
518 : under development
519  
520 =cut
521  
522 sub get_all_sources {
523 my $self = shift;
524 return [keys %{ $self->{'cache'}->{'source_list'} }];
525 }
526  
527  
528 =head2 get_all_targets
529  
530 Example : my @targets = @{ $gene_scores->get_all_targets };
531 Description : Returns a list of all targets in the scoring matrix.
532 Return type : Arrayref of Int (target objects' internal Ids)
533 Exceptions : none
534 Caller : general
535 Status : At Risk
536 : under development
537  
538 =cut
539  
540 sub get_all_targets {
541 my $self = shift;
542 return [keys %{ $self->{'cache'}->{'target_list'} }];
543 }
544  
545  
546 =head2 get_entry_count
547  
548 Example : my $num_entries = $gene_scores->get_entry_count;
549 Description : Returns the number of Entries in the scoring matrix.
550 Return type : Int
551 Exceptions : none
552 Caller : general
553 Status : At Risk
554 : under development
555  
556 =cut
557  
558 sub get_entry_count {
559 my $self = shift;
560 return scalar(keys %{ $self->{'cache'}->{'matrix'} });
561 }
562  
563  
564 =head2 size
565  
566 Example : my $size = $gene_scores->size;
567 Description : Returns the size of the scoring matrix. Same value as returned
568 by get_entry_count().
569 Return type : Int
570 Exceptions : none
571 Caller : general
572 Status : At Risk
573 : under development
574  
575 =cut
576  
577 sub size {
578 return $_[0]->get_entry_count;
579 }
580  
581  
582 =head2 get_source_count
583  
584 Example : my $num_sources = $gene_scores->get_source_count;
585 Description : Returns the number of distinct sources in the scoring matrix.
586 Return type : Int
587 Exceptions : none
588 Caller : general
589 Status : At Risk
590 : under development
591  
592 =cut
593  
594 sub get_source_count {
595 my $self = shift;
596 return scalar(keys %{ $self->{'cache'}->{'source_list'} });
597 }
598  
599  
600 =head2 get_target_count
601  
602 Example : my $num_targets = $gene_scores->get_target_count;
603 Description : Returns the number of distinct targets in the scoring matrix.
604 Return type : Int
605 Exceptions : none
606 Caller : general
607 Status : At Risk
608 : under development
609  
610 =cut
611  
612 sub get_target_count {
613 my $self = shift;
614 return scalar(keys %{ $self->{'cache'}->{'target_list'} });
615 }
616  
617  
618 =head2 get_min_max_scores
619  
620 Example : my ($min_score, $max_score) =
621 @{ $gene_scores->get_min_max_scores };
622 Description : Returns the mininum and maximum score in the scoring matrix.
623 Return type : Arrayref of Float [min_score, max_score]
624 Exceptions : none
625 Caller : general
626 Status : At Risk
627 : under development
628  
629 =cut
630  
631 sub get_min_max_scores {
632 my $self = shift;
633  
634 my @keys = keys %{ $self->{'cache'}->{'matrix'} };
635  
636 return [undef, undef] unless (@keys);
637  
638 # initialise; this should make loop quicker
639 my $min = $self->{'cache'}->{'matrix'}->{$keys[0]};
640 my $max = $self->{'cache'}->{'matrix'}->{$keys[0]};
641
642 foreach my $key (@keys) {
643 $min = $self->{'cache'}->{'matrix'}->{$key} if ($min > $self->{'cache'}->{'matrix'}->{$key});
644 $max = $self->{'cache'}->{'matrix'}->{$key} if ($max < $self->{'cache'}->{'matrix'}->{$key});
645 }
646  
647 return [$min, $max];
648 }
649  
650  
651 =head2 get_average_score
652  
653 Example : my $avg_score = $gene_scores->get_average_score;
654 Description : Returns the average (mean) score in the matrix.
655 Return type : Float
656 Exceptions : none
657 Caller : general
658 Status : At Risk
659 : under development
660  
661 =cut
662  
663 sub get_average_score {
664 my $self = shift;
665  
666 my @keys = keys %{ $self->{'cache'}->{'matrix'} };
667  
668 return undef unless (@keys);
669  
670 my $total = 0;
671
672 foreach my $key (@keys) {
673 $total += $self->{'cache'}->{'matrix'}->{$key};
674 }
675  
676 return $total/scalar(@keys);
677 }
678  
679  
680 =head2 merge
681  
682 Arg[1] : Bio::EnsEMBL::IdMapping::ScoredMappingMatrix $matrix - another
683 matrix to merge with
684 Example : my $update_count = $gene_scores->merge($more_gene_scores);
685 Description : Merges two scoring matrices. If there's an Entry for a
686 source/target pair in both matrices, the higher score will be
687 retained.
688 Return type : Int - number of Entries added or updated
689 Exceptions : thrown on wrong or missing argument
690 Caller : general
691 Status : At Risk
692 : under development
693  
694 =cut
695  
696 sub merge {
697 my $self = shift;
698 my $matrix = shift;
699  
700 unless ($matrix
701 and $matrix->isa('Bio::EnsEMBL::IdMapping::ScoredMappingMatrix') )
702 {
703 throw(
704 'You must provide a Bio::EnsEMBL::IdMapping::ScoredMappingMatrix'
705 );
706 }
707  
708 my $c = 0;
709  
710 # merge the matrices
711 foreach my $key ( keys %{ $matrix->{'cache'}->{'matrix'} } ) {
712 if ( !defined( $self->{'cache'}->{'matrix'}->{$key} )
713 or ( $self->{'cache'}->{'matrix'}->{$key} <
714 $matrix->{'cache'}->{'matrix'}->{$key} ) )
715 {
716 $self->{'cache'}->{'matrix'}->{$key} =
717 $matrix->{'cache'}->{'matrix'}->{$key};
718 $c++;
719 }
720 }
721  
722 # merge sources and target lists
723 foreach my $key ( keys %{ $matrix->{'cache'}->{'source_list'} } ) {
724 if ( defined( $self->{'cache'}->{'source_list'}->{$key} ) ) {
725 # need to merge lists
726 my %unique =
727 map { $_ => 1 } @{ $self->get_targets_for_source($key) };
728 map { $unique{$_} = 1 }
729 @{ $matrix->get_targets_for_source($key) };
730 $self->{'cache'}->{'source_list'}->{$key} = [ keys %unique ];
731 } else {
732 # no merging needed
733 $self->{'cache'}->{'source_list'}->{$key} =
734 $matrix->{'cache'}->{'source_list'}->{$key};
735 }
736 }
737  
738 foreach my $key ( keys %{ $matrix->{'cache'}->{'target_list'} } ) {
739 if ( defined( $self->{'cache'}->{'target_list'}->{$key} ) ) {
740 # need to merge lists
741 my %unique =
742 map { $_ => 1 } @{ $self->get_sources_for_target($key) };
743 map { $unique{$_} = 1 }
744 @{ $matrix->get_sources_for_target($key) };
745 $self->{'cache'}->{'target_list'}->{$key} = [ keys %unique ];
746 } else {
747 # no merging needed
748 $self->{'cache'}->{'target_list'}->{$key} =
749 $matrix->{'cache'}->{'target_list'}->{$key};
750 }
751 }
752  
753 return $c;
754 } ## end sub merge
755  
756  
757 =head2 log
758  
759 Arg[1] : String $type - object type (e.g. 'gene')
760 Arg[2] : String $dump_path - path for writing output
761 Example : $gene_scores->log('gene', $conf->param('basedir'));
762 Description : Logs all Entries in the scoring matrix to a file. Used for
763 debugging.
764 Return type : none
765 Exceptions : thrown on I/0 error
766 Caller : general
767 Status : At Risk
768 : under development
769  
770 =cut
771  
772 sub log {
773 my $self = shift;
774 my $type = shift;
775 my $dump_path = shift;
776
777 my $debug_path = path_append($dump_path, 'debug');
778 my $logfile = "$debug_path/${type}_scores.txt";
779
780 open(my $fh, '>', $logfile) or
781 throw("Unable to open $logfile for writing: $!");
782  
783 foreach my $entry (@{ $self->get_all_Entries }) {
784 print $fh ($entry->to_string."\n");
785 }
786  
787 close($fh);
788 }
789  
790  
791 =head2 to_string
792  
793 Example : print LOG $gene_scores->to_string, "\n";
794 Description : Returns a string representation of the scoring matrix. This is
795 simply a multi-line string, where each line is a stringified
796 Entry.
797 Useful for debugging and logging.
798 Return type : String
799 Exceptions : none
800 Caller : general
801 Status : At Risk
802 : under development
803  
804 =cut
805  
806 sub to_string {
807 my $self = shift;
808
809 my $string = '';
810
811 foreach my $entry (@{ $self->get_all_Entries }) {
812 $string .= $entry->to_string."\n";
813 }
814  
815 return $string;
816 }
817  
818  
819 1;
820