Skip to content
Snippets Groups Projects
Commit be4ca9d3 authored by Graham McVicker's avatar Graham McVicker
Browse files

removed restrict_between_positions method, confusing and apparently never used

parent c109b883
No related branches found
No related tags found
No related merge requests found
......@@ -15,7 +15,7 @@ package Bio::EnsEMBL::DnaDnaAlignFeature;
See BaseAlignFeature
=cut
=cut
use Bio::EnsEMBL::BaseAlignFeature;
......@@ -26,109 +26,6 @@ use strict;
@ISA = qw( Bio::EnsEMBL::BaseAlignFeature );
=head2 restrict_between_positions
Arg 1 : int $start
Arg 2 : int $end
Arg 3 : string $sequence_name
The Feature can either be restricted on Ensembl coords
or on hit coords. The sequence_name decides which one.
Example : none
Description: Makes a new AlignFeature that sits in the new coords
Returntype : DnaDnaAlignFeature
Exceptions : returns undef if it cant do the job
Caller : general
=cut
sub restrict_between_positions {
my ($self,$start,$end,$seqref) = @_;
unless (defined $start && $start =~ /^\d+$/) {
$self->throw("The first argument is not defined or is not an integer");
}
unless (defined $end && $end =~ /^\d+$/) {
$self->throw("The second argument is not defined or is not an integer");
}
unless (defined $seqref &&
($seqref eq "seqname" || $seqref eq "hseqname")) {
$self->throw("The third argument is not defined or is not equal to 'seqname' or 'hseqname'");
}
# symbolic method references should be forbidden!
my ($start_method1,$end_method1,$strand_method1,$start_method2,$end_method2,$strand_method2) =
qw(start end strand hstart hend hstrand);
if ($seqref eq "hseqname") {
($start_method1,$end_method1,$strand_method1,$start_method2,$end_method2,$strand_method2) =
qw(hstart hend hstrand start end strand);
}
my @restricted_features;
foreach my $ungapped_feature ($self->ungapped_features) {
if ($ungapped_feature->$start_method1() > $end ||
$ungapped_feature->$end_method1() < $start) {
next;
} elsif ($ungapped_feature->$end_method1() <= $end &&
$ungapped_feature->$start_method1() >= $start) {
push @restricted_features, $ungapped_feature;
} else {
if ($ungapped_feature->$strand_method1() eq $ungapped_feature->$strand_method2()) {
if ($ungapped_feature->$start_method1() < $start) {
my $offset = $start - $ungapped_feature->$start_method1();
$ungapped_feature->$start_method1($start);
$ungapped_feature->$start_method2($ungapped_feature->$start_method2() + $offset);
}
if ($ungapped_feature->$end_method1() > $end) {
my $offset = $ungapped_feature->$end_method1() - $end;
$ungapped_feature->$end_method1($end);
$ungapped_feature->$end_method2($ungapped_feature->$end_method2() - $offset);
}
} else {
if ($ungapped_feature->$start_method1() < $start) {
my $offset = $start - $ungapped_feature->$start_method1();
$ungapped_feature->$start_method1($start);
$ungapped_feature->$end_method2($ungapped_feature->$end_method2() - $offset);
}
if ($ungapped_feature->$end_method1() > $end) {
my $offset = $ungapped_feature->$end_method1() - $end;
$ungapped_feature->$end_method1($end);
$ungapped_feature->$start_method2($ungapped_feature->$start_method2() + $offset);
}
}
push @restricted_features, $ungapped_feature;
}
}
if (scalar @restricted_features) {
my $DnaDnaAlignFeature = new Bio::EnsEMBL::DnaDnaAlignFeature('-features' =>\@restricted_features);
return $DnaDnaAlignFeature;
} else {
return undef;
}
}
=head2 _hit_unit
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment