3 # BioPerl module for Bio::Map::Contig
5 # Cared for by Sendu Bala <bix@sendu.me.uk>
7 # Copyright Gaurav Gupta
9 # You may distribute this module under the same terms as perl itself
11 # POD documentation - main docs before the code
15 Bio::Map::Contig - A MapI implementation handling the contigs of a
16 Physical Map (such as FPC)
20 # get the contig object of $contig from the Bio::Map::Physical
21 my $ctgobj = $physical->get_contigobj($contig);
23 # acquire all the markers that lie in this contig
24 foreach my $marker ($ctgobj->each_markerid()) {
25 print " +++$marker\n";
28 # find the group of this contig
29 print "Group: ",$ctgobj->group(),"\n";
31 # find the range of this contig
32 print "RANGE: start:",$ctgobj->range()->start(),"\tend: ",
33 $ctgobj->range()->end(),"\n";
35 # find the position of this contig in $group (chromosome)
36 print "Position in Group $group"," = ",$ctgobj->position($group),"\n";
41 This is an implementation of Bio::Map::MapI. It handles the
42 essential storage of name, species, type, and units as well as in
43 memory representation of the elements of a map.
45 Bio::Map::Contig has been tailored to work for FPC physical maps, but
46 could probably be used for others as well (with the appropriate MapIO
53 User feedback is an integral part of the evolution of this and other
54 Bioperl modules. Send your comments and suggestions preferably to
55 the Bioperl mailing list. Your participation is much appreciated.
57 bioperl-l@bioperl.org - General discussion
58 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
62 Report bugs to the Bioperl bug tracking system to help us keep track
63 of the bugs and their resolution. Bug reports can be submitted via the
66 http://bugzilla.open-bio.org/
68 =head1 AUTHOR - Gaurav Gupta
70 Email gaurav@genome.arizona.edu
74 Sendu Bala bix@sendu.me.uk
76 =head1 PROJECT LEADERS
78 Jamie Hatfield jamie@genome.arizona.edu
79 Dr. Cari Soderlund cari@genome.arizona.edu
81 =head1 PROJECT DESCRIPTION
83 The project was done in Arizona Genomics Computational Laboratory (AGCoL)
84 at University of Arizona.
86 This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for
87 the Computation and Display of Physical Mapping Data".
89 For more information on this project, please refer:
90 http://www.genome.arizona.edu
94 The rest of the documentation details each of the object methods.
95 Internal methods are usually preceded with a _
99 # Let the code begin...
101 package Bio
::Map
::Contig
;
102 use vars
qw($MAPCOUNT);
105 # Object preamble - inherits from Bio::Root::Root
109 use base qw(Bio::Map::SimpleMap);
110 BEGIN { $MAPCOUNT = 1; }
115 Usage : my $clone = Bio::Map::Contig->new
118 -chr_remark => $cremark,
119 -user_remark => $uremark,
120 -trace_remark => $tremark,
122 -subgroup=> $subgroup,
124 -markers => \%markers,
127 -range => Bio::Range->new(-start =>$s,-end=>$e),
130 Function: Initialize a new Bio::Map::Contig object
131 Most people will not use this directly but get Markers
132 through L<Bio::MapIO::fpc>
133 Returns : L<Bio::Map::Contig> object
134 Args : ( -name => name string,
135 -chr_remark => chr remark string,
136 -user_remark => userremark string,
137 -trace_remark => tremark string,
138 -group => group string,
139 -subgroup=> subgroup string,
140 -anchor => boolean if this is anchored or not,
141 -markers => hashref of contained markers,
142 -clones => hashref of contained clones,
143 -position => position
144 -range => L<Bio::Range>
149 my ($class,@args) = @_;
150 my $self = $class->SUPER::new
(@args);
152 my ($name,$cremark,$uremark,$tremark,
153 $group,$subgroup, $anchor,$markers, $clones,
154 $position,$range) = $self->_rearrange([qw(NAME CHR_REMARK USER_REMARK
155 TRACE_REMARK GROUP SUBGROUP
156 ANCHOR MARKERS CLONES
157 POSITION RANGE)],@args);
159 $self->name($name) if defined $name;
160 $self->chr_remark($cremark) if defined $cremark;
161 $self->user_remark($uremark) if defined $uremark;
162 $self->trace_remark($tremark) if defined $tremark;
163 $self->group($group) if defined $group;
164 $self->subgroup($group) if defined $subgroup;
165 $self->anchor($anchor) if defined $anchor;
167 $self->set_markers($markers) if defined $markers;
168 $self->set_clones($clones) if defined $clones;
169 $self->range($range) if defined $range;
170 $self->position($position) if defined $position;
175 =head2 Modifier methods
177 All methods present in L<Bio::Map::SimpleMap> are implemented by this class.
178 Most of the methods are inherited from SimpleMap. The following methods
179 have been modified to reflect the needs of physical maps.
184 Usage : my $chrremark = $contigobj->chr_remark();
185 Function: Get/set the group remark for this contig
186 Returns : scalar representing the current group_remark of this contig
187 Args : none to get, OR string to set
193 $self->{'_cremark'} = shift if @_;
194 return defined $self->{'_cremark'} ?
$self->{'_cremark'} : '';
200 Usage : my $userremark = $contigobj->user_remark();
201 Function: Get/set the user remark for this contig
202 Returns : scalar representing the current user_remark of this contig
203 Args : none to get, OR string to set
209 $self->{'_uremark'} = shift if @_;
210 return defined $self->{'_uremark'} ?
$self->{'_uremark'} : '';
216 Usage : my $traceremark = $contigobj->trace_remark();
217 Function: Get/set the trace remark for this contig
218 Returns : scalar representing the current trace_remark of this contig
219 Args : none to get, OR string to set
225 $self->{'_tremark'} = shift if @_;
226 return defined $self->{'_tremark'} ?
$self->{'_tremark'} : '';
232 Usage : my $range = $contigobj->range();
233 Function: Get/set the range for this Contig
234 Returns : Bio::Range representing the current range of this contig,
235 start and end of the contig can be thus found using:
236 my $start = $contigobj->range()->start();
237 my $end = $contigobj->range()->end();
238 Args : none to get, OR Bio::Range to set
244 return $self->{'_range'} = shift if @_;
245 return $self->{'_range'};
251 Usage : $ctgpos = $contigobj->position();
252 Function: Get/set the position of the contig in the group
253 Returns : scalar representing the position of the contig in the group
254 Args : none to get, OR string to set
260 $self->{'_position'} = shift if @_;
261 return $self->{'_position'} || 0;
267 Usage : $ctganchor = $contig->anchor();
268 Function: Get/set the anchor value for this Contig (True | False)
269 Returns : scalar representing the anchor (1 | 0) for this contig
270 Args : none to get, OR string to set
276 return $self->{'_anchor'} = shift if @_;
277 return $self->{'_anchor'};
283 Usage : $groupno = $contigobj->group();
284 Function: Get/set the group number for this contig.
285 This is a generic term, used for Linkage-Groups as well as for
287 Returns : scalar representing the group number of this contig
294 $self->{'_group'} = shift if @_;
295 return $self->{'_group'} || 0;
301 Usage : $subgroup = $contig->subgroup();
302 Function: Get/set the subgroup for this contig. This is a generic term:
303 subgroup here could represent subgroup of a Chromosome or of a
304 Linkage Group. The user must take care of which subgroup he/she is
306 Returns : A scalar representing the subgroup of this contig
313 return $self->{'_subgroup'} = shift if @_;
314 return $self->{'_subgroup'} || 0;
320 Usage : my @clones = $map->each_cloneid();
321 Function: retrieves all the clone ids in a map unordered
322 Returns : list of strings (ids)
325 *** This only supplies the ids set with the set_clones method ***
326 *** It has nothing to do with actual Bio::Map::MappableI objects ***
332 return $self->_each_element('clones');
337 Title : each_markerid
338 Usage : my @markers = $map->each_markerid();
339 Function: retrieves all the marker ids in a map unordered
340 Returns : list of strings (ids)
343 *** This only supplies the ids set with the set_markers method ***
344 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
350 return $self->_each_element('markers');
354 my ($self, $type) = @_;
355 $type = 'clones' if (!defined($type));
356 $type = lc("_$type");
357 return keys %{$self->{$type} || {}};
363 Usage : $marker->set_clones(\%clones)
364 Function: Set the clones hashref
366 Args : Hashref of clone ids
368 *** This only sets a hash of ids ***
369 *** It has nothing to do with actual Bio::Map::MappableI objects ***
374 my ($self,$clones) = @_;
375 if( defined $clones && ref($clones) =~ /HASH/ ) {
376 $self->{'_clones'} = $clones;
383 Usage : $obj->set_markers($newval)
384 Function: Set list of Markers (hashref)
386 Args : Hashref of marker ids
388 *** This only sets a hash of ids ***
389 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
394 my ($self,$markers) = @_;
395 if( defined $markers && ref($markers) =~ /HASH/ ) {
396 $self->{'_markers'} = $markers;