EnsEMBL/ChainedAssemblyMapper.pm untested

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