work on updates for release
[bioperl-live.git] / Bio / Map / Clone.pm
blob620dbce00a0d7e29fc882c51cf9a8b07db85d0a2
2 # BioPerl module for Bio::Map::clone
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Sendu Bala <bix@sendu.me.uk>
8 # Copyright Gaurav Gupta
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
14 =head1 NAME
16 Bio::Map::Clone - An central map object representing a clone
18 =head1 SYNOPSIS
20 # get the clone object of $clone from the Bio::Map::Clone
21 my $cloneobj = $physical->get_cloneobj($clone);
23 # acquire all the markers that hit this clone
24 foreach my $marker ($cloneobj->each_markerid()) {
25 print " +++$marker\n";
28 See L<Bio::Map::Position> and L<Bio::Map::PositionI> for more information.
30 =head1 DESCRIPTION
32 This object handles the notion of a clone. This clone will
33 have a name and a position in a map.
35 This object is intended to be used by a map parser like fpc.pm.
37 =head1 FEEDBACK
39 =head2 Mailing Lists
41 User feedback is an integral part of the evolution of this and other
42 Bioperl modules. Send your comments and suggestions preferably to
43 the Bioperl mailing list. Your participation is much appreciated.
45 bioperl-l@bioperl.org - General discussion
46 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
48 =head2 Support
50 Please direct usage questions or support issues to the mailing list:
52 I<bioperl-l@bioperl.org>
54 rather than to the module maintainer directly. Many experienced and
55 reponsive experts will be able look at the problem and quickly
56 address it. Please include a thorough description of the problem
57 with code and data examples if at all possible.
59 =head2 Reporting Bugs
61 Report bugs to the Bioperl bug tracking system to help us keep track
62 of the bugs and their resolution. Bug reports can be submitted via the
63 web:
65 https://redmine.open-bio.org/projects/bioperl/
67 =head1 AUTHOR - Gaurav Gupta
69 Email gaurav@genome.arizona.edu
71 =head1 CONTRIBUTORS
73 Sendu Bala bix@sendu.me.uk
75 =head1 PROJECT LEADERS
77 Jamie Hatfield jamie@genome.arizona.edu
78 Dr. Cari Soderlund cari@genome.arizona.edu
80 =head1 PROJECT DESCRIPTION
82 The project was done in Arizona Genomics Computational Laboratory (AGCoL)
83 at University of Arizona.
85 This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for
86 the Computation and Display of Physical Mapping Data".
88 For more information on this project, please refer:
89 http://www.genome.arizona.edu
91 =head1 APPENDIX
93 The rest of the documentation details each of the object methods.
94 Internal methods are usually preceded with a _
96 =cut
98 # Let the code begin...
100 package Bio::Map::Clone;
101 use strict;
102 use Bio::Map::Position;
104 use base qw(Bio::Root::Root Bio::Map::MappableI);
106 =head2 new
108 Title : new
109 Usage : my $clone = Bio::Map::Clone->new
111 -name => $clone,
112 -markers => \@markers,
113 -contig => $contig,
114 -type => $type,
115 -bands => $bands,
116 -gel => $gel,
117 -group => $group,
118 -remark => $remark,
119 -fpnumber=> $fp_number,
120 -sequencetype => $seq_type,
121 -sequencestatus=> $seq_status,
122 -fpcremark => $fpc_remark,
123 -matche => \@ematch,
124 -matcha => \@amatch,
125 -matchp => \@pmatch,
126 -range => Bio::Range->new(-start => $startrange,
127 -end => $endrange)
129 Function: Initialize a new Bio::Map::Clone object
130 Most people will not use this directly but get Clones
131 through L<Bio::MapIO::fpc>
132 Returns : L<Bio::Map::Clone> object
133 Args : -name => marker name string,
134 -markers => array ref of markers,
135 -contig => contig name string,
136 -type => type string,
137 -bands => band string,
138 -gel => gel string,
139 -group => group name string,
140 -remark => remark string,
141 -fpnumber=> FP number string,
142 -sequencetype => seq type string,
143 -sequencestatus=> seq status string,
144 -fpcremark => FPC remark,
145 -matche => array ref,
146 -matcha => array ref,
147 -matchp => array ref,
148 -range => L<Bio::Range> object,
150 =cut
152 sub new {
153 my ($class,@args) = @_;
154 my $self= $class->SUPER::new(@args);
156 my ($name,$markers,$contig,$type,$bands,$gel,$group,
157 $remark,$fpnumber,$seqtype,$seqstatus,$fpcremark,
158 $matche,$matcha,$matchp,
159 $range) = $self->_rearrange([qw(NAME MARKERS CONTIG TYPE
160 BANDS GEL GROUP REMARK FPNUMBER
161 SEQUENCETYPE SEQUENCESTATUS
162 FPCREMARK MATCHE MATCHA MATCHP
163 RANGE)],@args);
165 $self->name($name) if defined $name;
166 $self->markers($markers) if defined $markers;
167 $self->contigid($contig) if defined $contig;
168 $self->type($type) if defined $type;
169 $self->bands($bands) if defined $bands;
170 $self->gel($gel) if defined $gel;
171 $self->group($group) if defined $group;
172 $self->remark($remark) if defined $remark;
173 $self->fp_number($fpnumber) if defined $fpnumber;
174 $self->sequence_type($seqtype) if defined $seqtype;
175 $self->sequence_status($seqstatus) if defined $seqstatus;
176 $self->fpc_remark($fpcremark) if defined $fpcremark;
177 $self->range($range) if defined $range;
179 $self->set_match('approx', $matcha) if defined $matcha;
180 $self->set_match('pseudo', $matchp) if defined $matchp;
181 $self->set_match('exact', $matche) if defined $matche;
183 return $self;
186 =head1 Access Methods
188 These methods let you get and set the member variables
190 =head2 name
192 Title : name
193 Usage : my $name = $cloneobj->name();
194 Function: Get/set the name for this Clone
195 Returns : scalar representing the current name of this clone
196 Args : none to get, OR string to set
198 =cut
200 sub name {
201 my ($self) = shift;
202 return $self->{'_name'} = shift if @_;
203 return $self->{'_name'};
206 =head2 type
208 Title : type
209 Usage : my $type = $cloneobj->type();
210 Function: Get/set the type for this clone
211 Returns : scalar representing the current type of this clone
212 Args : none to get, OR string to set
214 =cut
216 sub type {
217 my ($self) = shift;
218 return $self->{'_type'} = shift if @_;
219 return $self->{'_type'};
222 =head2 range
224 Title : range
225 Usage : my $range = $cloneobj->range();
226 Function: Get/set the range of the contig that this clone covers
227 Returns : Bio::Range representing the current range of this contig,
228 start and end of the contig can be thus found using:
229 my $start = $contigobj->range()->start();
230 my $end = $contigobj->range()->end();
231 Args : none to get, OR Bio::Range to set
233 =cut
235 sub range {
236 my ($self) = shift;
237 return $self->{'_range'} = shift if @_;
238 return $self->{'_range'};
241 =head2 match
243 Title : match
244 Usage : @eclone = $cloneobj->match('exact');
245 @aclone = $cloneobj->match('approximate');
246 @pclone = $cloneobj->match('pseudo');
247 Function: get all matching clones
248 Returns : list
249 Args : scalar representing the type of clone to be
250 queried.
252 =cut
254 sub match {
255 my ($self,$type) = @_;
257 $type = "_match" . lc(substr($type, 0, 1));
258 return @{$self->{$type} || []};
261 =head2 each_match
263 Title : each_match
264 Function: Synonym of the match() method.
266 =cut
268 *each_match = \&match;
270 =head2 set_match
272 Title : set_match
273 Usage : $clone->set_match($type,$values);
274 Function: Set the Matches per type
275 Returns : None
276 Args : type (one of 'exact' 'approx' 'pseudo')
277 array ref of match values
279 =cut
281 sub set_match{
282 my ($self,$type,$val) = @_;
283 $type = "_match" . lc(substr($type, 0, 1));
284 $self->{$type} = $val;
287 =head2 gel
289 Title : gel
290 Usage : $clonegel = $cloneobj->gel();
291 Function: Get/set the gel number for this clone
292 Returns : scalar representing the gel number of this clone
293 Args : none to get, OR string to set
295 =cut
297 sub gel {
298 my ($self) = shift;
299 return $self->{'_gel'} = shift if @_;
300 return $self->{'_gel'};
303 =head2 remark
305 Title : remark
306 Usage : $cloneremark = $cloneobj->remark();
307 Function: Get/set the remark for this clone
308 Returns : scalar representing the current remark of this clone
309 Args : none to get, OR string to set
311 =cut
313 sub remark {
314 my ($self) = shift;
315 return $self->{'_remark'} = shift if @_;
316 return $self->{'_remark'};
319 =head2 fp_number
321 Title : fp_number
322 Usage : $clonefpnumber = $cloneobj->fp_number();
323 Function: Get/set the fp number for this clone
324 Returns : scalar representing the fp number of this clone
325 Args : none to get, OR string to set
327 =cut
329 sub fp_number {
330 my ($self) = shift;
331 return $self->{'_fpnumber'} = shift if @_;
332 return $self->{'_fpnumber'};
335 =head2 sequence_type
337 Title : sequence_type
338 Usage : $cloneseqtype = $cloneobj->sequence_type();
339 Function: Get/set the sequence type for this clone
340 Returns : scalar representing the sequence type of this clone
341 Args : none to get, OR string to set
343 =cut
345 sub sequence_type {
346 my ($self) = shift;
347 return $self->{'_sequencetype'} = shift if @_;
348 return $self->{'_sequencetype'};
351 =head2 sequence_status
353 Title : sequence_status
354 Usage : $cloneseqstatus = $cloneobj->sequence_status();
355 Function: Get/set the sequence status for this clone
356 Returns : scalar representing the sequence status of this clone
357 Args : none to get, OR string to set
359 =cut
361 sub sequence_status {
362 my ($self) = shift;
363 return $self->{'_sequencestatus'} = shift if @_;
364 return $self->{'_sequencestatus'};
367 =head2 fpc_remark
369 Title : fpc_remark
370 Usage : $clonefpcremark = $cloneobj->fpc_remark();
371 Function: Get/set the fpc remark for this clone
372 Returns : scalar representing the fpc remark of this clone
373 Args : none to get, OR string to set
375 =cut
377 sub fpc_remark {
378 my ($self) = shift;
379 return $self->{'_fpcremark'} = shift if @_;
380 return $self->{'_fpcremark'};
383 =head2 bands
385 Title : bands
386 Usage : @clonebands = $cloneobj->bands();
387 Function: Get/set the bands for this clone
388 Returns : liat representing the band of this clone, if
389 readcor = 1 while creating the MapIO object and the
390 .cor exists
391 Args : none to get, OR string to set
393 =cut
395 sub bands {
396 my ($self) = shift;
397 return $self->{'_bands'} = shift if @_;
398 return $self->{'_bands'};
401 =head2 group
403 Title : group
404 Usage : $cloneobj->group($chrno);
405 Function: Get/set the group number for this clone.
406 This is a generic term, used for Linkage-Groups as well as for
407 Chromosomes.
408 Returns : scalar representing the group number of this clone
409 Args : none to get, OR string to set
411 =cut
413 sub group {
414 my ($self) = shift;
415 return $self->{'_group'} = shift if @_;
416 return $self->{'_group'};
419 =head2 contigid
421 Title : contigid
422 Usage : my $ctg = $cloneobj->contigid();
423 Function: Get/set the contig this clone belongs to
424 Returns : scalar representing the contig
425 Args : none to get, OR string to set
427 =cut
429 sub contigid {
430 my ($self) = shift;
431 $self->{'_contig'} = shift if @_;
432 return $self->{'_contig'} || 0;
435 =head2 each_markerid
437 Title : each_markerid
438 Usage : @markers = $cloneobj->each_markerid();
439 Function: retrieves all the elements in a map unordered
440 Returns : list of strings (ids)
441 Args : none
443 *** This only supplies the ids set with the set_markers method ***
444 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
446 =cut
448 sub each_markerid {
449 my ($self,$value) = @_;
450 return @{$self->{"_markers"}};
453 =head2 set_markers
455 Title : markers
456 Usage : $obj->set_markers($newval)
457 Function: Set list of Marker ids (arrayref)
458 Returns : None
459 Args : arrayref of strings (ids)
461 *** This only sets a list of ids ***
462 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
464 =cut
466 sub set_markers {
467 my ($self,$markers) = @_;
468 if( defined $markers && ref($markers) =~ /ARRAY/ ) {
469 $self->{'_markers'} = $markers;