ProjectionSegment.pm 2.43 KB
Newer Older
1
=head1 LICENSE
2

3
  Copyright (c) 1999-2013 The European Bioinformatics Institute and
4
  Genome Research Limited.  All rights reserved.
5

6 7
  This software is distributed under a modified Apache license.
  For license details, please see
8

9
    http://www.ensembl.org/info/about/code_licence.html
10

11
=head1 CONTACT
12

13
  Please email comments or questions to the public Ensembl
14
  developers list at <dev@ensembl.org>.
15

16 17
  Questions may also be sent to the Ensembl help desk at
  <helpdesk@ensembl.org>.
18

19
=cut
20

21
=head1 NAME
22

23 24
Bio::EnsEMBL::ProjectionSegment - part of the list that is returned from
project function calls
25

26
=head1 SYNOPSIS
27

28 29
  $slice =
    $sa->fetch_by_region( 'chromosome', 'X', 1_000_000, 2_000_000 );
30

31
  my $projection = $slice->project("clone");
32

33 34 35 36 37 38
  foreach my $projection_segment (@$projection) {
    print( "  from_start ", $projection_segment->from_start(), "\n" );
    print( "  from_end   ", $projection_segment->from_end(),   "\n" );
    print( "  to_Slice   ",
      $projection_segment->to_Slice()->name(), "\n" );
  }
39

40
=head1 DESCRIPTION
41

42 43 44 45
The ProjectionSegment is a helper object to make the arrays returned by
project more accessible. Instead of writing $segment->[0], $segment->[1]
or $segment->[2] its possible to use the more descriptive notation of
$segment->from_start(), $segement->from_end(), $segment->to_Slice().
46 47 48 49 50 51 52

=head1 METHODS

=cut

package Bio::EnsEMBL::ProjectionSegment;

53 54 55
use strict;
use warnings;

56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
#
# WARNING: THIS CLASS IS REPRESENTED BY A BLESSED ARRAY REFERENCE
#  NOT A HASH REFERENCE
#





=head2 from_start

  Args       : none
  Example    : $coord_in_fetaure_start = $segment->from_start()
  Description: First element in projects returned segment lists
  Returntype : int
  Exceptions : none
  Caller     : general
73
  Status     : Stable
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91

=cut

sub from_start {
  my $self = shift;
  return $self->[0];
}



=head2 from_end

  Args       : none
  Example    : $coord_in_feature_end = $segment->from_end()
  Description: Second element in projects returned segment lists
  Returntype : int
  Exceptions : none
  Caller     : general
92
  Status     : Stable
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111

=cut

sub from_end {
  my $self = shift;
  return $self->[1];
}




=head2 to_Slice

  Args       : none
  Example    : $target_slice = $segment->to_Slice()
  Description: Third element in projects returned segment lists
  Returntype : Bio::EnsEMBL::Slice
  Exceptions : none
  Caller     : general
112
  Status     : Stable
113 114 115 116 117 118 119 120 121 122 123

=cut

sub to_Slice {
  my $self = shift;
  return $self->[2];
}



1;