| 1 | # GenPerl module | ||
| 2 | # | ||
| 3 | |||
| 4 | # POD documentation - main docs before the code | ||
| 5 | |||
| 6 | =head1 NAME | ||
| 7 | |||
| 8 | Genetics::HtMarkerCollection | ||
| 9 | |||
| 10 | =head1 SYNOPSIS | ||
| 11 | |||
| 12 | $hmc = new Genetics::HtMarkerCollection(name => '12pEA1', | ||
| 13 | importID => 267, | ||
| 14 | dateCreated => $today, | ||
| 15 | Keywords => [ {name => "Test Data", | ||
| 16 | dataType => "Boolean", | ||
| 17 | value => 1}, | ||
| 18 | ], | ||
| 19 | Markers => [ {Marker => {name => "D12S91", | ||
| 20 | importID => 1}, | ||
| 21 | distToNext => "1.2"}, | ||
| 22 | {Marker => {name => "EAEx1.1", | ||
| 23 | importID => 265}, | ||
| 24 | } | ||
| 25 | ], | ||
| 26 | distanceUnits => "cM", | ||
| 27 | ) ; | ||
| 28 | |||
| 29 | See the GenPerl Tutorial for more information. | ||
| 30 | |||
| 31 | =head1 DESCRIPTION | ||
| 32 | |||
| 33 | HtMarkerCollection objects represent an ordered set of genetic markers from | ||
| 34 | which haplotypes can be constructed. | ||
| 35 | |||
| 36 | =head1 LICENSE | ||
| 37 | |||
| 38 | This program is free software; you can redistribute it and/or modify | ||
| 39 | it under the terms of the GNU General Public License as published by | ||
| 40 | the Free Software Foundation; either version 2 of the License, or | ||
| 41 | (at your option) any later version. | ||
| 42 | |||
| 43 | This program is distributed in the hope that it will be useful, | ||
| 44 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 45 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 46 | GNU General Public License for more details. | ||
| 47 | |||
| 48 | You should have received a copy of the GNU General Public License | ||
| 49 | along with this program; if not, write to the Free Software | ||
| 50 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 51 | |||
| 52 | =head1 FEEDBACK | ||
| 53 | |||
| 54 | Currently, all feedback should be sent directly to the author. | ||
| 55 | |||
| 56 | =head1 AUTHOR - Steve Mathias | ||
| 57 | |||
| 58 | Email: mathias@genomica.com | ||
| 59 | |||
| 60 | Phone: (720) 565-4029 | ||
| 61 | |||
| 62 | Address: Genomica Corporation | ||
| 63 | 1745 38th Street | ||
| 64 | Boulder, CO 80301 | ||
| 65 | |||
| 66 | =head1 DETAILS | ||
| 67 | |||
| 68 | The rest of the documentation describes each of the object variables and | ||
| 69 | methods. The names of internal variables and methods are preceded with an | ||
| 70 | underscore (_). | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | ################## | ||
| 75 | # # | ||
| 76 | # Begin the code # | ||
| 77 | # # | ||
| 78 | ################## | ||
| 79 | |||
| 80 | package Genetics::HtMarkerCollection ; | ||
| 81 | |||
| 82 | BEGIN { | ||
| 83 | $ID = "Genetics::HtMarkerCollection" ; | ||
| 84 | #$DEBUG = $main::DEBUG ; | ||
| 85 | $DEBUG = 0 ; | ||
| 86 | $DEBUG and warn "Debugging in $ID is on" ; | ||
| 87 | } | ||
| 88 | |||
| 89 | =head1 Imported Packages | ||
| 90 | |||
| 91 | Genetics::Object Superclass | ||
| 92 | strict Just to be anal | ||
| 93 | vars Global variables | ||
| 94 | |||
| 95 | =cut | ||
| 96 | |||
| 97 | use Genetics::Object ; | ||
| 98 | use strict ; | ||
| 99 | use vars qw(@ISA $ID $DEBUG @ATTRS @REQD_ATTRS %DEFAULTS) ; | ||
| 100 | |||
| 101 | require 5.004 ; | ||
| 102 | |||
| 103 | @ISA = qw(Genetics::Object) ; | ||
| 104 | |||
| 105 | @ATTRS = qw(distanceUnits Markers) ; | ||
| 106 | |||
| 107 | @REQD_ATTRS = qw(Markers) ; | ||
| 108 | |||
| 109 | %DEFAULTS = () ; | ||
| 110 | |||
| 111 | |||
| 112 | =head1 Public methods | ||
| 113 | |||
| 114 | printXML Print an XML representation of the object | ||
| 115 | |||
| 116 | =cut | ||
| 117 | |||
| 118 | =head2 printXML | ||
| 119 | |||
| 120 | Function : Print an XML representation of the object. | ||
| 121 | Argument : A Genetics::StudyVariable object and the XML::Writer object being | ||
| 122 | used to generate the XML. | ||
| 123 | Returns : String | ||
| 124 | Scope : Public Instance Method | ||
| 125 | Comments : 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 | ## HMC Elements | ||
| 141 | # HMCMarkerRef | ||
| 142 | $listPtr = $self->field('HMCMarkerRef') ; | ||
| 143 | foreach $hashPtr (@$listPtr) { | ||
| 144 | $writer->startTag('HMCMarkerRef') ; | ||
| 145 | $writer->startTag('MarkerRef') ; | ||
| 146 | $writer->dataElement('Name', $$hashPtr{name}) ; | ||
| 147 | $writer->dataElement('ID', $$hashPtr{id}) ; | ||
| 148 | $writer->endTag('MarkerRef') ; | ||
| 149 | $writer->dataElement('DistToNext', $$hashPtr{distToNext}) ; | ||
| 150 | $writer->endTag('HMCMarkerRef') ; | ||
| 151 | } | ||
| 152 | # DistanceUnits | ||
| 153 | if (defined ($value = $self->field('distanceUnits'))) { | ||
| 154 | $writer->dataElement('DistanceUnits', $value) ; | ||
| 155 | } | ||
| 156 | |||
| 157 | $writer->endTag($class) ; | ||
| 158 | |||
| 159 | return(1) ; | ||
| 160 | } | ||
| 161 | |||
| 162 | 1; | ||
| 163 |