Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl
Commits
3693a3cb
Commit
3693a3cb
authored
Jul 30, 2013
by
Alessandro Vullo
Browse files
Debugged handling of negative strand slices on circular chromosomes
parent
ea7bbdf6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
165 additions
and
114 deletions
+165
-114
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
+51
-44
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
+58
-37
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+56
-33
No files found.
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
View file @
3693a3cb
...
...
@@ -646,6 +646,8 @@ FEATURE: while ( $sth->fetch() ) {
# If a destination slice was provided convert the coords.
#
if
(
defined
(
$dest_slice
)
)
{
my
$seq_region_len
=
$dest_slice
->
seq_region_length
();
if
(
$dest_slice_strand
==
1
)
{
# On the positive strand.
...
...
@@ -685,58 +687,63 @@ FEATURE: while ( $sth->fetch() ) {
}
else
{
# On the negative strand.
if
(
$seq_region_start
>
$seq_region_end
&&
$dest_slice
->
is_circular
()
)
{
# Handle circular chromosomes.
my
$start
=
$dest_slice_end
-
$seq_region_end
+
1
;
my
$end
=
$dest_slice_end
-
$seq_region_start
+
1
;
if
(
$dest_slice_start
>
$dest_slice_end
)
{
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$dest_slice_end
+
$dest_slice
->
seq_region_length
()
-
$tmp_seq_region_start
+
1
;
}
else
{
if
(
$dest_slice
->
is_circular
())
{
if
(
$seq_region_end
>
$dest_slice_start
)
{
# Looking at the region in the beginning of the
# chromosome.
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice
->
seq_region_length
()
-
$dest_slice_start
+
1
;
}
else
{
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
-
$dest_slice
->
seq_region_length
()
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
if
(
$dest_slice_start
>
$dest_slice_end
)
{
# slice spans origin or replication
}
if
(
$seq_region_start
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
$start
+=
$seq_region_len
if
$seq_region_end
>
$dest_slice_start
;
}
else
{
# Non-circular chromosome.
}
elsif
(
$seq_region_start
<=
$dest_slice_end
)
{
# do nothing
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$start
+=
$seq_region_len
;
$end
+=
$seq_region_len
;
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
}
elsif
(
$seq_region_end
<=
$dest_slice_end
)
{
$seq_region_strand
=
-
$seq_region_strand
;
$end
+=
$seq_region_len
if
$end
<
0
;
}
## end else [ if ( $dest_slice_strand...)]
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
$end
+=
$seq_region_len
;
# Throw away features off the end of the requested slice.
if
(
$seq_region_end
<
1
||
$seq_region_start
>
$dest_slice_length
||
(
$dest_slice_sr_id
!=
$seq_region_id
)
)
{
next
FEATURE
;
}
}
else
{
}
}
else
{
if
(
$seq_region_start
<=
$dest_slice_end
and
$seq_region_end
>=
$dest_slice_start
)
{
# do nothing
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
if
(
$seq_region_start
<=
$dest_slice_end
)
{
$start
-=
$seq_region_len
;
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
}
else
{
}
}
}
}
$seq_region_start
=
$start
;
$seq_region_end
=
$end
;
$seq_region_strand
*=
-
1
;
}
## end else [ if ( $dest_slice_strand...)]
$slice
=
$dest_slice
;
}
## end if ( defined($dest_slice...))
...
...
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
View file @
3693a3cb
...
...
@@ -1607,9 +1607,10 @@ FEATURE: while ($sth->fetch()) {
# If a destination slice was provided convert the coords.
#
if
(
defined
(
$dest_slice
))
{
if
(
$dest_slice_strand
==
1
)
{
# Positive strand.
my
$seq_region_len
=
$dest_slice
->
seq_region_length
();
if
(
$dest_slice_strand
==
1
)
{
# Positive strand
$seq_region_start
=
$seq_region_start
-
$dest_slice_start
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice_start
+
1
;
...
...
@@ -1620,13 +1621,14 @@ FEATURE: while ($sth->fetch()) {
# Looking at a feature overlapping the chromsome origin.
if
(
$seq_region_end
>
$dest_slice_start
)
{
# Looking at the region in the beginning of the
# chromosome.
$seq_region_start
-=
$
dest_slice
->
seq_region_len
gth
()
;
$seq_region_start
-=
$seq_region_len
;
}
if
(
$seq_region_end
<
0
)
{
$seq_region_end
+=
$
dest_slice
->
seq_region_len
gth
()
;
$seq_region_end
+=
$seq_region_len
;
}
}
else
{
...
...
@@ -1637,53 +1639,72 @@ FEATURE: while ($sth->fetch()) {
# Looking at the region overlapping the chromosome
# origin and a feature which is at the beginning of the
# chromosome.
$seq_region_start
+=
$
dest_slice
->
seq_region_len
gth
()
;
$seq_region_end
+=
$
dest_slice
->
seq_region_len
gth
()
;
$seq_region_start
+=
$seq_region_len
;
$seq_region_end
+=
$seq_region_len
;
}
}
}
## end if ($dest_slice->is_circular...)
}
else
{
# Negative strand.
}
else
{
# Negative strand
if
(
$dest_slice
->
is_circular
()
&&
$seq_region_start
>
$seq_region_end
)
{
# Handle cicular chromosomes.
my
$start
=
$dest_slice_end
-
$seq_region_end
+
1
;
my
$end
=
$dest_slice_end
-
$seq_region_start
+
1
;
if
(
$seq_region_end
>
$dest_slice_start
)
{
# Looking at the region in the beginning of the
# chromosome.
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice
->
seq_region_length
-
$dest_slice_start
+
1
;
}
else
{
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
-
$dest_slice
->
seq_region_length
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
if
(
$dest_slice
->
is_circular
())
{
}
else
{
# Non-circular chromosome.
if
(
$dest_slice_start
>
$dest_slice_end
)
{
# slice spans origin or replication
if
(
$seq_region_start
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
$start
+=
$seq_region_len
if
$seq_region_end
>
$dest_slice_start
;
}
elsif
(
$seq_region_start
<=
$dest_slice_end
)
{
# do nothing
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$start
+=
$seq_region_len
;
$end
+=
$seq_region_len
;
}
elsif
(
$seq_region_end
<=
$dest_slice_end
)
{
$end
+=
$seq_region_len
if
$end
<
0
;
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
$end
+=
$seq_region_len
;
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
else
{
}
}
else
{
$seq_region_strand
=
-
$seq_region_strand
;
if
(
$seq_region_start
<=
$dest_slice_end
and
$seq_region_end
>=
$dest_slice_start
)
{
# do nothing
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
if
(
$seq_region_start
<=
$dest_slice_end
)
{
$start
-=
$seq_region_len
;
}
## end else [ if ($dest_slice_strand...)]
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
}
else
{
}
}
}
# Throw away features off the end of the requested slice or on
# different seq_region.
}
if
(
$seq_region_end
<
1
||
$seq_region_start
>
$dest_slice_length
||
(
$dest_slice_sr_id
ne
$seq_region_id
))
{
next
FEATURE
;
}
$seq_region_start
=
$start
;
$seq_region_end
=
$end
;
$seq_region_strand
*=
-
1
;
}
## end else [ if ($dest_slice_strand...)]
$slice
=
$dest_slice
;
}
## end if (defined($dest_slice...))
...
...
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
View file @
3693a3cb
...
...
@@ -1606,6 +1606,8 @@ sub _objs_from_sth {
# If a destination slice was provided convert the coords.
#
if
(
defined
(
$dest_slice
))
{
my
$seq_region_len
=
$dest_slice
->
seq_region_length
();
if
(
$dest_slice_strand
==
1
)
{
$seq_region_start
=
$seq_region_start
-
$dest_slice_start
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice_start
+
1
;
...
...
@@ -1633,42 +1635,63 @@ sub _objs_from_sth {
}
}
}
else
{
if
(
$dest_slice
->
is_circular
()
&&
$seq_region_start
>
$seq_region_end
)
{
if
(
$seq_region_end
>
$dest_slice_start
)
{
# Looking at the region in the beginning of the chromosome.
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice
->
seq_region_length
()
-
$dest_slice_start
+
1
;
}
else
{
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
-
$dest_slice
->
seq_region_length
()
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
my
$start
=
$dest_slice_end
-
$seq_region_end
+
1
;
my
$end
=
$dest_slice_end
-
$seq_region_start
+
1
;
}
else
{
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
}
if
(
$dest_slice
->
is_circular
())
{
$seq_region_strand
=
-
$seq_region_strand
;
}
## end else [ if ( $dest_slice_strand...)]
if
(
$dest_slice_start
>
$dest_slice_end
)
{
# slice spans origin or replication
# Throw away features off the end of the requested slice
if
(
$seq_region_end
<
1
||
$seq_region_start
>
$dest_slice_length
||
(
$dest_slice_sr_id
ne
$seq_region_id
)
)
{
next
FEATURE
;
}
if
(
$seq_region_start
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
$start
+=
$seq_region_len
if
$seq_region_end
>
$dest_slice_start
;
}
elsif
(
$seq_region_start
<=
$dest_slice_end
)
{
# do nothing
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$start
+=
$seq_region_len
;
$end
+=
$seq_region_len
;
}
elsif
(
$seq_region_end
<=
$dest_slice_end
)
{
$end
+=
$seq_region_len
if
$end
<
0
;
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
$end
+=
$seq_region_len
;
}
else
{
}
}
else
{
if
(
$seq_region_start
<=
$dest_slice_end
and
$seq_region_end
>=
$dest_slice_start
)
{
# do nothing
}
elsif
(
$seq_region_start
>
$seq_region_end
)
{
if
(
$seq_region_start
<=
$dest_slice_end
)
{
$start
-=
$seq_region_len
;
}
elsif
(
$seq_region_end
>=
$dest_slice_start
)
{
$end
+=
$seq_region_len
;
}
else
{
}
}
}
}
$seq_region_start
=
$start
;
$seq_region_end
=
$end
;
$seq_region_strand
*=
-
1
;
}
## end else [ if ( $dest_slice_strand...)]
$slice
=
$dest_slice
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment