ensembl-hive  2.8.1
CircularSlice.pm
Go to the documentation of this file.
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::CircularSlice - Arbitary Slice of a genome
34 
35 =head1 SYNOPSIS
36 
37  $sa = $db->get_SliceAdaptor;
38 
39  $slice =
40  $sa->fetch_by_region( 'chromosome', 'X', 1_000_000, 2_000_000 );
41 
42  # get some attributes of the slice
43  my $seqname = $slice->seq_region_name();
44  my $start = $slice->start();
45  my $end = $slice->end();
46 
47  # get the sequence from the slice
48  my $seq = $slice->seq();
49 
50  # get some features from the slice
51  foreach $gene ( @{ $slice->get_all_Genes } ) {
52  # do something with a gene
53  }
54 
55  foreach my $feature ( @{ $slice->get_all_DnaAlignFeatures } ) {
56  # do something with dna-dna alignments
57  }
58 
59 =head1 DESCRIPTION
60 
61 A Slice object represents a region of a genome. It can be used to
62 retrieve sequence or features from an area of interest.
63 
64 =head1 METHODS
65 
66 =cut
67 
68 package Bio::EnsEMBL::CircularSlice;
69 
70 use vars qw(@ISA);
71 use strict;
72 
73 use Bio::PrimarySeqI;
74 
75 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
77  qw(throw warning);
79 use Bio::EnsEMBL::Utils::Sequence qw(reverse_comp);
80 use Bio::EnsEMBL::Utils::Scalar qw( assert_ref );
84 
85 #use Bio::EnsEMBL::IndividualSlice;
86 #use Bio::EnsEMBL::IndividualSliceFactory;
89 use Data::Dumper;
90 use Scalar::Util qw(weaken isweak);
91 
92 my $reg = "Bio::EnsEMBL::Registry";
93 
94 @ISA = qw(Bio::EnsEMBL::Slice);
95 
96 =head2 new
97 
98  Arg [...] : List of named arguments
99  Bio::EnsEMBL::CoordSystem COORD_SYSTEM
100  string SEQ_REGION_NAME,
101  int START,
102  int END,
103  int SEQ_REGION_LENGTH, (optional)
104  string SEQ (optional)
105  int STRAND, (optional, defaults to 1)
106  Bio::EnsEMBL::DBSQL::SliceAdaptor ADAPTOR (optional)
107  Example :
108 
109  $slice =
110  Bio::EnsEMBL::CircularSlice->new( -coord_system => $cs,
111  -start => 1,
112  -end => 10000,
113  -strand => 1,
114  -seq_region_name => 'X',
115  -seq_region_length => 12e6,
116  -adaptor => $slice_adaptor );
117 
118  Description: Creates a new slice object. A slice represents a
119  region of sequence in a particular coordinate system.
120  Slices can be used to retrieve sequence and features
121  from an area of interest in a genome.
122 
123  Coordinates start at 1 and are inclusive. Negative
124  coordinates or coordinates exceeding the length of
125  the seq_region are permitted. Start must be less
126  than or equal. to end regardless of the strand.
127 
128  Slice objects are immutable. Once instantiated their
129  attributes (with the exception of the adaptor) may
130  not be altered. To change the attributes a new slice
131  must be created.
132 
133  Returntype : Bio::EnsEMBL::CircularSlice
134  Exceptions : throws if start, end, coordsystem or seq_region_name not
135  specified or not of the correct type
136  Caller : general, Bio::EnsEMBL::SliceAdaptor
137  Status : Stable
138 
139 =cut
140 
141 sub new {
142  my $caller = shift;
143 
144  #new can be called as a class or object method
145  my $class = ref($caller) || $caller;
146 
147  my ( $seq, $coord_system, $seq_region_name, $seq_region_length,
148  $start, $end, $strand, $adaptor, $empty )
149  = rearrange( [
150  qw(SEQ COORD_SYSTEM SEQ_REGION_NAME SEQ_REGION_LENGTH
151  START END STRAND ADAPTOR EMPTY) ],
152  @_ );
153 
154  if ( !defined($seq_region_name) ) {
155  throw('SEQ_REGION_NAME argument is required');
156  }
157  if ( !defined($start) ) { throw('START argument is required') }
158  if ( !defined($end) ) { throw('END argument is required') }
159 
160  if ( !defined($seq_region_length) ) { $seq_region_length = $end }
161 
162  if ( $seq_region_length <= 0 ) {
163  throw('SEQ_REGION_LENGTH must be > 0');
164  }
165 
166  if ( defined($coord_system) ) {
167  assert_ref( $coord_system, 'Bio::EnsEMBL::CoordSystem' );
168 
169  if ( $coord_system->is_top_level() ) {
170  throw('Cannot create circular slice on toplevel CoordSystem.');
171  }
172  } else {
173  warning("CircularSlice without coordinate system");
174  }
175 
176  $strand ||= 1;
177 
178  if ( $strand != 1 && $strand != -1 ) {
179  throw('STRAND argument must be -1 or 1');
180  }
181 
182  if ( defined($adaptor) ) {
183  assert_ref( $adaptor, 'Bio::EnsEMBL::DBSQL::SliceAdaptor' );
184  }
185 
186  my $seq1 = { 'coord_system' => $coord_system,
187  'seq' => $seq,
188  'seq_region_name' => $seq_region_name,
189  'seq_region_length' => $seq_region_length,
190  'start' => int($start),
191  'end' => int($end),
192  'strand' => $strand };
193 
194  bless $seq1, $class;
195  $seq1->adaptor($adaptor);
196  return $seq1;
197 } ## end sub new
198 
199 
200 =head2 centrepoint
201 
202  Arg [1] : none
203  Example : $cp = $slice->centrepoint();
204  Description: Returns the mid position of this slice relative to the
205  start of the sequence region that it was created on.
206  Coordinates are inclusive and start at 1.
207  Returntype : int
208  Exceptions : none
209  Caller : general
210  Status : Stable
211 
212 =cut
213 
214 sub centrepoint {
215  my $self = shift;
216 
217  my ( $s, $e, $length ) =
218  ( $self->{'start'}, $self->{'end'}, $self->{'seq_region_length'} );
219 
220  if ( $s < $e ) {
221  return ( $s + $e )/2;
222  }
223 
224  my $r1 = $length - $s;
225  my $r2 = $e;
226  my $r = ( $r1 + $r2 )/2;
227  my $m = $s + $r;
228 
229  if ( $m > $length ) {
230  $m = $m - $length;
231  }
232 
233  return $m;
234 }
235 
236 =head2 length
237 
238  Arg [1] : none
239  Example : $length = $slice->length();
240  Description: Returns the length of this slice in basepairs
241  Returntype : int
242  Exceptions : none
243  Caller : general
244  Status : Stable
245 
246 =cut
247 
248 sub length {
249  my ($self) = @_;
250 
251  if ( $self->{'start'} < $self->{'end'} ) {
252  return $self->{'end'} - $self->{'start'} + 1;
253  }
254 
255  my $r1 = $self->{'seq_region_length'} - $self->{'start'};
256  my $r2 = $self->{'end'};
257  my $ln = $r1 + $r2 + 1;
258 
259  return $ln;
260 }
261 
262 sub _split {
263  my $self = shift;
264 
265  my $sl1 =
267  -COORD_SYSTEM => $self->{'coord_system'},
268  -SEQ_REGION_NAME => $self->{'seq_region_name'},
269  -SEQ_REGION_LENGTH => $self->{'seq_region_length'},
270  -START => $self->{'start'},
271  -END => $self->{'seq_region_length'},
272  -STRAND => $self->{'strand'},
273  -ADAPTOR => $self->adaptor() );
274 
275  my $sl2 =
277  -COORD_SYSTEM => $self->{'coord_system'},
278  -SEQ_REGION_NAME => $self->{'seq_region_name'},
279  -SEQ_REGION_LENGTH => $self->{'seq_region_length'},
280  -START => 1,
281  -END => $self->{'end'},
282  -STRAND => $self->{'strand'},
283  -ADAPTOR => $self->adaptor() );
284 
285  return ($sl1, $sl2);
286 }
287 
288 =head2 seq
289 
290  Arg [1] : none
291  Example : print "SEQUENCE = ", $slice->seq();
292  Description: Returns the sequence of the region represented by this
293  slice formatted as a string.
294  Returntype : string
295  Exceptions : none
296  Caller : general
297  Status : Stable
298 
299 =cut
300 
301 sub seq {
302  my $self = shift;
303 
304  # special case for in-between (insert) coordinates
305  return '' if ( $self->start() == $self->end() + 1 );
306  return $self->{'seq'} if ( $self->{'seq'} );
307 
308  if ( $self->adaptor() ) {
309 
310  my $seqAdaptor = $self->adaptor()->db()->get_SequenceAdaptor();
311  if ( $self->{'start'} > $self->{'end'} ) {
312  my $length = $self->{'seq_region_length'};
313 
314  my ($sl1, $sl2) = $self->_split;
315 
316  my $seq1 = ${
317  $seqAdaptor->fetch_by_Slice_start_end_strand( $sl1, 1, $sl1->end - $sl1->start + 1, $sl1->strand) };
318 
319  my $seq2 = ${
320  $seqAdaptor->fetch_by_Slice_start_end_strand( $sl2, 1, $sl2->end - $sl2->start + 1, $sl2->strand) };
321 
322  return $seq1 . $seq2;
323 
324  } else {
325  my $seq1 = ${
326  $seqAdaptor->fetch_by_Slice_start_end_strand( $self, 1, undef,
327  1 ) };
328  return $seq1;
329  }
330  } ## end if ( $self->adaptor() )
331 
332  # no attached sequence, and no db, so just return Ns
333  return 'N' x $self->length();
334 } ## end sub seq
335 
336 =head2 subseq
337 
338  Arg [1] : int $startBasePair
339  relative to start of slice, which is 1.
340  Arg [2] : int $endBasePair
341  relative to start of slice.
342  Arg [3] : (optional) int $strand
343  The strand of the slice to obtain sequence from. Default
344  value is 1.
345  Description: returns string of dna sequence
346  Returntype : txt
347  Exceptions : end should be at least as big as start
348  strand must be set
349  Caller : general
350  Status : Stable
351 
352 =cut
353 
354 sub subseq {
355  my ( $self, $start, $end, $strand ) = @_;
356 
357  # handle 'between' case for insertions
358  return '' if ( $start == $end + 1 );
359 
360  $strand = 1 unless ( defined $strand );
361 
362  if ( $strand != -1 && $strand != 1 ) {
363  throw("Invalid strand [$strand] in call to Slice::subseq.");
364  }
365  my $subseq;
366  my $length = $self->{'seq_region_length'};
367 
368  if ( $self->adaptor ) {
369 
370  my $seqAdaptor = $self->adaptor->db->get_SequenceAdaptor();
371  if ( $end < $start ) {
372  my $subseq1 = ${
373  $seqAdaptor->fetch_by_Slice_start_end_strand( $self, $start,
374  $length, $strand )
375  };
376  my $subseq2 = ${
377  $seqAdaptor->fetch_by_Slice_start_end_strand( $self, 1, $end,
378  $strand ) };
379  $subseq = $subseq1 . $subseq2;
380 
381  } else {
382  $subseq = ${
383  $seqAdaptor->fetch_by_Slice_start_end_strand( $self, $start,
384  $end, $strand ) };
385  }
386  } else {
387  ## check for gap at the beginning and pad it with Ns
388  if ( $start < 1 ) {
389  $subseq = "N" x ( 1 - $start );
390  $start = 1;
391  }
392  $subseq .= substr( $self->seq(), $start - 1, $end - $start + 1 );
393  ## check for gap at the end and pad it with Ns
394  if ( $end > $self->length() ) {
395  $subseq .= "N" x ( $end - $self->length() );
396  }
397  reverse_comp( \$subseq ) if ( $strand == -1 );
398  }
399  return $subseq;
400 } ## end sub subseq
401 
402 
403 
404 
405 =head2 expand
406 
407  Arg [1] : (optional) int $five_prime_expand
408  The number of basepairs to shift this slices five_prime
409  coordinate by. Positive values make the slice larger,
410  negative make the slice smaller.
411  coordinate left.
412  Default = 0.
413  Arg [2] : (optional) int $three_prime_expand
414  The number of basepairs to shift this slices three_prime
415  coordinate by. Positive values make the slice larger,
416  negative make the slice smaller.
417  Default = 0.
418  Arg [3] : (optional) bool $force_expand
419  if set to 1, then the slice will be contracted even in the case
420  when shifts $five_prime_expand and $three_prime_expand overlap.
421  In that case $five_prime_expand and $three_prime_expand will be set
422  to a maximum possible number and that will result in the slice
423  which would have only 2pbs.
424  Default = 0.
425  Arg [4] : (optional) int* $fpref
426  The reference to a number of basepairs to shift this slices five_prime
427  coordinate by. Normally it would be set to $five_prime_expand.
428  But in case when $five_prime_expand shift can not be applied and
429  $force_expand is set to 1, then $$fpref will contain the maximum possible
430  shift
431  Arg [5] : (optional) int* $tpref
432  The reference to a number of basepairs to shift this slices three_prime
433  coordinate by. Normally it would be set to $three_prime_expand.
434  But in case when $five_prime_expand shift can not be applied and
435  $force_expand is set to 1, then $$tpref will contain the maximum possible
436  shift
437  Example : my $expanded_slice = $slice->expand( 1000, 1000);
438  my $contracted_slice = $slice->expand(-1000,-1000);
439  my $shifted_right_slice = $slice->expand(-1000, 1000);
440  my $shifted_left_slice = $slice->expand( 1000,-1000);
441  my $forced_contracted_slice = $slice->expand(-1000,-1000, 1, \$five_prime_shift, \$three_prime_shift);
442 
443  Description: Returns a slice which is a resized copy of this slice. The
444  start and end are moved outwards from the center of the slice
445  if positive values are provided and moved inwards if negative
446  values are provided. This slice remains unchanged. A slice
447  may not be contracted below 1bp but may grow to be arbitrarily
448  large.
449  Returntype : Bio::EnsEMBL::Slice
450  Exceptions : warning if an attempt is made to contract the slice below 1bp
451  Caller : general
452  Status : Stable
453 
454 =cut
455 
456 sub expand {
457  my $self = shift;
458  my $five_prime_shift = shift || 0;
459  my $three_prime_shift = shift || 0;
460  my $force_expand = shift || 0;
461  my $fpref = shift;
462  my $tpref = shift;
463 
464  if ( $self->{'seq'} ) {
465  warning(
466  "Cannot expand a slice which has a manually attached sequence ");
467  return undef;
468  }
469 
470  my $new_start;
471  my $new_end;
472  my $sshift = $five_prime_shift;
473  my $eshift = $three_prime_shift;
474 
475  if ( $self->{'strand'} != 1 ) {
476  $eshift = $five_prime_shift;
477  $sshift = $three_prime_shift;
478  }
479 
480  $new_start = $self->{'start'} - $sshift;
481  $new_end = $self->{'end'} + $eshift;
482 
483 # if($new_start > $new_end) {
484 # if ($force_expand) { # Apply max possible shift, if force_expand is set
485 # if ($sshift < 0) { # if we are contracting the slice from the start - move the start just before the end
486 # $new_start = $new_end - 1;
487 # $sshift = $self->{start} - $new_start;
488 # }
489 
490 # if($new_start > $new_end) { # if the slice still has a negative length - try to move the end
491 # if ($eshift < 0) {
492 # $new_end = $new_start + 1;
493 # $eshift = $new_end - $self->{end};
494 # }
495 # }
496 # return the values by which the primes were actually shifted
497 # $$tpref = $self->{strand} == 1 ? $eshift : $sshift;
498 # $$fpref = $self->{strand} == 1 ? $sshift : $eshift;
499 # }
500 # if($new_start > $new_end) {
501 # throw('Slice start cannot be greater than slice end');
502 # }
503 # }
504 
505  #fastest way to copy a slice is to do a shallow hash copy
506  my %new_slice = %$self;
507  $new_slice{'start'} = int($new_start);
508  $new_slice{'end'} = int($new_end);
509 
510  return bless \%new_slice, ref($self);
511 } ## end sub expand
512 
513 
514 
515 =head2 get_all_VariationFeatures
516 
517  Args : $filter [optional]
518  Description:returns all variation features on this slice. This function will only work
519  correctly if the variation database has been attached to the core database.
520  If $filter is "genotyped" return genotyped Snps only... (nice likkle hack);
521  ReturnType : listref of Bio::EnsEMBL::Variation::VariationFeature
522  Exceptions : none
523  Caller : contigview, snpview
524  Status : At Risk
525  : Variation database is under development.
526 
527 =cut
528 
529 sub get_all_VariationFeatures {
530  my $self = shift;
531  my $filter = shift;
532 
533  $filter ||= '';
534  if ( !$self->adaptor() ) {
535  warning('Cannot get variation features without attached adaptor');
536  return [];
537  }
538 
539  my $vf_adaptor =
541  -species => $self->adaptor()->db()->species,
542  -type => "VariationFeature" );
543  if ($vf_adaptor) {
544  if ( $filter eq 'genotyped' ) {
545  return $vf_adaptor->fetch_all_genotyped_by_Slice($self);
546  } else {
547  return $vf_adaptor->fetch_all_by_Slice($self);
548  }
549  } else {
550  warning( "Variation database must be attached to core database to "
551  . "retrieve variation information" );
552  return [];
553  }
554 }
555 
556 
557 
558 
559 =head2 get_all_genotyped_VariationFeatures
560 
561  Args : none
562  Description: returns all variation features on this slice that have been genotyped.
563  This function will only work correctly if the variation database has
564  been attached to the core database.
565  ReturnType : listref of Bio::EnsEMBL::Variation::VariationFeature
566  Exceptions : none
567  Caller : contigview, snpview, ldview
568  Status : At Risk
569  : Variation database is under development.
570 
571 =cut
572 
573 sub get_all_genotyped_VariationFeatures {
574  my $self = shift;
575  my $vfa;
576  if ( !$self->adaptor() ) {
577  warning('Cannot get variation features without attached adaptor');
578  return [];
579  }
580 
581  my $vf_adaptor =
583  -species => $self->adaptor()->db()->species,
584  -type => "VariationFeature" );
585 
586  if ($vf_adaptor) {
587  return $vf_adaptor->fetch_all_genotyped_by_Slice($self);
588  } else {
589  warning( "Variation database must be attached to core database to "
590  . "retrieve variation information" );
591  return [];
592  }
593 }
594 
595 
596 =head2 get_all_DASFeatures
597 
598  Arg [1] : none
599  Example : $features = $slice->get_all_DASFeatures;
600  Description: Retrieves a hash reference to a hash of DAS feature
601  sets, keyed by the DNS, NOTE the values of this hash
602  are an anonymous array containing:
603  (1) a pointer to an array of features;
604  (2) a pointer to the DAS stylesheet
605  Returntype : hashref of Bio::SeqFeatures
606  Exceptions : ?
607  Caller : webcode
608  Status : Stable
609 
610 =cut
611 sub get_all_DASFeatures {
612  my ( $self, $source_type ) = @_;
613 
614  if ( !$self->adaptor() ) {
615  warning("Cannot retrieve features without attached adaptor");
616  return [];
617  }
618 
619  my %genomic_features = map {
620  ( $_->adaptor->dsn =>
621  [ $_->fetch_all_Features( $self, $source_type ) ] )
622  } $self->adaptor()->db()->_each_DASFeatureFactory;
623  return \%genomic_features;
624 
625 }
626 
627 
628 =head2 project_to_slice
629 
630  Arg [1] : Slice to project to.
631  Example : my $chr_projection = $clone_slice->project_to_slice($chrom_slice);
632  foreach my $segment ( @$chr_projection ){
633  $chr_slice = $segment->to_Slice();
634  print $clone_slice->seq_region_name(). ':'. $segment->from_start(). '-'.
635  $segment->from_end(). ' -> '.$chr_slice->seq_region_name(). ':'. $chr_slice->start().
636  '-'.$chr_slice->end().
637  $chr_slice->strand(). " length: ".($chr_slice->end()-$chr_slice->start()+1). "\n";
638  }
639  Description: Projection of slice to another specific slice. Needed for where we have multiple mappings
640  and we want to state which one to project to.
641  Returntype : list reference of Bio::EnsEMBL::ProjectionSegment objects which
642  can also be used as [$start,$end,$slice] triplets.
643  Exceptions : none
644  Caller : none
645  Status : At Risk
646 
647 =cut
648 
649 sub project_to_slice {
650  my $self = shift;
651  my $to_slice = shift;
652 
653  throw('Slice argument is required') if ( !$to_slice );
654 
655  my $slice_adaptor = $self->adaptor();
656 
657  if ( !$slice_adaptor ) {
658  warning("Cannot project without attached adaptor.");
659  return [];
660  }
661 
662  my $mapper_aptr = $slice_adaptor->db->get_AssemblyMapperAdaptor();
663 
664  my $cs = $to_slice->coord_system();
665  my $slice_cs = $self->coord_system();
666 
667  my @projection;
668  my $current_start = 1;
669 
670  # decompose this slice into its symlinked components.
671  # this allows us to handle haplotypes and PARs
672  my $normal_slice_proj =
673  $slice_adaptor->fetch_normalized_slice_projection($self);
674  foreach my $segment (@$normal_slice_proj) {
675  my $normal_slice = $segment->[2];
676 
677  $slice_cs = $normal_slice->coord_system();
678 
679  my $asma = $self->adaptor->db->get_AssemblyMapperAdaptor();
680  my $asm_mapper = $asma->fetch_by_CoordSystems( $slice_cs, $cs );
681 
682  # perform the mapping between this slice and the requested system
683  my @coords;
684 
685  if ( defined $asm_mapper ) {
686  @coords = $asm_mapper->map( $normal_slice->seq_region_name(),
687  $normal_slice->start(),
688  $normal_slice->end(),
689  $normal_slice->strand(),
690  $slice_cs,
691  undef,
692  $to_slice );
693  } else {
694  $coords[0] =
695  Bio::EnsEMBL::Mapper::Gap->new( $normal_slice->start(),
696  $normal_slice->end() );
697  }
698 
699  #construct a projection from the mapping results and return it
700  foreach my $coord (@coords) {
701  my $coord_start = $coord->start();
702  my $coord_end = $coord->end();
703  my $length = $coord_end - $coord_start + 1;
704 
705  #skip gaps
706  if ( $coord->isa('Bio::EnsEMBL::Mapper::Coordinate') ) {
707  my $coord_cs = $coord->coord_system();
708 
709  # If the normalised projection just ended up mapping to the
710  # same coordinate system we were already in then we should just
711  # return the original region. This can happen for example, if we
712  # were on a PAR region on Y which refered to X and a projection to
713  # 'toplevel' was requested.
714  # if($coord_cs->equals($slice_cs)) {
715  # # trim off regions which are not defined
716  # return $self->_constrain_to_region();
717  # }
718 
719  #create slices for the mapped-to coord system
720  my $slice =
721  $slice_adaptor->fetch_by_seq_region_id( $coord->id(),
722  $coord_start, $coord_end, $coord->strand() );
723 
724  my $current_end = $current_start + $length - 1;
725 
726  push @projection,
727  bless( [ $current_start, $current_end, $slice ],
728  "Bio::EnsEMBL::ProjectionSegment" );
729  }
730 
731  $current_start += $length;
732  } ## end foreach my $coord (@coords)
733  } ## end foreach my $segment (@$normal_slice_proj)
734 
735 # delete the cache as we may want to map to different set next time and old
736 # results will be cached.
737 
738  $mapper_aptr->delete_cache;
739 
740  return \@projection;
741 } ## end sub project_to_slice
742 
743 #
744 # Bioperl Bio::PrimarySeqI methods:
745 #
746 
747 =head2 id
748 
749  Description: Included for Bio::PrimarySeqI interface compliance (0.7)
750 
751 =cut
752 
753 sub id { name(@_); }
754 
755 =head2 display_id
756 
757  Description: Included for Bio::PrimarySeqI interface compliance (1.2)
758 
759 =cut
760 
761 sub display_id { name(@_); }
762 
763 =head2 primary_id
764 
765  Description: Included for Bio::PrimarySeqI interface compliance (1.2)
766 
767 =cut
768 
769 sub primary_id { name(@_); }
770 
771 =head2 desc
772 
773 Description: Included for Bio::PrimarySeqI interface compliance (1.2)
774 
775 =cut
776 
777 sub desc {
778  return $_[0]->coord_system->name() . ' ' . $_[0]->seq_region_name();
779 }
780 
781 =head2 moltype
782 
783 Description: Included for Bio::PrimarySeqI interface compliance (0.7)
784 
785 =cut
786 
787 sub moltype { return 'dna'; }
788 
789 =head2 alphabet
790 
791  Description: Included for Bio::PrimarySeqI interface compliance (1.2)
792 
793 =cut
794 
795 sub alphabet { return 'dna'; }
796 
797 =head2 accession_number
798 
799  Description: Included for Bio::PrimarySeqI interface compliance (1.2)
800 
801 =cut
802 
803 sub accession_number { name(@_); }
804 
805 =head2 is_circular
806 
807  Description: Included for Bio::PrimarySeqI interface compliance (1.2)
808 
809 =cut
810 
811 sub is_circular {
812  my ($self) = @_;
813 
814  if ( !defined( $self->{'circular'} ) ) {
815  my @attrs =
816  grep { $_ } @{ $self->get_all_Attributes('circular_seq') };
817  $self->{'circular'} = @attrs ? 1 : 0;
818  }
819 
820  return $self->{'circular'};
821 }
822 
823 
824 1;
Bio::EnsEMBL::CircularSlice
Definition: CircularSlice.pm:48
Bio::EnsEMBL::CircularSlice::seq
public String seq()
Bio::EnsEMBL::Mapper::RangeRegistry
Definition: RangeRegistry.pm:51
Bio::EnsEMBL::ProjectionSegment
Definition: ProjectionSegment.pm:27
map
public map()
Bio::EnsEMBL::CircularSlice::new
public Bio::EnsEMBL::CircularSlice new()
Bio::EnsEMBL::Mapper::Gap::new
public Bio::EnsEMBL::Mapper::Gap new()
Bio::EnsEMBL::DBSQL::MergedAdaptor
Definition: MergedAdaptor.pm:36
Bio::EnsEMBL::Utils::Sequence
Definition: Sequence.pm:22
Bio::EnsEMBL::CoordSystem
Definition: CoordSystem.pm:40
Bio::EnsEMBL::DBSQL::SliceAdaptor
Definition: SliceAdaptor.pm:78
Bio::EnsEMBL::Slice
Definition: Slice.pm:50
Bio::EnsEMBL::Registry
Definition: Registry.pm:113
Bio::EnsEMBL::Slice::seq_region_name
public String seq_region_name()
Bio::EnsEMBL::Mapper::Gap::start
public Int start()
Bio::EnsEMBL::Utils::Scalar
Definition: Scalar.pm:66
Bio::EnsEMBL::RepeatMaskedSlice
Definition: RepeatMaskedSlice.pm:28
Bio::EnsEMBL::Mapper::Gap
Definition: Gap.pm:14
Bio::EnsEMBL::DBSQL::MergedAdaptor::new
public Bio::EnsEMBL::DBSQL::MergedAdaptor new()
Bio::EnsEMBL::Utils::Argument
Definition: Argument.pm:34
Bio::EnsEMBL::Utils::Exception
Definition: Exception.pm:68