| 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::ProjectionSegment - part of the list that is returned from | ||
| 34 | project function calls | ||
| 35 | |||
| 36 | =head1 SYNOPSIS | ||
| 37 | |||
| 38 | $slice = | ||
| 39 | $sa->fetch_by_region( 'chromosome', 'X', 1_000_000, 2_000_000 ); | ||
| 40 | |||
| 41 | my $projection = $slice->project("clone"); | ||
| 42 | |||
| 43 | foreach my $projection_segment (@$projection) { | ||
| 44 | print( " from_start ", $projection_segment->from_start(), "\n" ); | ||
| 45 | print( " from_end ", $projection_segment->from_end(), "\n" ); | ||
| 46 | print( " to_Slice ", | ||
| 47 | $projection_segment->to_Slice()->name(), "\n" ); | ||
| 48 | } | ||
| 49 | |||
| 50 | =head1 DESCRIPTION | ||
| 51 | |||
| 52 | The ProjectionSegment is a helper object to make the arrays returned by | ||
| 53 | project more accessible. Instead of writing $segment->[0], $segment->[1] | ||
| 54 | or $segment->[2] its possible to use the more descriptive notation of | ||
| 55 | $segment->from_start(), $segement->from_end(), $segment->to_Slice(). | ||
| 56 | |||
| 57 | =head1 METHODS | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | package Bio::EnsEMBL::ProjectionSegment; | ||
| 62 | $Bio::EnsEMBL::ProjectionSegment::VERSION = '114.0.0'; | ||
| 63 | use strict; | ||
| 64 | use warnings; | ||
| 65 | |||
| 66 | # | ||
| 67 | # WARNING: THIS CLASS IS REPRESENTED BY A BLESSED ARRAY REFERENCE | ||
| 68 | # NOT A HASH REFERENCE | ||
| 69 | # | ||
| 70 | |||
| 71 | |||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | =head2 from_start | ||
| 76 | |||
| 77 | Args : none | ||
| 78 | Example : $coord_in_fetaure_start = $segment->from_start() | ||
| 79 | Description: First element in projects returned segment lists | ||
| 80 | Returntype : int | ||
| 81 | Exceptions : none | ||
| 82 | Caller : general | ||
| 83 | Status : Stable | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | sub from_start { | ||
| 88 | my $self = shift; | ||
| 89 | return $self->[0]; | ||
| 90 | } | ||
| 91 | |||
| 92 | |||
| 93 | |||
| 94 | =head2 from_end | ||
| 95 | |||
| 96 | Args : none | ||
| 97 | Example : $coord_in_feature_end = $segment->from_end() | ||
| 98 | Description: Second element in projects returned segment lists | ||
| 99 | Returntype : int | ||
| 100 | Exceptions : none | ||
| 101 | Caller : general | ||
| 102 | Status : Stable | ||
| 103 | |||
| 104 | =cut | ||
| 105 | |||
| 106 | sub from_end { | ||
| 107 | my $self = shift; | ||
| 108 | return $self->[1]; | ||
| 109 | } | ||
| 110 | |||
| 111 | |||
| 112 | |||
| 113 | |||
| 114 | =head2 to_Slice | ||
| 115 | |||
| 116 | Args : none | ||
| 117 | Example : $target_slice = $segment->to_Slice() | ||
| 118 | Description: Third element in projects returned segment lists | ||
| 119 | Returntype : Bio::EnsEMBL::Slice | ||
| 120 | Exceptions : none | ||
| 121 | Caller : general | ||
| 122 | Status : Stable | ||
| 123 | |||
| 124 | =cut | ||
| 125 | |||
| 126 | sub to_Slice { | ||
| 127 | my $self = shift; | ||
| 128 | return $self->[2]; | ||
| 129 | } | ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | 1; |