File Coverage

Bio/Map/FPCMarker.pm
Criterion Covered Total %
statement 34 72 47.2
branch 9 50 18.0
condition 3 16 18.7
subroutine 11 20 55.0
pod 15 15 100.0
total 72 173 41.6


line stmt bran cond sub pod time code
1             #
2             # BioPerl module for Bio::Map::fpcmarker
3             #
4             # Please direct questions and support issues to
5             #
6             # Cared for by Gaurav Gupta
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::FPCMarker - An central map object representing a marker
17              
18             =head1 SYNOPSIS
19              
20             # get the marker object of $marker from the Bio::Map::FPCMarker
21             my $markerobj = $physical->get_markerobj($marker);
22              
23             # acquire all the clones that hit this marker
24             foreach my $clone ($markerobj->each_cloneid()) {
25             print " +++$clone\n";
26             }
27              
28             # find the position of this marker in $contig
29             print "Position in contig $contig"," = ",$markerobj->position($contig),
30             "\n";
31              
32             # find the group of the marker
33             print "Group : ",$markerobj->group();
34              
35              
36             See L and L for more information.
37              
38             =head1 DESCRIPTION
39              
40             This object handles the notion of a marker.
41             This object is intended to be used by a map parser like fpc.pm.
42              
43             =head1 FEEDBACK
44              
45             =head2 Mailing Lists
46              
47             User feedback is an integral part of the evolution of this and other
48             Bioperl modules. Send your comments and suggestions preferably to
49             the Bioperl mailing list. Your participation is much appreciated.
50              
51             bioperl-l@bioperl.org - General discussion
52             http://bioperl.org/wiki/Mailing_lists - About the mailing lists
53              
54             =head2 Support
55              
56             Please direct usage questions or support issues to the mailing list:
57              
58             I
59              
60             rather than to the module maintainer directly. Many experienced and
61             reponsive experts will be able look at the problem and quickly
62             address it. Please include a thorough description of the problem
63             with code and data examples if at all possible.
64              
65             =head2 Reporting Bugs
66              
67             Report bugs to the Bioperl bug tracking system to help us keep track
68             of the bugs and their resolution. Bug reports can be submitted via the
69             web:
70              
71             https://github.com/bioperl/bioperl-live/issues
72              
73             =head1 AUTHOR - Gaurav Gupta
74              
75             Email gaurav@genome.arizona.edu
76              
77             =head1 CONTRIBUTORS
78              
79             Sendu Bala bix@sendu.me.uk
80              
81             =head1 PROJECT LEADERS
82              
83             Jamie Hatfield jamie@genome.arizona.edu
84             Dr. Cari Soderlund cari@genome.arizona.edu
85              
86             =head1 PROJECT DESCRIPTION
87              
88             The project was done in Arizona Genomics Computational Laboratory (AGCoL)
89             at University of Arizona.
90              
91             This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for
92             the Computation and Display of Physical Mapping Data".
93              
94             For more information on this project, please refer:
95             http://www.genome.arizona.edu
96              
97             =head1 APPENDIX
98              
99             The rest of the documentation details each of the object methods.
100             Internal methods are usually preceded with a _
101              
102             =cut
103              
104             # Let the code begin...
105              
106             package Bio::Map::FPCMarker;
107 2     2   7 use strict;
  2         2  
  2         43  
108 2     2   7 use Bio::Map::Position;
  2         2  
  2         27  
109 2     2   807 use Time::Local;
  2         2459  
  2         102  
110              
111 2     2   9 use base qw(Bio::Root::Root Bio::Map::MappableI);
  2         4  
  2         1321  
112              
113             =head2 new
114              
115             Title : new
116             Usage : my $clone = Bio::Map::FPCMarker->new
117             (
118             -name => $marker,
119             -type => $type,
120             -global => $global,
121             -frame => $frame,
122             -group => $group,
123             -subgroup=> $subgroup,
124             -anchor => $anchor,
125             -clones => \%clones,
126             -contigs => \%contigs,
127             -position => \%markerpos,
128             -remark => $remark
129             );
130              
131             Function: Initialize a new Bio::Map::FPCMarker object
132             Most people will not use this directly but get Markers
133             through L
134             Returns : L object
135             Args : -name => marker name string,
136             -type => type string,
137             -global => global position for marker,
138             -frame => boolean if marker is framework or placement,
139             -group => group number for marker,
140             -subgroup => subgroup number of marker,
141             -anchor => boolean if marker is anchored,
142             -clones => all the clone elements in map (hashref),
143             -contigs => all the contig elements (hasref),
144             -position => mapping of marker names to map position (hasref),
145             -remark => remarks, separated by newlines
146              
147             =cut
148              
149             sub new {
150 0     0 1 0 my ($class,@args) = @_;
151 0         0 my $self= $class->SUPER::new(@args);
152              
153 0         0 my ($name,$type,$global,$frame,$group,
154             $subgroup, $anchor, $clones,$contigs,
155             $positions, $remark) = $self->_rearrange([qw(NAME TYPE GLOBAL FRAME
156             GROUP SUBGROUP ANCHOR
157             CLONES CONTIGS POSITIONS REMARK)],@args);
158              
159 0 0       0 $self->name($name) if defined $name;
160 0 0       0 $self->type($type) if defined $type;
161 0 0       0 $self->global($global) if defined $global;
162 0 0       0 $self->group($group) if defined $group;
163 0 0       0 $self->subgroup($group) if defined $subgroup;
164 0 0       0 $self->anchor($anchor) if defined $anchor;
165 0 0       0 $self->remark($remark) if defined $remark;
166              
167 0 0       0 $self->set_clones($clones) if defined $clones;
168 0 0       0 $self->set_contigs($contigs) if defined $contigs;
169 0 0       0 $self->set_positions($positions) if defined $positions;
170              
171 0         0 return $self;
172             }
173              
174             =head1 Access Methods
175              
176             These methods let you get and set the member variables
177              
178             =head2 name
179              
180             Title : name
181             Usage : my $name = $markerobj->name();
182             Function: Get/set the name for this marker
183             Returns : scalar representing the current name of this marker
184             Args : none to get, OR string to set
185              
186             =cut
187              
188             sub name {
189 0     0 1 0 my ($self) = shift;
190 0 0       0 return $self->{'_name'} = shift if @_;
191 0         0 return $self->{'_name'};
192             }
193              
194             =head2 type
195              
196             Title : type
197             Usage : my $type = $markerobj->type();
198             Function: Get/set the type for this marker
199             Returns : scalar representing the current type of this marker
200             Args : none to get, OR string to set
201              
202             =cut
203              
204             sub type {
205 15     15 1 35 my ($self) = shift;
206 15 50       24 return $self->{'_type'} = shift if @_;
207 15         20 return $self->{'_type'};
208             }
209              
210             =head2 global
211              
212             Title : global
213             Usage : my $type = $markerobj->global();
214             Function: Get/set the global position for this marker
215             Returns : scalar representing the current global position of this marker
216             Args : none to get, OR string to set
217              
218             =cut
219              
220             sub global {
221 9     9 1 18 my ($self) = shift;
222 9 50       10 return $self->{'_global'} = shift if @_;
223 9         21 return $self->{'_global'};
224             }
225              
226             =head2 anchor
227              
228             Title : anchor
229             Usage : my $anchor = $markerobj->anchor();
230             Function: indicate if the Marker is anchored or not (True | False)
231             Returns : scalar representing the anchor (1 | 0) for this marker
232             Args : none to get, OR 1|0 to set
233              
234             =cut
235              
236             sub anchor {
237 15     15 1 22 my ($self) = shift;
238 15 50       18 return $self->{'_anchor'} = shift if @_;
239 15         15 return $self->{'_anchor'};
240             }
241              
242             =head2 framework
243              
244             Title : framework
245             Usage : $frame = $markerobj->framework();
246             Function: indicate if the Marker is framework or placement (1 | 0)
247             Returns : scalar representing if the marker is framework
248             (1 if framework, 0 if placement)
249             Args : none to get, OR 1|0 to set
250              
251             =cut
252              
253             sub framework {
254 15     15 1 23 my ($self) = shift;
255 15 50       17 return $self->{'_frame'} = shift if @_;
256 15         15 return $self->{'_frame'};
257             }
258              
259             =head2 group
260              
261             Title : group
262             Usage : $grpno = $markerobj->group();
263             Function: Get/set the group number for this marker. This is a generic term,
264             used for Linkage-Groups as well as for Chromosomes.
265             Returns : scalar representing the group number of this marker
266             Args : none to get, OR string to set
267              
268             =cut
269              
270             sub group {
271 9     9 1 21 my ($self) = shift;
272 9 50       12 $self->{'_group'} = shift if @_;
273 9   50     19 return $self->{'_group'} || 0;
274             }
275              
276             =head2 subgroup
277              
278             Title : subgroup
279             Usage : $subgroup = $marker->subgroup();
280             Function: Get/set the subgroup for this marker. This is a generic term:
281             subgroup here could represent subgroup of a Chromosome or of a
282             Linkage Group. The user must take care of which subgroup he/she is
283             querying for.
284             Returns : scalar representing the subgroup of this marker
285             Args : none to get, OR string to set
286              
287             =cut
288              
289             sub subgroup {
290 0     0 1 0 my ($self) = shift;
291 0 0       0 $self->{'_subgroup'} = shift if @_;
292 0   0     0 return $self->{'_subgroup'} || 0;
293             }
294              
295             =head2 position
296              
297             Title : position
298             Usage : $markerpos = $markerobj->position($ctg);
299             Function: get the position of the marker in the contig
300             Returns : scalar representing the position of the markernumber of
301             the contig
302             Args : $ctg is necessary to look for the position of the marker
303             in that contig.
304              
305             *** This has nothing to do with an actual Bio::Map::PositionI object ***
306              
307             =cut
308              
309             sub position {
310 165     165 1 235 my ($self,$ctg) = @_;
311 165 50       167 return 0 unless defined $ctg;
312              
313             return 0 unless( defined $self->{'_position'} &&
314 165 100 66     503 defined $self->{'_position'}{$ctg});
315 20         22 return $self->{'_position'}{$ctg};
316             }
317              
318             =head2 remark
319              
320             Title : remark
321             Usage : $markerremark = $markerobj->remark();
322             Function: get the remarks for this marker
323             Returns : scalar of newline-separated markers
324             Args : none
325              
326             =cut
327              
328             sub remark {
329 15     15 1 44 my ($self) = shift;
330 15 50       26 return $self->{'_remark'} = shift if @_;
331 15         40 return $self->{'_remark'};
332             }
333              
334             =head2 each_cloneid
335              
336             Title : each_cloneid
337             Usage : my @clones = $map->each_cloneid();
338             Function: retrieves all the clone ids in a map unordered
339             Returns : list of strings (ids)
340             Args : none
341              
342             *** This only supplies the ids set with the set_clones method ***
343             *** It has nothing to do with actual Bio::Map::MappableI objects ***
344              
345             =cut
346              
347             sub each_cloneid {
348 0     0 1   my ($self) = @_;
349 0           return $self->_each_element('clones');
350             }
351              
352             =head2 each_contigid
353              
354             Title : each_contigid
355             Usage : my @contigs = $map->each_contigid();
356             Function: retrieves all the contig ids in a map unordered
357             Returns : list of strings (ids)
358             Args : none
359              
360             *** This only supplies the ids set with the set_contigs method ***
361             *** It has nothing to do with actual Bio::Map::MapI objects ***
362              
363             =cut
364              
365             sub each_contigid {
366 0     0 1   my ($self) = @_;
367 0           return $self->_each_element('contigs');
368             }
369              
370             sub _each_element{
371 0     0     my ($self, $type) = @_;
372              
373 0 0         $type = 'clones' unless defined $type;
374 0           $type = lc("_$type");
375              
376 0 0         return keys %{$self->{$type} || {}};
  0            
377             }
378              
379             =head2 set_clones
380              
381             Title : set_clones
382             Usage : $marker->set_clones(\%clones)
383             Function: Set the clone ids hashref
384             Returns : None
385             Args : Hashref of clone ids
386              
387             *** This only sets a hash of ids ***
388             *** It has nothing to do with actual Bio::Map::MappableI objects ***
389              
390             =cut
391              
392             sub set_clones{
393 0     0 1   my ($self,$clones) = @_;
394 0 0 0       if( defined $clones && ref($clones) =~ /HASH/ ) {
395 0           $self->{'_clones'} = $clones;
396             }
397             }
398              
399             =head2 set_contigs
400              
401             Title : set_contigs
402             Usage : $marker->set_contigs(\%contigs)
403             Function: Set the contig ids hashref
404             Returns : None
405             Args : Hashref of contig ids
406              
407             *** This only sets a hash of ids ***
408             *** It has nothing to do with actual Bio::Map::MapI objects ***
409              
410             =cut
411              
412             sub set_contigs{
413 0     0 1   my ($self,$contigs) = @_;
414 0 0 0       if( defined $contigs && ref($contigs) =~ /HASH/ ) {
415 0           $self->{'_contigs'} = $contigs;
416             }
417             }
418              
419             =head2 set_positions
420              
421             Title : set_positions
422             Usage : $marker->set_positions(\%markerpos)
423             Function: Set the positions hashref
424             Returns : None
425             Args : Hashref of marker positions
426              
427             *** This only sets a hash of numbers ***
428             *** It has nothing to do with actual Bio::Map::PositionI objects ***
429              
430             =cut
431              
432             sub set_positions{
433 0     0 1   my ($self,$pos) = @_;
434 0 0 0       if( defined $pos && ref($pos) =~ /HASH/ ) {
435 0           $self->{'_positions'} = $pos;
436             }
437             }
438              
439             1;