2 # BioPerl module for Bio::Map::Contig
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
16 Bio::Map::Contig - A MapI implementation handling the contigs of a
17 Physical Map (such as FPC)
21 # get the contig object of $contig from the Bio::Map::Physical
22 my $ctgobj = $physical->get_contigobj($contig);
24 # acquire all the markers that lie in this contig
25 foreach my $marker ($ctgobj->each_markerid()) {
26 print " +++$marker\n";
29 # find the group of this contig
30 print "Group: ",$ctgobj->group(),"\n";
32 # find the range of this contig
33 print "RANGE: start:",$ctgobj->range()->start(),"\tend: ",
34 $ctgobj->range()->end(),"\n";
36 # find the position of this contig in $group (chromosome)
37 print "Position in Group $group"," = ",$ctgobj->position($group),"\n";
42 This is an implementation of Bio::Map::MapI. It handles the
43 essential storage of name, species, type, and units as well as in
44 memory representation of the elements of a map.
46 Bio::Map::Contig has been tailored to work for FPC physical maps, but
47 could probably be used for others as well (with the appropriate MapIO
54 User feedback is an integral part of the evolution of this and other
55 Bioperl modules. Send your comments and suggestions preferably to
56 the Bioperl mailing list. Your participation is much appreciated.
58 bioperl-l@bioperl.org - General discussion
59 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
63 Please direct usage questions or support issues to the mailing list:
65 I<bioperl-l@bioperl.org>
67 rather than to the module maintainer directly. Many experienced and
68 reponsive experts will be able look at the problem and quickly
69 address it. Please include a thorough description of the problem
70 with code and data examples if at all possible.
74 Report bugs to the Bioperl bug tracking system to help us keep track
75 of the bugs and their resolution. Bug reports can be submitted via the
78 https://github.com/bioperl/bioperl-live/issues
80 =head1 AUTHOR - Gaurav Gupta
82 Email gaurav@genome.arizona.edu
86 Sendu Bala bix@sendu.me.uk
88 =head1 PROJECT LEADERS
90 Jamie Hatfield jamie@genome.arizona.edu
91 Dr. Cari Soderlund cari@genome.arizona.edu
93 =head1 PROJECT DESCRIPTION
95 The project was done in Arizona Genomics Computational Laboratory (AGCoL)
96 at University of Arizona.
98 This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for
99 the Computation and Display of Physical Mapping Data".
101 For more information on this project, please refer:
102 http://www.genome.arizona.edu
106 The rest of the documentation details each of the object methods.
107 Internal methods are usually preceded with a _
111 # Let the code begin...
113 package Bio
::Map
::Contig
;
114 use vars
qw($MAPCOUNT);
117 # Object preamble - inherits from Bio::Root::Root
121 use base qw(Bio::Map::SimpleMap);
122 BEGIN { $MAPCOUNT = 1; }
127 Usage : my $clone = Bio::Map::Contig->new
130 -chr_remark => $cremark,
131 -user_remark => $uremark,
132 -trace_remark => $tremark,
134 -subgroup=> $subgroup,
136 -markers => \%markers,
139 -range => Bio::Range->new(-start =>$s,-end=>$e),
142 Function: Initialize a new Bio::Map::Contig object
143 Most people will not use this directly but get Markers
144 through L<Bio::MapIO::fpc>
145 Returns : L<Bio::Map::Contig> object
146 Args : ( -name => name string,
147 -chr_remark => chr remark string,
148 -user_remark => userremark string,
149 -trace_remark => tremark string,
150 -group => group string,
151 -subgroup=> subgroup string,
152 -anchor => boolean if this is anchored or not,
153 -markers => hashref of contained markers,
154 -clones => hashref of contained clones,
155 -position => position
156 -range => L<Bio::Range>
161 my ($class,@args) = @_;
162 my $self = $class->SUPER::new
(@args);
164 my ($name,$cremark,$uremark,$tremark,
165 $group,$subgroup, $anchor,$markers, $clones,
166 $position,$range) = $self->_rearrange([qw(NAME CHR_REMARK USER_REMARK
167 TRACE_REMARK GROUP SUBGROUP
168 ANCHOR MARKERS CLONES
169 POSITION RANGE)],@args);
171 $self->name($name) if defined $name;
172 $self->chr_remark($cremark) if defined $cremark;
173 $self->user_remark($uremark) if defined $uremark;
174 $self->trace_remark($tremark) if defined $tremark;
175 $self->group($group) if defined $group;
176 $self->subgroup($group) if defined $subgroup;
177 $self->anchor($anchor) if defined $anchor;
179 $self->set_markers($markers) if defined $markers;
180 $self->set_clones($clones) if defined $clones;
181 $self->range($range) if defined $range;
182 $self->position($position) if defined $position;
187 =head2 Modifier methods
189 All methods present in L<Bio::Map::SimpleMap> are implemented by this class.
190 Most of the methods are inherited from SimpleMap. The following methods
191 have been modified to reflect the needs of physical maps.
196 Usage : my $chrremark = $contigobj->chr_remark();
197 Function: Get/set the group remark for this contig
198 Returns : scalar representing the current group_remark of this contig
199 Args : none to get, OR string to set
205 $self->{'_cremark'} = shift if @_;
206 return defined $self->{'_cremark'} ?
$self->{'_cremark'} : '';
212 Usage : my $userremark = $contigobj->user_remark();
213 Function: Get/set the user remark for this contig
214 Returns : scalar representing the current user_remark of this contig
215 Args : none to get, OR string to set
221 $self->{'_uremark'} = shift if @_;
222 return defined $self->{'_uremark'} ?
$self->{'_uremark'} : '';
228 Usage : my $traceremark = $contigobj->trace_remark();
229 Function: Get/set the trace remark for this contig
230 Returns : scalar representing the current trace_remark of this contig
231 Args : none to get, OR string to set
237 $self->{'_tremark'} = shift if @_;
238 return defined $self->{'_tremark'} ?
$self->{'_tremark'} : '';
244 Usage : my $range = $contigobj->range();
245 Function: Get/set the range for this Contig
246 Returns : Bio::Range representing the current range of this contig,
247 start and end of the contig can be thus found using:
248 my $start = $contigobj->range()->start();
249 my $end = $contigobj->range()->end();
250 Args : none to get, OR Bio::Range to set
256 return $self->{'_range'} = shift if @_;
257 return $self->{'_range'};
263 Usage : $ctgpos = $contigobj->position();
264 Function: Get/set the position of the contig in the group
265 Returns : scalar representing the position of the contig in the group
266 Args : none to get, OR string to set
272 $self->{'_position'} = shift if @_;
273 return $self->{'_position'} || 0;
279 Usage : $ctganchor = $contig->anchor();
280 Function: Get/set the anchor value for this Contig (True | False)
281 Returns : scalar representing the anchor (1 | 0) for this contig
282 Args : none to get, OR string to set
288 return $self->{'_anchor'} = shift if @_;
289 return $self->{'_anchor'};
295 Usage : $groupno = $contigobj->group();
296 Function: Get/set the group number for this contig.
297 This is a generic term, used for Linkage-Groups as well as for
299 Returns : scalar representing the group number of this contig
306 $self->{'_group'} = shift if @_;
307 return $self->{'_group'} || 0;
313 Usage : $subgroup = $contig->subgroup();
314 Function: Get/set the subgroup for this contig. This is a generic term:
315 subgroup here could represent subgroup of a Chromosome or of a
316 Linkage Group. The user must take care of which subgroup he/she is
318 Returns : A scalar representing the subgroup of this contig
325 return $self->{'_subgroup'} = shift if @_;
326 return $self->{'_subgroup'} || 0;
332 Usage : my @clones = $map->each_cloneid();
333 Function: retrieves all the clone ids in a map unordered
334 Returns : list of strings (ids)
337 *** This only supplies the ids set with the set_clones method ***
338 *** It has nothing to do with actual Bio::Map::MappableI objects ***
344 return $self->_each_element('clones');
349 Title : each_markerid
350 Usage : my @markers = $map->each_markerid();
351 Function: retrieves all the marker ids in a map unordered
352 Returns : list of strings (ids)
355 *** This only supplies the ids set with the set_markers method ***
356 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
362 return $self->_each_element('markers');
366 my ($self, $type) = @_;
367 $type = 'clones' if (!defined($type));
368 $type = lc("_$type");
369 return keys %{$self->{$type} || {}};
375 Usage : $marker->set_clones(\%clones)
376 Function: Set the clones hashref
378 Args : Hashref of clone ids
380 *** This only sets a hash of ids ***
381 *** It has nothing to do with actual Bio::Map::MappableI objects ***
386 my ($self,$clones) = @_;
387 if( defined $clones && ref($clones) =~ /HASH/ ) {
388 $self->{'_clones'} = $clones;
395 Usage : $obj->set_markers($newval)
396 Function: Set list of Markers (hashref)
398 Args : Hashref of marker ids
400 *** This only sets a hash of ids ***
401 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
406 my ($self,$markers) = @_;
407 if( defined $markers && ref($markers) =~ /HASH/ ) {
408 $self->{'_markers'} = $markers;