File Coverage

Bio/Map/Clone.pm
Criterion Covered Total %
statement 30 78 38.4
branch 6 60 10.0
condition 2 5 40.0
subroutine 10 20 50.0
pod 17 17 100.0
total 65 180 36.1


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::Map::clone
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Sendu Bala
7             #
8             # Copyright Gaurav Gupta
9             #
10             # You may distribute this module under the same terms as perl itself
11              
12             # POD documentation - main docs before the code
13              
14             =head1 NAME
15              
16             Bio::Map::Clone - An central map object representing a clone
17              
18             =head1 SYNOPSIS
19              
20             # get the clone object of $clone from the Bio::Map::Clone
21             my $cloneobj = $physical->get_cloneobj($clone);
22              
23             # acquire all the markers that hit this clone
24             foreach my $marker ($cloneobj->each_markerid()) {
25             print " +++$marker\n";
26             }
27              
28             See L and L for more information.
29              
30             =head1 DESCRIPTION
31              
32             This object handles the notion of a clone. This clone will
33             have a name and a position in a map.
34              
35             This object is intended to be used by a map parser like fpc.pm.
36              
37             =head1 FEEDBACK
38              
39             =head2 Mailing Lists
40              
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.
44              
45             bioperl-l@bioperl.org - General discussion
46             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
47              
48             =head2 Support
49              
50             Please direct usage questions or support issues to the mailing list:
51              
52             I
53              
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.
58              
59             =head2 Reporting Bugs
60              
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:
64              
65             https://github.com/bioperl/bioperl-live/issues
66              
67             =head1 AUTHOR - Gaurav Gupta
68              
69             Email gaurav@genome.arizona.edu
70              
71             =head1 CONTRIBUTORS
72              
73             Sendu Bala bix@sendu.me.uk
74              
75             =head1 PROJECT LEADERS
76              
77             Jamie Hatfield jamie@genome.arizona.edu
78             Dr. Cari Soderlund cari@genome.arizona.edu
79              
80             =head1 PROJECT DESCRIPTION
81              
82             The project was done in Arizona Genomics Computational Laboratory (AGCoL)
83             at University of Arizona.
84              
85             This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for
86             the Computation and Display of Physical Mapping Data".
87              
88             For more information on this project, please refer:
89             http://www.genome.arizona.edu
90              
91             =head1 APPENDIX
92              
93             The rest of the documentation details each of the object methods.
94             Internal methods are usually preceded with a _
95              
96             =cut
97              
98             # Let the code begin...
99              
100             package Bio::Map::Clone;
101 2     2   11 use strict;
  2         3  
  2         54  
102 2     2   310 use Bio::Map::Position;
  2         5  
  2         57  
103              
104 2     2   12 use base qw(Bio::Root::Root Bio::Map::MappableI);
  2         6  
  2         1798  
