Commit ade7487a authored by Eugene Kulesha's avatar Eugene Kulesha
Browse files

for origin overlapping genes take into account exons with negative start and...

for origin overlapping genes take into account exons with negative start and with start greater then end
parent 8868bff0
......@@ -160,6 +160,11 @@ sub fetch_by_Slice_start_end_strand {
if ( !defined($end) ) {
}
if($slice->start> $slice->end) {
return $self->_fetch_by_Slice_start_end_strand_circular( $slice, $slice->start, $slice->end, $strand );
}
} else {
if ( !defined($end) ) {
$end = $slice->end() - $slice->start() + 1;
......@@ -284,8 +289,6 @@ sub _fetch_by_Slice_start_end_strand_circular {
if ( $start > $end && $slice->is_circular() ) {
my ($seq, $seq1, $seq2);
my $midpoint = $slice->seq_region_length - $slice->start + 1;
$seq1 = ${ $self->_fetch_by_Slice_start_end_strand_circular( $slice, 1, $midpoint, 1 )};
$seq2 = ${ $self->_fetch_by_Slice_start_end_strand_circular( $slice, $midpoint + 1, $slice->length(), 1 )};
......@@ -297,6 +300,8 @@ sub _fetch_by_Slice_start_end_strand_circular {
return \$seq;
}
# Get a new slice that spans the exact region to retrieve dna from
my $right_expand = $end - $slice->length(); #negative is fine
my $left_expand = 1 - $start; #negative is fine
......
......@@ -1451,15 +1451,14 @@ sub seq {
my $seq2 = $self->slice()->subseq( $mid_point + 1, $self->end(), $self->strand() );
$seq = $self->strand() > 0 ? "$seq1$seq2" : "$seq2$seq1";
} elsif ( $self->start < 0) {
# Normally exons overlapping chromosome origin will have negative start
} elsif ( $self->start < 0 || $self->start > $self->end) {
# Normally exons overlapping chromosome origin will be 0 based, and can have negative start
# But if you go via sub_Slice it gives you chromosome based coordinates, i.e it will have start greater then end
my $start_point = $self->slice->seq_region_length + $self->slice->start;
my $mid_point = $self->slice->seq_region_length;
my $seq1 = $self->slice->subseq( $self->start, $mid_point, $self->strand);
my $seq2 = $self->slice->subseq(1, $self->end, $self->strand );
$seq = $self->strand > 0 ? "$seq1$seq2" : "$seq2$seq1";
} else {
$seq = $self->slice()->subseq( $self->start(), $self->end(), $self->strand() );
}
} else {
$seq = $self->slice()->subseq( $self->start(), $self->end(), $self->strand() );
......
Markdown is supported
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