~ubuntu-branches/ubuntu/oneiric/bioperl/oneiric

« back to all changes in this revision

Viewing changes to Bio/Map/Clone.pm

  • Committer: Bazaar Package Importer
  • Author(s): Charles Plessy
  • Date: 2007-09-21 22:52:22 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20070921225222-tt20m2yy6ycuy2d8
Tags: 1.5.2.102-1
* Developer release.
* Upgraded source package to debhelper 5 and standards-version 3.7.2.
* Added libmodule-build-perl and libtest-harness-perl to
  build-depends-indep.
* Disabled automatic CRAN download.
* Using quilt instead of .diff.gz to manage modifications.
* Updated Recommends list for the binary package.
* Moved the "production-quality" scripts to /usr/bin/.
* New maintainer: Debian-Med packaging team mailing list.
* New uploaders: Charles Plessy and Steffen Moeller.
* Updated Depends, Recommends and Suggests.
* Imported in Debian-Med's SVN repository on Alioth.
* Executing the regression tests during package building.
* Moved the Homepage: field out from the package's description.
* Updated watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: Clone.pm,v 1.6.4.1 2006/10/02 23:10:21 sendu Exp $
 
2
#
 
3
# BioPerl module for Bio::Map::clone
 
4
#
 
5
# Cared for by Sendu Bala <bix@sendu.me.uk>
 
6
#
 
7
# Copyright Gaurav Gupta
 
8
#
 
9
# You may distribute this module under the same terms as perl itself
 
10
 
 
11
# POD documentation - main docs before the code
 
12
 
 
13
=head1 NAME
 
14
 
 
15
Bio::Map::Clone - An central map object representing a clone
 
16
 
 
17
=head1 SYNOPSIS
 
18
 
 
19
   # get the clone object of $clone from the Bio::Map::Clone
 
20
   my $cloneobj = $physical->get_cloneobj($clone);
 
21
 
 
22
   # acquire all the markers that hit this clone
 
23
   foreach my $marker ($cloneobj->each_markerid()) {
 
24
       print "   +++$marker\n";
 
25
   }
 
26
 
 
27
See L<Bio::Map::Position> and L<Bio::Map::PositionI> for more information.
 
28
 
 
29
=head1 DESCRIPTION
 
30
 
 
31
This object handles the notion of a clone. This clone will
 
32
have a name and a position in a map.
 
33
 
 
34
This object is intended to be used by a map parser like fpc.pm.
 
35
 
 
36
=head1 FEEDBACK
 
37
 
 
38
=head2 Mailing Lists
 
39
 
 
40
User feedback is an integral part of the evolution of this and other
 
41
Bioperl modules. Send your comments and suggestions preferably to
 
42
the Bioperl mailing list.  Your participation is much appreciated.
 
43
 
 
44
  bioperl-l@bioperl.org                  - General discussion
 
45
  http://bioperl.org/wiki/Mailing_lists  - About the mailing lists
 
46
 
 
47
=head2 Reporting Bugs
 
48
 
 
49
Report bugs to the Bioperl bug tracking system to help us keep track
 
50
of the bugs and their resolution. Bug reports can be submitted via the
 
51
web:
 
52
 
 
53
  http://bugzilla.open-bio.org/
 
54
 
 
55
=head1 AUTHOR - Gaurav Gupta
 
56
 
 
57
Email gaurav@genome.arizona.edu
 
58
 
 
59
=head1 CONTRIBUTORS
 
60
 
 
61
Sendu Bala  bix@sendu.me.uk
 
62
 
 
63
=head1 PROJECT LEADERS
 
64
 
 
65
Jamie Hatfield      jamie@genome.arizona.edu
 
66
Dr. Cari Soderlund  cari@genome.arizona.edu
 
67
 
 
68
=head1 PROJECT DESCRIPTION
 
69
 
 
70
The project was done in Arizona Genomics Computational Laboratory (AGCoL)
 
71
at University of Arizona.
 
72
 
 
73
This work was funded by USDA-IFAFS grant #11180 titled "Web Resources for 
 
74
the Computation and Display of Physical Mapping Data".
 
75
 
 
76
For more information on this project, please refer: 
 
77
  http://www.genome.arizona.edu
 
78
 
 
79
=head1 APPENDIX
 
80
 
 
81
The rest of the documentation details each of the object methods.
 
82
Internal methods are usually preceded with a _
 
83
 
 
84
=cut 
 
85
 
 
86
# Let the code begin...
 
87
 
 
88
package Bio::Map::Clone;
 
89
use strict;
 
90
use Bio::Map::Position;
 
