Genetics/Cluster.pm untested

filter: Statementstmt 0.0% 0 / 36 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 51 CC 3 SCAR 17.5
CC
3
Cov
0%
printXML
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 5.8
1 # GenPerl module
2 #
3  
4 # POD documentation - main docs before the code
5  
6 =head1 NAME
7  
8 Genetics::Cluster
9  
10 =head1 SYNOPSIS
11  
12 $cluster = new Genetics::Cluster(name => 'All Subjects',
13 importID => 271,
14 dateCreated => $today,
15 clusterType => "Subject",
16 comment => "All Subjects imported from DMs Study JX",
17 Keywords => [ {name => "Test Data",
18 dataType => "Boolean",
19 value => 1},
20 ],
21 Contents=> [ {name => "JXPed1-1", importID => 12},
22 {name => "JXPed1-2", importID => 32},
23 {name => "JXPed1-3", importID => 22},
24 {name => "JXPed2-1", importID => 42},
25 {name => "JXPed2-2", importID => 43},
26 {name => "JXPed2-3", importID => 44},
27 ],
28 ) ;
29  
30 See the GenPerl Tutorial for more information.
31  
32 =head1 DESCRIPTION
33  
34 A Perl class encapsulating data associated with GNOM Cluster objects.
35 Cluster objects are groupings, by reference, of GNOM scientific objects.
36  
37 =head1 LICENSE
38  
39 This program is free software; you can redistribute it and/or modify
40 it under the terms of the GNU General Public License as published by
41 the Free Software Foundation; either version 2 of the License, or
42 (at your option) any later version.
43  
44 This program is distributed in the hope that it will be useful,
45 but WITHOUT ANY WARRANTY; without even the implied warranty of
46 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 GNU General Public License for more details.
48  
49 You should have received a copy of the GNU General Public License
50 along with this program; if not, write to the Free Software
51 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
52  
53 =head1 FEEDBACK
54  
55 Currently, all feedback should be sent directly to the author.
56  
57 =head1 AUTHOR - Steve Mathias
58  
59 Email: mathias@genomica.com
60  
61 Phone: (720) 565-4029
62  
63 Address: Genomica Corporation
64 1745 38th Street
65 Boulder, CO 80301
66  
67 =head1 DETAILS
68  
69 The rest of the documentation describes each of the object variables and
70 methods. The names of internal variables and methods are preceded with an
71 underscore (_).
72  
73 =cut
74  
75 ##################
76 # #
77 # Begin the code #
78 # #
79 ##################
80  
81 package Genetics::Cluster ;
82  
83 BEGIN {
84 $ID = "Genetics::Cluster" ;
85 #$DEBUG = $main::DEBUG ;
86 $DEBUG = 0 ;
87 $DEBUG and warn "Debugging in $ID is on" ;
88 }
89  
90 =head1 Imported Packages
91  
92 Genetics::Object Superclass
93 strict Just to be anal
94 vars Global variables
95  
96 =cut
97  
98 use Genetics::Object ;
99 use strict ;
100 use vars qw(@ISA $ID $DEBUG @ATTRS @REQD_ATTRS %DEFAULTS) ;
101  
102 require 5.004 ;
103  
104 @ISA = qw(Genetics::Object) ;
105  
106 @ATTRS = qw(clusterType Contents) ;
107  
108 @REQD_ATTRS = qw(clusterType) ;
109  
110 %DEFAULTS = () ;
111  
112  
113 =head1 Public methods
114  
115 printXML Print an XML representation of the object
116  
117 =cut
118  
119 =head2 printXML
120  
121 Function : Print an XML representation of the object.
122 Argument : An XML::Writer object being used to generate the XML.
123 Returns : String
124 Scope : Public Instance Method
125 Called by : Calls Genetics::Object->printGeneralXML to generate XML elements
126 common to all Genetics::Object objects.
127  
128 =cut
129  
130 sub printXML {
131 my($self, $writer) = @_ ;
132 my($class, $listPtr, $hashPtr, $value) ;
133  
134 $class = ref $self ;
135 $class =~ s/.*::// ;
136
137 ## Common Attributes/Elements
138 $self->printGeneralXML($writer) ;
139  
140 ## Cluster Elements
141 # ClusterType
142 $value = $self->field('ClusterType') ;
143 $writer->dataElement('ClusterType', $value) ;
144 # Comment
145 if (defined ($value = $self->field('comment'))) {
146 $writer->dataElement('Comment', $value) ;
147 }
148 # ObjectRef
149 if (defined ($listPtr = $self->field('ObjectRef'))) {
150 foreach $hashPtr (@$listPtr) {
151 $writer->startTag('ObjectRef') ;
152 $writer->dataElement('Name', $$hashPtr{name}) ;
153 $writer->dataElement('ID', $$hashPtr{id}) ;
154 $writer->endTag('ObjectRef') ;
155 }
156 }
157  
158 $writer->endTag($class) ;
159  
160 return(1) ;
161 }
162  
163 1;
164