3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
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
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.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
37 my $truncated_gene = Bio::EnsEMBL::Utils::SubSlicedFeature->
new(
41 my $transcripts = $truncated_gene->get_all_Transcripts();
42 # list of transcripts is limited to those within the coordinates, rather
43 # than the original feature Slice.
47 Alters the behaviour of a normal
Feature object to act within a user-specified
48 sub-slice of of its boundaries. As it stands,
this only affects get_all_*
49 methods, meaning that seq_region_start() and project() will work on original
59 use
Bio::
EnsEMBL::Utils::Argument qw/rearrange/;
63 my ($class, @args) = @_;
64 my ($start,$end,$original_feature) = rearrange([qw/start end feature/], @args);
65 my $self = $class->SUPER::new($original_feature);
66 $self->{
'start'} = $start;
67 $self->{
'end'} = $end;
71 # Required by Proxy to control scope of the autoloaded methods.
72 # Also intercepts calls to get methods that would access Slice
75 my ($self, $package_name, $method) = @_;
77 if ($method =~ /^get_all_/) {
78 # Call original method and filter results to Proxy coordinates
80 my ($local_self, @args) = @_;
81 my $feature_list = $local_self->__proxy()->$method(@args);
83 foreach my $feature (@$feature_list) {
84 if ($feature->start > $local_self->{
'start'}
85 && $feature->end < $local_self->{
'end'}) {
86 push @short_list,$feature;
92 # No intervention required, call original object method
94 my ($local_self, @args) = @_;
95 return $local_self->__proxy()->$method(@args);