0
|
1 # $Id: CytoMap.pm,v 1.2 2002/10/22 07:45:15 lapp Exp $
|
|
2 #
|
|
3 # BioPerl module for Bio::Map::CytoMap
|
|
4 #
|
|
5 # Cared for by Heikki Lehvaslaiho <heikki@ebi.ac.uk>
|
|
6 #
|
|
7 # Copyright Heikki Lehvaslaiho
|
|
8 #
|
|
9 # You may distribute this module under the same terms as perl itself
|
|
10
|
|
11 # POD documentation - main docs before the code
|
|
12
|
|
13 =head1 NAME
|
|
14
|
|
15 Bio::Map::CytoMap - A Bio::MapI compliant map implementation handling cytogenic bands
|
|
16
|
|
17 =head1 SYNOPSIS
|
|
18
|
|
19 use Bio::Map::CytoMap;
|
|
20 my $map = new Bio::Map::CytoMap(-name => 'human1',
|
|
21 -species => $human);
|
|
22 foreach my $marker ( @markers ) { # get a list of markers somewhere
|
|
23 $map->add_element($marker);
|
|
24 }
|
|
25
|
|
26 =head1 DESCRIPTION
|
|
27
|
|
28 This is the simple implementation of cytogenetic maps based on
|
|
29 L<Bio::Map::MapI>. It handles the essential storage of name, species,
|
|
30 type, and units as well as in memory representation of the elements of
|
|
31 a map.
|
|
32
|
|
33 For CytoMaps type is hard coded to be 'cytogeneticmap' and
|
|
34 units are set to '' but can be set to something else.
|
|
35
|
|
36 =head1 FEEDBACK
|
|
37
|
|
38 =head2 Mailing Lists
|
|
39
|
|
40 User feedback is an integral part of the evolution of this and other
|
|
41 Bioperl modules. Send your comments and suggestions preferably to
|
|
42 the Bioperl mailing list. Your participation is much appreciated.
|
|
43
|
|
44 bioperl-l@bioperl.org - General discussion
|
|
45 http://bioperl.org/MailList.shtml - About the mailing lists
|
|
46
|
|
47 =head2 Reporting Bugs
|
|
48
|
|
49 Report bugs to the Bioperl bug tracking system to help us keep track
|
|
50 of the bugs and their resolution. Bug reports can be submitted via
|
|
51 email or the web:
|
|
52
|
|
53 bioperl-bugs@bioperl.org
|
|
54 http://bugzilla.bioperl.org/
|
|
55
|
|
56 =head1 AUTHOR - Heikki Lehvaslaiho
|
|
57
|
|
58 Email heikki@ebi.ac.uk
|
|
59
|
|
60 =head1 CONTRIBUTORS
|
|
61
|
|
62 Jason Stajich jason@bioperl.org
|
|
63 Lincoln Stein lstein@cshl.org
|
|
64
|
|
65 =head1 APPENDIX
|
|
66
|
|
67 The rest of the documentation details each of the object methods.
|
|
68 Internal methods are usually preceded with a _
|
|
69
|
|
70 =cut
|
|
71
|
|
72
|
|
73 # Let the code begin...
|
|
74
|
|
75
|
|
76 package Bio::Map::CytoMap;
|
|
77 use vars qw(@ISA $MAPCOUNT);
|
|
78 use strict;
|
|
79
|
|
80 # Object preamble - inherits from Bio::Root::Root
|
|
81
|
|
82 use Bio::Root::Root;
|
|
83 use Bio::Map::SimpleMap;
|
|
84
|
|
85 @ISA = qw(Bio::Root::Root Bio::Map::SimpleMap);
|
|
86 BEGIN { $MAPCOUNT = 1; }
|
|
87
|
|
88 =head2 Modified methods
|
|
89
|
|
90 All methods present in L<Bio::Map::SimpleMap> are implemted by this
|
|
91 class. Most of the methods are inherited from SimpleMap. The following
|
|
92 methods have been modified to refelect the needs of cytogenetic maps.
|
|
93
|
|
94 =head2 new
|
|
95
|
|
96 Title : new
|
|
97 Usage : my $obj = new Bio::Map::CytoMap();
|
|
98 Function: Builds a new Bio::Map::CytoMap object
|
|
99 Returns : Bio::Map::CytoMap
|
|
100 Args : -name => name of map (string)
|
|
101 -species => species for this map (Bio::Species) [optional]
|
|
102 -elements=> elements to initialize with
|
|
103 (arrayref of Bio::Map::MappableI objects) [optional]
|
|
104
|
|
105 -uid => Unique Id
|
|
106 =cut
|
|
107
|
|
108 sub new {
|
|
109 my($class,@args) = @_;
|
|
110
|
|
111 my $self = $class->SUPER::new(@args);
|
|
112
|
|
113 $self->{'_elements'} = [];
|
|
114 $self->{'_name'} = '';
|
|
115 $self->{'_species'} = '';
|
|
116 $self->{'_units'} = '';
|
|
117 $self->{'_type'} = 'cyto';
|
|
118 $self->{'_uid'} = $MAPCOUNT++;
|
|
119 my ($name, $type,$species, $units,
|
|
120 $elements,$uid) = $self->_rearrange([qw(NAME TYPE
|
|
121 SPECIES UNITS
|
|
122 ELEMENTS UID)], @args);
|
|
123 defined $name && $self->name($name);
|
|
124 defined $species && $self->species($species);
|
|
125 defined $units && $self->units($units);
|
|
126 defined $type && $self->type($type);
|
|
127 defined $uid && $self->unique_id($uid);
|
|
128
|
|
129 if( $elements && ref($elements) =~ /array/ ) {
|
|
130 foreach my $item ( @$elements ) {
|
|
131 $self->add_element($item);
|
|
132 }
|
|
133 }
|
|
134 return $self;
|
|
135 }
|
|
136
|
|
137 =head2 type
|
|
138
|
|
139 Title : type
|
|
140 Usage : my $type = $map->type
|
|
141 Function: Get hard-coded Map type
|
|
142 Returns : String coding map type
|
|
143 Args :
|
|
144
|
|
145 =cut
|
|
146
|
|
147 sub type {
|
|
148 my ($self) = @_;
|
|
149 return $self->{'_type'};
|
|
150 }
|
|
151
|
|
152
|
|
153 =head2 length
|
|
154
|
|
155 Title : length
|
|
156 Usage : my $length = $map->length();
|
|
157 Function: Retrieves the length of the map,
|
|
158 Returns : undef since length is not calculatable for
|
|
159 cytogenetic maps
|
|
160 Args : none
|
|
161
|
|
162 =cut
|
|
163
|
|
164 sub length{
|
|
165 my ($self,@args) = @_;
|
|
166 return undef;
|
|
167 }
|
|
168
|
|
169 =head2 Methods inherited from L<Bio::Map::SimpleMap>
|
|
170
|
|
171 =cut
|
|
172
|
|
173 =head2 species
|
|
174
|
|
175 Title : species
|
|
176 Usage : my $species = $map->species;
|
|
177 Function: Get/Set Species for a map
|
|
178 Returns : Bio::Species object or string
|
|
179 Args : (optional) Bio::Species or string
|
|
180
|
|
181 =cut
|
|
182
|
|
183 =head2 units
|
|
184
|
|
185 Title : units
|
|
186 Usage : $map->units('cM');
|
|
187 Function: Get/Set units for a map
|
|
188 Returns : units for a map
|
|
189 Args : units for a map (string)
|
|
190
|
|
191 =cut
|
|
192
|
|
193 =head2 name
|
|
194
|
|
195 Title : name
|
|
196 Usage : my $name = $map->name
|
|
197 Function: Get/Set Map name
|
|
198 Returns : Map name
|
|
199 Args : (optional) string
|
|
200
|
|
201 =cut
|
|
202
|
|
203 =head2 unique_id
|
|
204
|
|
205 Title : unique_id
|
|
206 Usage : my $id = $map->unique_id;
|
|
207 Function: Get/Set the unique ID for this map
|
|
208 Returns : a unique identifier
|
|
209 Args : [optional] new identifier to set
|
|
210
|
|
211 =cut
|
|
212
|
|
213 =head2 each_element
|
|
214
|
|
215 Title : each_element
|
|
216 Usage : my @elements = $map->each_element;
|
|
217 Function: Retrieves all the elements in a map
|
|
218 unordered
|
|
219 Returns : Array of Bio::Map::MappableI objects
|
|
220 Args : none
|
|
221
|
|
222
|
|
223 =cut
|
|
224
|
|
225 =head2 New methods
|
|
226
|
|
227 =cut
|
|
228
|
|
229
|
|
230 1;
|