EnsEMBL/ChainedAssemblyMapper.pm untested

filter: Statementstmt 0.0% 0 / 194 Branchbran 0.0% 0 / 46 Conditioncond 0.0% 0 / 21 Subroutinesub 0.0% 0 / 29 Podpod 0.0% 0 / 21 totaltotal 0.0% 0 / 311 CC 24 SCAR 38.2
CC
24
Cov
0%
map
132.0
list_ids
90.0
list_seq_regions
12.0
CRAP 45.8
1 =head1 LICENSE
2  
3 See the NOTICE file distributed with this work for additional information
4 regarding copyright ownership.
5  
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
9  
10 http://www.apache.org/licenses/LICENSE-2.0
11  
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17  
18 =cut
19  
20  
21 =head1 CONTACT
22  
23 Please email comments or questions to the public Ensembl
24 developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
25  
26 Questions may also be sent to the Ensembl help desk at
27 <http://www.ensembl.org/Help/Contact>.
28  
29 =cut
30  
31 =head1 NAME
32  
33 Bio::EnsEMBL::ChainedAssemblyMapper -
34 Handles mapping between two coordinate systems using the information
35 stored in the assembly table
36  
37 =head1 SYNOPSIS
38  
39 $db = Bio::EnsEMBL::DBSQL::DBAdaptor->new(...);
40 $asma = $db->get_AssemblyMapperAdaptor();
41 $csa = $db->get_CoordSystemAdaptor();
42  
43 my $chr_cs = $cs_adaptor->fetch_by_name( 'chromosome', 'NCBI33' );
44 my $cln_cs = $cs_adaptor->fetch_by_name('clone');
45  
46 $asm_mapper = $map_adaptor->fetch_by_CoordSystems( $cs1, $cs2 );
47  
48 # Map to contig coordinate system from chromosomal
49 @cln_coords =
50 $asm_mapper->map( 'X', 1_000_000, 2_000_000, 1, $chr_cs );
51  
52 # Map to chromosome coordinate system from contig
53 @chr_coords =
54 $asm_mapper->map( 'AL30421.1', 100, 10000, -1, $cln_cs );
55  
56 # List contig names for a region of chromsome
57 @cln_ids = $asm_mapper->list_ids( '13', 1_000_000, 1, $chr_cs );
58  
59 # List chromosome names for a contig region
60 @chr_ids =
61 $asm_mapper->list_ids( 'AL30421.1', 1, 1000, -1, $cln_cs );
62  
63 =head1 DESCRIPTION
64  
65 The ChainedAssemblyMapper is an extension of the regular AssemblyMapper
66 that allows for mappings between coordinate systems that require
67 multi-step mapping. For example if explicit mappings are defined
68 between the following coordinate systems,
69  
70 chromosome <-> contig
71 contig <-> clone
72  
73 the ChainedAssemblyMapper would be able to perform implicit mapping
74 between the chromosome and clone coordinate systems. This should be
75 transparent to the user of this module, and users should not even
76 realise that they are using a chained assembly mapper as opposed to a
77 normal assembly mapper.
78  
79 =head1 METHODS
80  
81 =cut
82  
83 package Bio::EnsEMBL::ChainedAssemblyMapper;
84 $Bio::EnsEMBL::ChainedAssemblyMapper::VERSION = '114.0.0_50'; # TRIAL
85 $Bio::EnsEMBL::ChainedAssemblyMapper::VERSION = '114.0.050';
86 use strict;
87 use warnings;
88 use integer; #use proper arithmetic bitshifts
89  
90 use Bio::EnsEMBL::Mapper;
91 use Bio::EnsEMBL::Mapper::RangeRegistry;
92 use Bio::EnsEMBL::Utils::Exception qw(throw);
93 use Scalar::Util qw(weaken);
94 use Bio::EnsEMBL::Utils::Scalar qw( check_ref);
95  
96 my $FIRST = 'first';
97 my $MIDDLE = 'middle';
98 my $LAST = 'last';
99  
100 #2^20 = approx 10^6
101 my $CHUNKFACTOR = 20;
102  
103 # max size of the pair cache in the mappers
104 my $DEFAULT_MAX_PAIR_COUNT = 6000;
105  
106 =head2 new
107  
108 Arg [1] : Bio::EnsEMBL::DBSQL::AssemblyMapperAdaptor
109 Arg [2] : Bio::EnsEMBL::CoordSystem $src_cs
110 Arg [3] : Bio::EnsEMBL::CoordSystem $int_cs
111 Arg [4] : Bio::EnsEMBL::CoordSystem $dst_cs
112 Example : Should use AssemblyMapperAdaptor->fetch_by_CoordSystems
113 Description: Creates a new AssemblyMapper
114 Returntype : Bio::EnsEMBL::DBSQL::AssemblyMapperAdaptor
115 Exceptions : thrown if wrong number of coord_systems are provided
116 Caller : AssemblyMapperAdaptor
117 Status : Stable
118  
119 =cut
120  
121 sub new {
122 my ($caller,$adaptor,@coord_systems) = @_;
123  
124 my $class = ref($caller) || $caller;
125  
126 my $self = {};
127 bless $self, $class;
128  
129 $self->adaptor($adaptor);
130  
131 if(@coord_systems != 3) {
132 throw('ChainedMapper can only map between 3 coordinate systems. ' .
133 scalar(@coord_systems) . ' were provided');
134 }
135  
136 $adaptor->cache_seq_ids_with_mult_assemblys();
137  
138 # Set the component, intermediate and assembled coordinate systems
139 $self->{'first_cs'} = $coord_systems[0];
140 $self->{'mid_cs'} = $coord_systems[1];
141 $self->{'last_cs'} = $coord_systems[2];
142  
143 #maps between first and intermediate coord systems
144 $self->{'first_mid_mapper'} = Bio::EnsEMBL::Mapper->new($FIRST, $MIDDLE);
145  
146 #maps between last and intermediate
147 $self->{'last_mid_mapper'} = Bio::EnsEMBL::Mapper->new($LAST, $MIDDLE);
148  
149 #mapper that is actually used and is loaded by the mappings generated
150 #by the other two mappers
151 $self->{'first_last_mapper'} = Bio::EnsEMBL::Mapper->new($FIRST, $LAST,
152 $coord_systems[0],
153 $coord_systems[2]);
154  
155 #need registries to keep track of what regions are registered in source
156 #and destination coordinate systems
157 $self->{'first_registry'} = Bio::EnsEMBL::Mapper::RangeRegistry->new();
158 $self->{'last_registry'} = Bio::EnsEMBL::Mapper::RangeRegistry->new();
159  
160 $self->{'max_pair_count'} = $DEFAULT_MAX_PAIR_COUNT;
161  
162 return $self;
163 }
164  
165  
166 =head2 max_pair_count
167  
168 Arg [1] : (optional) int $max_pair_count
169 Example : $mapper->max_pair_count(100000)
170 Description: Getter/Setter for the number of mapping pairs allowed in the
171 internal cache. This can be used to override the default value
172 (6000) to tune the performance and memory usage for certain
173 scenarios. Higher value = bigger cache, more memory used
174 Returntype : int
175 Exceptions : none
176 Caller : general
177 Status : Stable
178  
179 =cut
180  
181 sub max_pair_count {
182 my $self = shift;
183 $self->{'max_pair_count'} = shift if(@_);
184 return $self->{'max_pair_count'};
185 }
186  
187  
188  
189  
190 =head2 register_all
191  
192 Arg [1] : none
193 Example : $mapper->max_pair_count(10e6);
194 $mapper->register_all();
195 Description: Pre-registers all assembly information in this mapper. The
196 cache size should be set to a sufficiently large value
197 so that all of the information can be stored. This method
198 is useful when *a lot* of mapping will be done in regions
199 which are distributed around the genome. After registration
200 the mapper will consume a lot of memory but will not have to
201 perform any SQL and will be faster.
202 Returntype : none
203 Exceptions : none
204 Caller : specialised programs doing a lot of mapping
205 Status : Stable
206  
207 =cut
208  
209 sub register_all {
210 my $self = shift;
211 $self->adaptor->register_all_chained($self);
212 return;
213 }
214  
215  
216  
217  
218 sub flush {
219 my $self = shift;
220 $self->{'first_registry'}->flush();
221 $self->{'last_registry'}->flush();
222  
223 $self->{'first_mid_mapper'}->flush();
224 $self->{'last_mid_mapper'}->flush();
225 $self->{'first_last_mapper'}->flush();
226 }
227  
228 =head2 size
229  
230 Args : none
231 Example : $num_of_pairs = $mapper->size();
232 Description: return the number of pairs currently stored.
233 Returntype : int
234 Exceptions : none
235 Caller : general
236 Status : Stable
237  
238 =cut
239  
240 sub size {
241 my $self = shift;
242 return ( $self->{'first_last_mapper'}->{'pair_count'} +
243 $self->{'last_mid_mapper'}->{'pair_count'} +
244 $self->{'first_mid_mapper'}->{'pair_count'} );
245 }
246  
247  
248  
249 =head2 map
250  
251 Arg [1] : string $frm_seq_region
252 The name of the sequence region to transform FROM
253 Arg [2] : int $frm_start
254 The start of the region to transform FROM
255 Arg [3] : int $frm_end
256 The end of the region to transform FROM
257 Arg [4] : int $strand
258 The strand of the region to transform FROM
259 Arg [5] : Bio::EnsEMBL::CoordSystem
260 The coordinate system to transform FROM
261 Arg [6] : (optional) fastmap
262 Arg [7] : (optional) Bio::Ensembl::Slice
263 The slice to transform TO
264 Arg [8] : (optional) boolean
265 Whether to include the original coordinates or not
266 Example : @coords = $asm_mapper->map('X', 1_000_000, 2_000_000,
267 1, $chr_cs);
268 Description: Transforms coordinates from one coordinate system
269 to another.
270 Returntype : List of Bio::EnsEMBL::Mapper::Coordinate and/or
271 Bio::EnsEMBL::Mapper:Gap objects
272 Exceptions : thrown if the specified TO coordinat system is not one
273 of the coordinate systems associated with this assembly mapper
274 Caller : general
275 Status : Stable
276  
277 =cut
278  
279 sub map {
280 throw('Incorrect number of arguments.') if(@_ < 6);
281  
282 my ($self, $frm_seq_region_name, $frm_start,
283 $frm_end, $frm_strand, $frm_cs, $fastmap, $to_slice, $include_org_coord) = @_;
284  
285 my $mapper = $self->{'first_last_mapper'};
286 my $first_cs = $self->{'first_cs'};
287 my $last_cs = $self->{'last_cs'};
288  
289 my $is_insert = ($frm_end + 1 == $frm_start);
290  
291 my $frm;
292 my $registry;
293  
294 my @tmp;
295 push @tmp, $frm_seq_region_name;
296 my $seq_region_id = @{$self->adaptor()->seq_regions_to_ids($frm_cs, \@tmp)}[0];
297  
298 #speed critical section:
299 #try to do simple pointer equality comparisons of the coord system objects
300 #first since this is likely to work most of the time and is much faster
301 #than a function call
302  
303 if($frm_cs == $first_cs ||
304 ($frm_cs != $last_cs && $frm_cs->equals($first_cs))) {
305 $frm = $FIRST;
306 $registry = $self->{'first_registry'};
307 } elsif($frm_cs == $last_cs || $frm_cs->equals($last_cs)) {
308 $frm = $LAST;
309 $registry = $self->{'last_registry'};
310 } else {
311 throw("Coordinate system " . $frm_cs->name . " " . $frm_cs->version .
312 " is neither the first nor the last coordinate system " .
313 " of this ChainedAssemblyMapper");
314 }
315  
316 #the minimum area we want to register if registration is necessary is
317 #about 1MB. Break requested ranges into chunks of 1MB and then register
318 #this larger region if we have a registry miss.
319  
320 #use bitwise shift for fast and easy integer multiplication and division
321 my ($min_start, $min_end);
322  
323 if($is_insert) {
324 $min_start = (($frm_end >> $CHUNKFACTOR) << $CHUNKFACTOR);
325 $min_end = ((($frm_start >> $CHUNKFACTOR) + 1) << $CHUNKFACTOR) - 1 ;
326 } else {
327 $min_start = (($frm_start >> $CHUNKFACTOR) << $CHUNKFACTOR);
328 $min_end = ((($frm_end >> $CHUNKFACTOR) + 1) << $CHUNKFACTOR) - 1 ;
329 }
330  
331 #get a list of ranges in the requested region that have not been registered,
332 #and register them at the same
333  
334 my $ranges;
335  
336 if($is_insert) {
337 $ranges = $registry->check_and_register($seq_region_id, $frm_end,
338 $frm_start, $min_start, $min_end);
339 } else {
340 $ranges = $registry->check_and_register($seq_region_id, $frm_start,
341 $frm_end, $min_start, $min_end);
342 }
343  
344 if(defined($ranges)) {
345 if( $self->size() > $self->{'max_pair_count'} ) {
346 $self->flush();
347  
348 if($is_insert) {
349 $ranges = $registry->check_and_register
350 ($seq_region_id, $frm_end, $frm_start, $min_start, $min_end);
351 } else {
352 $ranges = $registry->check_and_register
353 ($seq_region_id, $frm_start, $frm_end, $min_start, $min_end);
354 }
355 }
356 $self->adaptor->register_chained($self,$frm,$seq_region_id,$ranges,$to_slice);
357 }
358  
359 if($fastmap) {
360 return $mapper->fastmap($seq_region_id, $frm_start, $frm_end,
361 $frm_strand, $frm);
362 }
363  
364 my @coords = $mapper->map_coordinates($seq_region_id, $frm_start, $frm_end,
365 $frm_strand, $frm, $include_org_coord);
366  
367 # decorate (org,)mapped coordinates with their corresponding region names
368 if ($include_org_coord) {
369 map {
370 check_ref($_, 'Bio::EnsEMBL::Mapper::Coordinate') && # exclude gap
371 $_->{original}->name($self->adaptor->seq_ids_to_regions([$_->{original}->id])->[0]) &&
372 $_->{mapped}->name($self->adaptor->seq_ids_to_regions([$_->{mapped}->id])->[0])
373 } @coords;
374 } else {
375 map {
376 check_ref($_, 'Bio::EnsEMBL::Mapper::Coordinate') && # exclude gap
377 $_->name($self->adaptor->seq_ids_to_regions([$_->id])->[0])
378 } @coords;
379 }
380  
381 return @coords;
382 }
383  
384  
385 sub fastmap {
386 my $self = shift;
387 return $self->map(@_,1);
388 }
389  
390  
391 =head2 list_ids
392  
393 Arg [1] : string $frm_seq_region
394 The name of the sequence region of interest
395 Arg [2] : int $frm_start
396 The start of the region of interest
397 Arg [3] : int $frm_end
398 The end of the region to transform of interest
399 Arg [5] : Bio::EnsEMBL::CoordSystem $frm_cs
400 The coordinate system to obtain overlapping ids of
401 Example : foreach $id ($asm_mapper->list_ids('X',1,1000,$chr_cs)) {...}
402 Description: Retrieves a list of overlapping seq_region internal identifiers
403 of another coordinate system. This is the same as the
404 list_seq_regions method but uses internal identfiers rather
405 than seq_region strings
406 Returntype : List of ints
407 Exceptions : none
408 Caller : general
409 Status : Stable
410  
411 =cut
412  
413  
414 sub list_ids {
415 throw('Incorrect number of arguments.') if(@_ != 5);
416 my($self, $frm_seq_region_name, $frm_start, $frm_end, $frm_cs) = @_;
417  
418 my $is_insert = ($frm_start == $frm_end + 1);
419  
420 #the minimum area we want to register if registration is necessary is
421 #about 1MB. Break requested ranges into chunks of 1MB and then register
422 #this larger region if we have a registry miss.
423  
424 #use bitwise shift for fast and easy integer multiplication and division
425 my ($min_start, $min_end);
426  
427 if($is_insert) {
428 $min_start = (($frm_end >> $CHUNKFACTOR) << $CHUNKFACTOR);
429 $min_end = ((($frm_start >> $CHUNKFACTOR) + 1) << $CHUNKFACTOR) - 1;
430 } else {
431 $min_start = (($frm_start >> $CHUNKFACTOR) << $CHUNKFACTOR);
432 $min_end = ((($frm_end >> $CHUNKFACTOR) + 1) << $CHUNKFACTOR) - 1;
433 }
434  
435 my @tmp;
436 push @tmp, $frm_seq_region_name;
437 my $seq_region_id = @{$self->adaptor()->seq_regions_to_ids($frm_cs, \@tmp)}[0];
438  
439 if($frm_cs->equals($self->{'first_cs'})) {
440 my $registry = $self->{'first_registry'};
441  
442 my $ranges;
443  
444  
445 if($is_insert) {
446 $ranges = $registry->check_and_register
447 ($seq_region_id, $frm_end, $frm_start, $min_start, $min_end);
448 } else {
449 $ranges = $registry->check_and_register
450 ($seq_region_id, $frm_start, $frm_end, $min_start, $min_end);
451 }
452  
453 if(defined($ranges)) {
454 $self->adaptor->register_chained($self,$FIRST,$seq_region_id,$ranges);
455 }
456  
457 return map {$_->to()->id()}
458 $self->first_last_mapper()->list_pairs($seq_region_id, $frm_start,
459 $frm_end, $FIRST);
460  
461 } elsif($frm_cs->equals($self->{'last_cs'})) {
462 my $registry = $self->{'last_registry'};
463  
464 my $ranges;
465 if($is_insert) {
466 $ranges = $registry->check_and_register
467 ($seq_region_id, $frm_end, $frm_start, $min_start, $min_end);
468 } else {
469 $ranges = $registry->check_and_register
470 ($seq_region_id, $frm_start, $frm_end, $min_start, $min_end);
471 }
472  
473 if(defined($ranges)) {
474 $self->adaptor->register_chained($self,$LAST,$seq_region_id,$ranges);
475 }
476  
477 return map {$_->from()->id()}
478 $self->first_last_mapper()->list_pairs($seq_region_id, $frm_start,
479 $frm_end, $LAST);
480 } else {
481 throw("Coordinate system " . $frm_cs->name . " " . $frm_cs->version .
482 " is neither the first nor the last coordinate system " .
483 " of this ChainedAssemblyMapper");
484 }
485 }
486  
487  
488 =head2 list_seq_regions
489  
490 Arg [1] : string $frm_seq_region
491 The name of the sequence region of interest
492 Arg [2] : int $frm_start
493 The start of the region of interest
494 Arg [3] : int $frm_end
495 The end of the region to transform of interest
496 Arg [5] : Bio::EnsEMBL::CoordSystem $frm_cs
497 The coordinate system to obtain overlapping ids of
498 Example : foreach $id ($asm_mapper->list_ids('X',1,1000,$ctg_cs)) {...}
499 Description: Retrieves a list of overlapping seq_region internal identifiers
500 of another coordinate system. This is the same as the
501 list_ids method but uses seq_region names rather internal ids
502 Returntype : List of strings
503 Exceptions : none
504 Caller : general
505 Status : Stable
506  
507 =cut
508  
509 sub list_seq_regions {
510 throw('Incorrect number of arguments.') if(@_ != 5);
511 my($self, $frm_seq_region, $frm_start, $frm_end, $frm_cs) = @_;
512  
513 #retrieve the seq_region names
514 my @seq_regs =
515 $self->list_ids($frm_seq_region,$frm_start,$frm_end,$frm_cs);
516  
517 #The seq_regions are from the 'to' coordinate system not the
518 #from coordinate system we used to obtain them
519 my $to_cs;
520 if($frm_cs->equals($self->first_CoordSystem())) {
521 $to_cs = $self->last_CoordSystem();
522 } else {
523 $to_cs = $self->first_CoordSystem();
524 }
525  
526 #convert them to names
527 return @{$self->adaptor()->seq_ids_to_regions(\@seq_regs)};
528 }
529  
530  
531  
532  
533  
534  
535 =head2 first_last_mapper
536  
537 Args : none
538 Example : $mapper = $cam->first_last_mapper();
539 Description: return the mapper.
540 Returntype : Bio::EnsEMBL::Mapper
541 Exceptions : none
542 Caller : internal
543 Status : Stable
544  
545 =cut
546  
547 sub first_last_mapper {
548 my $self = shift;
549 return $self->{'first_last_mapper'};
550 }
551  
552 =head2 first_middle_mapper
553  
554 Args : none
555 Example : $mapper = $cam->first_middle_mapper();
556 Description: return the mapper.
557 Returntype : Bio::EnsEMBL::Mapper
558 Exceptions : none
559 Caller : internal
560 Status : Stable
561  
562 =cut
563  
564  
565 sub first_middle_mapper {
566 my $self = shift;
567 return $self->{'first_mid_mapper'};
568 }
569  
570 =head2 last_middle_mapper
571  
572 Args : none
573 Example : $mapper = $cam->last_middle_mapper();
574 Description: return the mapper.
575 Returntype : Bio::EnsEMBL::Mapper
576 Exceptions : none
577 Caller : internal
578 Status : Stable
579  
580 =cut
581  
582 sub last_middle_mapper {
583 my $self = shift;
584 return $self->{'last_mid_mapper'};
585 }
586  
587  
588 =head2 first_CoordSystem
589  
590 Args : none
591 Example : $coordsys = $cam->first_CoordSystem();
592 Description: return the CoordSystem.
593 Returntype : Bio::EnsEMBL::CoordSystem
594 Exceptions : none
595 Caller : internal
596 Status : Stable
597  
598 =cut
599  
600 sub first_CoordSystem {
601 my $self = shift;
602 return $self->{'first_cs'};
603 }
604  
605  
606 =head2 middle_CoordSystem
607  
608 Args : none
609 Example : $coordsys = $cam->middle_CoordSystem();
610 Description: return the CoordSystem.
611 Returntype : Bio::EnsEMBL::CoordSystem
612 Exceptions : none
613 Caller : internal
614 Status : Stable
615  
616 =cut
617  
618 sub middle_CoordSystem {
619 my $self = shift;
620 return $self->{'mid_cs'};
621 }
622  
623 =head2 last_CoordSystem
624  
625 Args : none
626 Example : $coordsys = $cam->last_CoordSystem();
627 Description: return the CoordSystem.
628 Returntype : Bio::EnsEMBL::CoordSystem
629 Exceptions : none
630 Caller : internal
631 Status : Stable
632  
633 =cut
634  
635 sub last_CoordSystem {
636 my $self = shift;
637 return $self->{'last_cs'};
638 }
639  
640 =head2 first_registry
641  
642 Args : none
643 Example : $rr = $cam->first_registry();
644 Description: return the Registry.
645 Returntype : Bio::EnsEMBL::Mapper::RangeRegistry
646 Exceptions : none
647 Caller : internal
648 Status : Stable
649  
650 =cut
651  
652 sub first_registry {
653 my $self = shift;
654 return $self->{'first_registry'};
655 }
656  
657 =head2 last_registry
658  
659 Args : none
660 Example : $rr = $cam->last_registry();
661 Description: return the Registry.
662 Returntype : Bio::EnsEMBL::Mapper::RangeRegistry
663 Exceptions : none
664 Caller : internal
665 Status : Stable
666  
667 =cut
668  
669 sub last_registry {
670 my $self = shift;
671 return $self->{'last_registry'};
672 }
673  
674  
675 #
676 # Methods supplied to maintain polymorphism with AssemblyMapper there
677 # is no real assembled or component in the chained mapper, since the
678 # ordering is arbitrary and both ends might actually be assembled, but
679 # these methods provide convenient synonyms
680 #
681  
682 =head2 mapper
683  
684 Args : none
685 Example : $mapper = $cam->mapper();
686 Description: return the first_last_mapper.
687 Returntype : Bio::EnsEMBL::Mapper
688 Exceptions : none
689 Caller : internal
690 Status : Stable
691  
692 =cut
693  
694 sub mapper {
695 my $self = shift;
696 return $self->first_last_mapper();
697 }
698  
699 =head2 assembled_CoordSystem
700  
701 Args : none
702 Example : $coordsys = $cam->assembled_CoordSystem();
703 Description: return the first CoordSystem.
704 Returntype : Bio::EnsEMBL::CoordSystem
705 Exceptions : none
706 Caller : internal
707 Status : Stable
708  
709 =cut
710  
711  
712 sub assembled_CoordSystem {
713 my $self = shift;
714 return $self->{'first_cs'};
715 }
716  
717 =head2 component_CoordSystem
718  
719 Args : none
720 Example : $coordsys = $cam->component_CoordSystem();
721 Description: return the last CoordSystem.
722 Returntype : Bio::EnsEMBL::CoordSystem
723 Exceptions : none
724 Caller : internal
725 Status : Stable
726  
727 =cut
728  
729 sub component_CoordSystem {
730 my $self = shift;
731 return $self->{'last_cs'};
732 }
733  
734  
735 =head2 adaptor
736  
737 Arg [1] : Bio::EnsEMBL::DBSQL::AssemblyMapperAdaptor $adaptor
738 Description: get/set for this objects database adaptor
739 Returntype : Bio::EnsEMBL::DBSQL::AssemblyMapperAdaptor
740 Exceptions : none
741 Caller : general
742 Status : Stable
743  
744 =cut
745  
746 sub adaptor {
747 my $self = shift;
748 weaken($self->{'adaptor'} = shift) if(@_);
749 return $self->{'adaptor'};
750 }
751  
752  
753 1;