91
 
 
92
use base qw(Bio::Root::Root Bio::Map::MappableI);
 
93
 
 
94
=head2 new
 
95
 
 
96
 Title   : new
 
97
 Usage   : my $clone = Bio::Map::Clone->new
 
98
                      (
 
99
                       -name    => $clone,
 
100
                       -markers => \@markers,
 
101
                       -contig  => $contig,
 
102
                       -type    => $type,
 
103
                       -bands   => $bands,
 
104
                       -gel     => $gel,
 
105
                       -group   => $group,
 
106
                       -remark  => $remark,
 
107
                       -fpnumber=> $fp_number,
 
108
                       -sequencetype  => $seq_type,
 
109
                       -sequencestatus=> $seq_status,
 
110
                       -fpcremark => $fpc_remark,
 
111
                       -matche    => \@ematch,
 
112
                       -matcha    => \@amatch,
 
113
                       -matchp    => \@pmatch,
 
114
                       -range     => Bio::Range->new(-start => $startrange,
 
115
                                                     -end   => $endrange)
 
116
                       );
 
117
 Function: Initialize a new Bio::Map::Clone object
 
118
           Most people will not use this directly but get Clones 
 
119
           through L<Bio::MapIO::fpc>
 
120
 Returns : L<Bio::Map::Clone> object
 
121
 Args    :   -name => marker name string,
 
122
             -markers => array ref of markers,
 
123
             -contig  => contig name string,
 
124
             -type    => type string,
 
125
             -bands   => band string,
 
126
             -gel     => gel string,
 
127
             -group   => group name string,
 
128
             -remark  => remark string,
 
129
             -fpnumber=> FP number string,
 
130
             -sequencetype  => seq type string,
 
131
             -sequencestatus=> seq status string,
 
132
             -fpcremark => FPC remark,
 
133
             -matche    => array ref,
 
134
             -matcha    => array ref,
 
135
             -matchp    => array ref,
 
136
             -range     => L<Bio::Range> object,
 
137
 
 
138
=cut
 
139
 
 
140
sub new {
 
141
   my ($class,@args) = @_;
 
142
   my $self= $class->SUPER::new(@args);
 
143
   
 
144
   my ($name,$markers,$contig,$type,$bands,$gel,$group,
 
145
       $remark,$fpnumber,$seqtype,$seqstatus,$fpcremark,
 
146
       $matche,$matcha,$matchp,
 
147
       $range) = $self->_rearrange([qw(NAME  MARKERS CONTIG TYPE
 
148
                                       BANDS GEL GROUP REMARK FPNUMBER
 
149
                                       SEQUENCETYPE SEQUENCESTATUS
 
150
                                       FPCREMARK MATCHE MATCHA MATCHP
 
151
                                       RANGE)],@args);
 
152
 
 
153
   $self->name($name)                  if defined $name;
 
154
   $self->markers($markers)            if defined $markers;
 
155
   $self->contigid($contig)            if defined $contig;
 
156
   $self->type($type)                  if defined $type;
 
157
   $self->bands($bands)                if defined $bands;
 
158
   $self->gel($gel)                    if defined $gel;
 
159
   $self->group($group)                if defined $group;
 
160
   $self->remark($remark)              if defined $remark;
 
161
   $self->fp_number($fpnumber)         if defined $fpnumber;
 
162
   $self->sequence_type($seqtype)     if defined $seqtype;
 
163
   $self->sequence_status($seqstatus) if defined $seqstatus;
 
164
   $self->fpc_remark($fpcremark)       if defined $fpcremark;
 
165
   $self->range($range)                if defined $range;
 
166
 
 
167
   $self->set_match('approx', $matcha) if defined $matcha;
 
168
   $self->set_match('pseudo', $matchp) if defined $matchp;
 
169
   $self->set_match('exact',  $matche) if defined $matche; 
 
170
 
 
171
   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 = $cloneobj->name();
 
182
 Function: Get/set the name for this Clone
 
183
 Returns : scalar representing the current name of this clone
 
184
 Args    : none to get, OR string to set
 
185
 
 
186
=cut
 
187
 
 
188
sub name {
 
189
    my ($self) = shift;    
 
190
    return $self->{'_name'} = shift if @_;
 
191
    return $self->{'_name'};
 
192
}
 
193
 
 
194
=head2 type
 
195
 
 
196
 Title   : type
 
197
 Usage   : my $type = $cloneobj->type();
 
198
 Function: Get/set the type for this clone
 
199
 Returns : scalar representing the current type of this clone
 
200
 Args    : none to get, OR string to set
 
201
 
 
202
=cut
 
203
 
 
204
sub type {
 
205
    my ($self) = shift;
 
206
    return $self->{'_type'} = shift if @_;
 
207
    return $self->{'_type'};
 
208
}
 
209
 
 
210
=head2 range
 
211
 
 
212
 Title   : range
 
213
 Usage   : my $range = $cloneobj->range();
 
214
 Function: Get/set the range of the contig that this clone covers
 
215
 Returns : Bio::Range representing the current range of this contig,
 
216
           start and end of the contig can be thus found using:
 
217
           my $start = $contigobj->range()->start();
 
218
           my $end   = $contigobj->range()->end();
 
219
 Args    : none to get, OR Bio::Range to set
 
220
 
 
221
=cut
 
222
 
 
223
sub range {
 
224
    my ($self) = shift;    
 
225
    return $self->{'_range'} = shift if @_;
 
226
    return $self->{'_range'};
 
227
}
 
228
 
 
229
=head2 match
 
230
 
 
231
 Title   : match
 
232
 Usage   : @eclone = $cloneobj->match('exact');
 
233
           @aclone = $cloneobj->match('approximate');
 
234
           @pclone = $cloneobj->match('pseudo');
 
235
 Function: get all matching clones
 
236
 Returns : list 
 
237
 Args    : scalar representing the type of clone to be 
 
238
           queried.
 
239
 
 
240
=cut
 
241
 
 
242
sub match {
 
243
  my ($self,$type) = @_;
 
244
 
 
245
  $type = "_match" . lc(substr($type, 0, 1));
 
246
  return @{$self->{$type} || []};
 
247
}
 
248
 
 
249
=head2 each_match
 
250
 
 
251
 Title   : each_match
 
252
 Function: Synonym of the match() method.
 
253
 
 
254
=cut
 
255
 
 
256
*each_match = \&match;
 
257
 
 
258
=head2 set_match
 
259
 
 
260
 Title   : set_match
 
261
 Usage   : $clone->set_match($type,$values);
 
262
 Function: Set the Matches per type
 
263
 Returns : None
 
264
 Args    : type (one of 'exact' 'approx' 'pseudo')
 
265
           array ref of match values
 
266
 
 
267
=cut
 
268
 
 
269
sub set_match{
 
270
   my ($self,$type,$val) = @_;
 
271
   $type = "_match" . lc(substr($type, 0, 1));
 
272
   $self->{$type} = $val;
 
273
}
 
274
 
 
275
=head2 gel
 
276
 
 
277
 Title   : gel
 
278
 Usage   : $clonegel = $cloneobj->gel();
 
279
 Function: Get/set the gel number for this clone
 
280
 Returns : scalar representing the gel number of this clone
 
281
 Args    : none to get, OR string to set
 
282
 
 
283
=cut
 
284
 
 
285
sub gel {
 
286
    my ($self) = shift;
 
287
    return $self->{'_gel'} = shift if @_;
 
288
    return $self->{'_gel'};
 
289
}
 
290
 
 
291
=head2 remark
 
292
 
 
293
 Title   : remark
 
294
 Usage   : $cloneremark = $cloneobj->remark();
 
295
 Function: Get/set the remark for this clone
 
296
 Returns : scalar representing the current remark of this clone
 
297
 Args    : none to get, OR string to set
 
298
 
 
299
=cut
 
300
 
 
301
sub remark {
 
302
    my ($self) = shift;
 
303
    return $self->{'_remark'} = shift if @_;
 
304
    return $self->{'_remark'};
 
305
}
 
306
 
 
307
=head2 fp_number
 
308
 
 
309
 Title   : fp_number
 
310
 Usage   : $clonefpnumber = $cloneobj->fp_number();
 
311
 Function: Get/set the fp number for this clone
 
312
 Returns : scalar representing the fp number of this clone
 
313
 Args    : none to get, OR string to set
 
314
 
 
315
=cut
 
316
 
 
317
sub fp_number {
 
318
    my ($self) = shift;
 
319
    return $self->{'_fpnumber'} = shift if @_;
 
320
    return $self->{'_fpnumber'};
 
321
}
 
322
 
 
323
=head2 sequence_type
 
324
 
 
325
 Title   : sequence_type
 
326
 Usage   : $cloneseqtype = $cloneobj->sequence_type();
 
327
 Function: Get/set the sequence type for this clone
 
328
 Returns : scalar representing the sequence type of this clone
 
329
 Args    : none to get, OR string to set
 
330
 
 
331
=cut
 
332
 
 
333
sub sequence_type {
 
334
    my ($self) = shift;
 
335
    return $self->{'_sequencetype'} = shift if @_;
 
336
    return $self->{'_sequencetype'};
 
337
}
 
338
 
 
339
=head2 sequence_status
 
340
 
 
341
 Title   : sequence_status
 
342
 Usage   : $cloneseqstatus = $cloneobj->sequence_status();
 
343
 Function: Get/set the sequence status for this clone
 
344
 Returns : scalar representing the sequence status of this clone
 
345
 Args    : none to get, OR string to set
 
346
 
 
347
=cut
 
348
 
 
349
sub sequence_status {
 
350
    my ($self) = shift;
 
351
    return $self->{'_sequencestatus'} = shift if @_;
 
352
    return $self->{'_sequencestatus'};
 
353
}
 
354
 
 
355
=head2 fpc_remark
 
356
 
 
357
 Title   : fpc_remark
 
358
 Usage   : $clonefpcremark = $cloneobj->fpc_remark();
 
359
 Function: Get/set the fpc remark for this clone
 
360
 Returns : scalar representing the fpc remark of this clone
 
361
 Args    : none to get, OR string to set
 
362
 
 
363
=cut
 
364
 
 
365
sub fpc_remark {
 
366
    my ($self) = shift;
 
367
    return $self->{'_fpcremark'} = shift if @_;
 
368
    return $self->{'_fpcremark'};
 
369
}
 
370
 
 
371
=head2 band
 
372
 
 
373
 Title   : band
 
374
 Usage   : @clonebands = $cloneobj->bands();
 
375
 Function: Get/set the bands for this clone
 
376
 Returns : liat representing the band of this clone, if 
 
377
           readcor = 1 while creating the MapIO object and the
 
378
           .cor exists
 
379
 Args    : none to get, OR string to set
 
380
 
 
381
=cut
 
382
 
 
383
sub bands {
 
384
    my ($self) = shift; 
 
385
    return $self->{'_bands'} = shift if @_;
 
386
    return $self->{'_bands'};
 
387
}
 
388
 
 
389
=head2 group
 
390
 
 
391
 Title   : group
 
392
 Usage   : $cloneobj->group($chrno);
 
393
 Function: Get/set the group number for this clone.
 
394
           This is a generic term, used for Linkage-Groups as well as for
 
395
           Chromosomes.
 
396
 Returns : scalar representing the group number of this clone
 
397
 Args    : none to get, OR string to set
 
398
 
 
399
=cut
 
400
 
 
401
sub group {
 
402
    my ($self) = shift;
 
403
    return $self->{'_group'} = shift if @_;    
 
404
    return $self->{'_group'};
 
405
}
 
406
 
 
407
=head2 contigid
 
408
 
 
409
 Title   : contigid
 
410
 Usage   : my $ctg = $cloneobj->contigid();
 
411
 Function: Get/set the contig this clone belongs to
 
412
 Returns : scalar representing the contig
 
413
 Args    : none to get, OR string to set
 
414
 
 
415
=cut
 
416
 
 
417
sub contigid {
 
418
    my ($self) = shift;
 
419
    $self->{'_contig'} = shift if @_;
 
420
    return $self->{'_contig'} || 0;
 
421
}
 
422
 
 
423
=head2 each_markerid
 
424
 
 
425
 Title   : each_markerid
 
426
 Usage   : @markers = $cloneobj->each_markerid();
 
427
 Function: retrieves all the elements in a map unordered
 
428
 Returns : list of strings (ids)
 
429
 Args    : none
 
430
 
 
431
 *** This only supplies the ids set with the set_markers method ***
 
432
 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
 
433
 
 
434
=cut
 
435
 
 
436
sub each_markerid {
 
437
  my ($self,$value) = @_;   
 
438
  return @{$self->{"_markers"}};
 
439
}
 
440
 
 
441
=head2 set_markers
 
442
 
 
443
 Title   : markers
 
444
 Usage   : $obj->set_markers($newval)
 
445
 Function: Set list of Marker ids (arrayref)
 
446
 Returns : None
 
447
 Args    : arrayref of strings (ids)
 
448
 
 
449
 *** This only sets a list of ids ***
 
450
 *** It has nothing to do with actual Bio::Map::MarkerI objects ***
 
451
 
 
452
=cut
 
453
 
 
454
sub set_markers {
 
455
    my ($self,$markers) = @_;
 
456
    if( defined $markers && ref($markers) =~ /ARRAY/ ) { 
 
457
        $self->{'_markers'} = $markers;
 
458
    }
 
459
}
 
460
 
 
461
1;
 
 
b'\\ No newline at end of file'