105              
106             =head2 new
107              
108             Title : new
109             Usage : my $clone = Bio::Map::Clone->new
110             (
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)
128             );
129             Function: Initialize a new Bio::Map::Clone object
130             Most people will not use this directly but get Clones
131             through L
132             Returns : L 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 object,
149              
150             =cut
151              
152             sub new {
153 0     0 1 0 my ($class,@args) = @_;
154 0         0 my $self= $class->SUPER::new(@args);
155            
156 0         0 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);
164              
165 0 0       0 $self->name($name) if defined $name;
166 0 0       0 $self->markers($markers) if defined $markers;
167 0 0       0 $self->contigid($contig) if defined $contig;
168 0 0       0 $self->type($type) if defined $type;
169 0 0       0 $self->bands($bands) if defined $bands;
170 0 0       0 $self->gel($gel) if defined $gel;
171 0 0       0 $self->group($group) if defined $group;
172 0 0       0 $self->remark($remark) if defined $remark;
173 0 0       0 $self->fp_number($fpnumber) if defined $fpnumber;
174 0 0       0 $self->sequence_type($seqtype) if defined $seqtype;
175 0 0       0 $self->sequence_status($seqstatus) if defined $seqstatus;
176 0 0       0 $self->fpc_remark($fpcremark) if defined $fpcremark;
177 0 0       0 $self->range($range) if defined $range;
178              
179 0 0       0 $self->set_match('approx', $matcha) if defined $matcha;
180 0 0       0 $self->set_match('pseudo', $matchp) if defined $matchp;
181 0 0       0 $self->set_match('exact', $matche) if defined $matche;
182              
183 0         0 return $self;
184             }
185              
186             =head1 Access Methods
187              
188             These methods let you get and set the member variables
189              
190             =head2 name
191              
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
197              
198             =cut
199              
200             sub name {
201 0     0 1 0 my ($self) = shift;
202 0 0       0 return $self->{'_name'} = shift if @_;
203 0         0 return $self->{'_name'};
204             }
205              
206             =head2 type
207              
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
213              
214             =cut
215              
216             sub type {
217 0     0 1 0 my ($self) = shift;
218 0 0       0 return $self->{'_type'} = shift if @_;
219 0         0 return $self->{'_type'};
220             }
221              
222             =head2 range
223              
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
232              
233             =cut
234              
235             sub range {
236 1388     1388 1 2208 my ($self) = shift;
237 1388 50       1945 return $self->{'_range'} = shift if @_;
238 1388         2008 return $self->{'_range'};
239             }
240              
241             =head2 match
242              
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.
251              
252             =cut
253              
254             sub match {
255 0     0 1 0 my ($self,$type) = @_;
256              
257 0         0 $type = "_match" . lc(substr($type, 0, 1));
258 0 0       0 return @{$self->{$type} || []};
  0         0  
259             }
260              
261             =head2 each_match
262              
263             Title : each_match
264             Function: Synonym of the match() method.
265              
266             =cut
267              
268             *each_match = \&match;
269              
270             =head2 set_match
271              
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
278              
279             =cut
280              
281             sub set_match{
282 0     0 1 0 my ($self,$type,$val) = @_;
283 0         0 $type = "_match" . lc(substr($type, 0, 1));
284 0         0 $self->{$type} = $val;
285             }
286              
287             =head2 gel
288              
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
294              
295             =cut
296              
297             sub gel {
298 0     0 1 0 my ($self) = shift;
299 0 0       0 return $self->{'_gel'} = shift if @_;
300 0         0 return $self->{'_gel'};
301             }
302              
303             =head2 remark
304              
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
310              
311             =cut
312              
313             sub remark {
314 366     366 1 1200 my ($self) = shift;
315 366 50       459 return $self->{'_remark'} = shift if @_;
316 366         533 return $self->{'_remark'};
317             }
318              
319             =head2 fp_number
320              
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
326              
327             =cut
328              
329             sub fp_number {
330 0     0 1 0 my ($self) = shift;
331 0 0       0 return $self->{'_fpnumber'} = shift if @_;
332 0         0 return $self->{'_fpnumber'};
333             }
334              
335             =head2 sequence_type
336              
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
342              
343             =cut
344              
345             sub sequence_type {
346 0     0 1 0 my ($self) = shift;
347 0 0       0 return $self->{'_sequencetype'} = shift if @_;
348 0         0 return $self->{'_sequencetype'};
349             }
350              
351             =head2 sequence_status
352              
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
358              
359             =cut
360              
361             sub sequence_status {
362 360     360 1 901 my ($self) = shift;
363 360 50       433 return $self->{'_sequencestatus'} = shift if @_;
364 360         439 return $self->{'_sequencestatus'};
365             }
366              
367             =head2 fpc_remark
368              
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
374              
375             =cut
376              
377             sub fpc_remark {
378 436     436 1 984 my ($self) = shift;
379 436 50       524 return $self->{'_fpcremark'} = shift if @_;
380 436         647 return $self->{'_fpcremark'};
381             }
382              
383             =head2 bands
384              
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
392              
393             =cut
394              
395             sub bands {
396 355     355 1 1321 my ($self) = shift;
397 355 50       535 return $self->{'_bands'} = shift if @_;
398 355         518 return $self->{'_bands'};
399             }
400              
401             =head2 group
402              
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
410              
411             =cut
412              
413             sub group {
414 0     0 1 0 my ($self) = shift;
415 0 0       0 return $self->{'_group'} = shift if @_;
416 0         0 return $self->{'_group'};
417             }
418              
419             =head2 contigid
420              
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
426              
427             =cut
428              
429             sub contigid {
430 710     710 1 1832 my ($self) = shift;
431 710 50       882 $self->{'_contig'} = shift if @_;
432 710   100     1510 return $self->{'_contig'} || 0;
433             }
434              
435             =head2 each_markerid
436              
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
442              
443             *** This only supplies the ids set with the set_markers method ***
444             *** It has nothing to do with actual Bio::Map::MarkerI objects ***
445              
446             =cut
447              
448             sub each_markerid {
449 355     355 1 1032 my ($self,$value) = @_;
450 355         312 return @{$self->{"_markers"}};
  355         638  
451             }
452              
453             =head2 set_markers
454              
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)
460              
461             *** This only sets a list of ids ***
462             *** It has nothing to do with actual Bio::Map::MarkerI objects ***
463              
464             =cut
465              
466             sub set_markers {
467 0     0 1   my ($self,$markers) = @_;
468 0 0 0       if( defined $markers && ref($markers) =~ /ARRAY/ ) {
469 0           $self->{'_markers'} = $markers;
470             }
471             }
472              
473             1;