Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
eacfb265
Commit
eacfb265
authored
14 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
Handle cicular chromosomes in _objs_from_sth(). Patch from EG.
parent
8e2369a8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
+151
-81
151 additions, 81 deletions
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
with
151 additions
and
81 deletions
modules/Bio/EnsEMBL/DBSQL/ExonAdaptor.pm
+
151
−
81
View file @
eacfb265
...
@@ -515,7 +515,7 @@ sub list_stable_ids {
...
@@ -515,7 +515,7 @@ sub list_stable_ids {
# Caller : internal
# Caller : internal
sub
_objs_from_sth
{
sub
_objs_from_sth
{
my
(
$self
,
$sth
,
$mapper
,
$dest_slice
)
=
@_
;
my
(
$self
,
$sth
,
$mapper
,
$dest_slice
)
=
@_
;
#
#
# This code is ugly because an attempt has been made to remove as many
# This code is ugly because an attempt has been made to remove as many
...
@@ -530,21 +530,17 @@ sub _objs_from_sth {
...
@@ -530,21 +530,17 @@ sub _objs_from_sth {
my
%sr_name_hash
;
my
%sr_name_hash
;
my
%sr_cs_hash
;
my
%sr_cs_hash
;
my
(
my
(
$exon_id
,
$seq_region_id
,
$seq_region_start
,
$exon_id
,
$seq_region_id
,
$seq_region_start
,
$seq_region_end
,
$seq_region_strand
,
$phase
,
$seq_region_end
,
$seq_region_strand
,
$phase
,
$end_phase
,
$is_current
,
$is_constitutive
,
$end_phase
,
$is_current
,
$is_constitutive
,
$stable_id
,
$version
,
$created_date
,
$stable_id
,
$version
,
$created_date
,
$modified_date
);
$modified_date
);
$sth
->
bind_columns
(
$sth
->
bind_columns
(
\
(
$exon_id
,
$seq_region_id
,
$seq_region_start
,
\
$exon_id
,
\
$seq_region_id
,
\
$seq_region_start
,
$seq_region_end
,
$seq_region_strand
,
$phase
,
\
$seq_region_end
,
\
$seq_region_strand
,
\
$phase
,
$end_phase
,
$is_current
,
$is_constitutive
,
\
$end_phase
,
\
$is_current
,
\
$is_constitutive
,
$stable_id
,
$version
,
$created_date
,
\
$stable_id
,
\
$version
,
\
$created_date
,
$modified_date
)
);
\
$modified_date
);
my
$asm_cs
;
my
$asm_cs
;
my
$cmp_cs
;
my
$cmp_cs
;
...
@@ -552,9 +548,10 @@ sub _objs_from_sth {
...
@@ -552,9 +548,10 @@ sub _objs_from_sth {
my
$asm_cs_name
;
my
$asm_cs_name
;
my
$cmp_cs_vers
;
my
$cmp_cs_vers
;
my
$cmp_cs_name
;
my
$cmp_cs_name
;
if
(
$mapper
)
{
$asm_cs
=
$mapper
->
assembled_CoordSystem
();
if
(
$mapper
)
{
$cmp_cs
=
$mapper
->
component_CoordSystem
();
$asm_cs
=
$mapper
->
assembled_CoordSystem
();
$cmp_cs
=
$mapper
->
component_CoordSystem
();
$asm_cs_name
=
$asm_cs
->
name
();
$asm_cs_name
=
$asm_cs
->
name
();
$asm_cs_vers
=
$asm_cs
->
version
();
$asm_cs_vers
=
$asm_cs
->
version
();
$cmp_cs_name
=
$cmp_cs
->
name
();
$cmp_cs_name
=
$cmp_cs
->
name
();
...
@@ -569,38 +566,42 @@ sub _objs_from_sth {
...
@@ -569,38 +566,42 @@ sub _objs_from_sth {
my
$dest_slice_sr_name
;
my
$dest_slice_sr_name
;
my
$dest_slice_sr_id
;
my
$dest_slice_sr_id
;
my
$asma
;
my
$asma
;
if
(
$dest_slice
)
{
$dest_slice_start
=
$dest_slice
->
start
();
if
(
$dest_slice
)
{
$dest_slice_end
=
$dest_slice
->
end
();
$dest_slice_start
=
$dest_slice
->
start
();
$dest_slice_strand
=
$dest_slice
->
strand
();
$dest_slice_end
=
$dest_slice
->
end
();
$dest_slice_length
=
$dest_slice
->
length
();
$dest_slice_strand
=
$dest_slice
->
strand
();
$dest_slice_cs
=
$dest_slice
->
coord_system
();
$dest_slice_length
=
$dest_slice
->
length
();
$dest_slice_cs
=
$dest_slice
->
coord_system
();
$dest_slice_sr_name
=
$dest_slice
->
seq_region_name
();
$dest_slice_sr_name
=
$dest_slice
->
seq_region_name
();
$dest_slice_sr_id
=
$dest_slice
->
get_seq_region_id
();
$dest_slice_sr_id
=
$dest_slice
->
get_seq_region_id
();
$asma
=
$self
->
db
->
get_AssemblyMapperAdaptor
();
$asma
=
$self
->
db
->
get_AssemblyMapperAdaptor
();
}
}
FEATURE:
while
(
$sth
->
fetch
())
{
FEATURE:
while
(
$sth
->
fetch
()
)
{
#need to get the internal_seq_region, if present
#need to get the internal_seq_region, if present
$seq_region_id
=
$self
->
get_seq_region_id_internal
(
$seq_region_id
);
$seq_region_id
=
$self
->
get_seq_region_id_internal
(
$seq_region_id
);
my
$slice
=
$slice_hash
{"
ID:
"
.
$seq_region_id
};
my
$slice
=
$slice_hash
{
"
ID:
"
.
$seq_region_id
};
my
$dest_mapper
=
$mapper
;
my
$dest_mapper
=
$mapper
;
if
(
!
$slice
)
{
if
(
!
$slice
)
{
$slice
=
$sa
->
fetch_by_seq_region_id
(
$seq_region_id
);
$slice
=
$sa
->
fetch_by_seq_region_id
(
$seq_region_id
);
$slice_hash
{"
ID:
"
.
$seq_region_id
}
=
$slice
;
$slice_hash
{
"
ID:
"
.
$seq_region_id
}
=
$slice
;
$sr_name_hash
{
$seq_region_id
}
=
$slice
->
seq_region_name
();
$sr_name_hash
{
$seq_region_id
}
=
$slice
->
seq_region_name
();
$sr_cs_hash
{
$seq_region_id
}
=
$slice
->
coord_system
();
$sr_cs_hash
{
$seq_region_id
}
=
$slice
->
coord_system
();
}
}
#obtain a mapper if none was defined, but a dest_seq_region was
#obtain a mapper if none was defined, but a dest_seq_region was
if
(
!
$dest_mapper
&&
$dest_slice
&&
if
(
!
$dest_mapper
!
$dest_slice_cs
->
equals
(
$slice
->
coord_system
))
{
&&
$dest_slice
$dest_mapper
=
$asma
->
fetch_by_CoordSystems
(
$dest_slice_cs
,
&&
!
$dest_slice_cs
->
equals
(
$slice
->
coord_system
)
)
$slice
->
coord_system
);
{
$asm_cs
=
$dest_mapper
->
assembled_CoordSystem
();
$dest_mapper
=
$cmp_cs
=
$dest_mapper
->
component_CoordSystem
();
$asma
->
fetch_by_CoordSystems
(
$dest_slice_cs
,
$slice
->
coord_system
);
$asm_cs
=
$dest_mapper
->
assembled_CoordSystem
();
$cmp_cs
=
$dest_mapper
->
component_CoordSystem
();
$asm_cs_name
=
$asm_cs
->
name
();
$asm_cs_name
=
$asm_cs
->
name
();
$asm_cs_vers
=
$asm_cs
->
version
();
$asm_cs_vers
=
$asm_cs
->
version
();
$cmp_cs_name
=
$cmp_cs
->
name
();
$cmp_cs_name
=
$cmp_cs
->
name
();
...
@@ -630,57 +631,126 @@ sub _objs_from_sth {
...
@@ -630,57 +631,126 @@ sub _objs_from_sth {
}
}
#
#
# If a destination slice was provided convert the coords
# If a destination slice was provided convert the coords
. If the
#
If the
dest_slice starts at 1 and is foward strand, nothing needs doing
# dest_slice starts at 1 and is foward strand, nothing needs doing
.
#
#
if
(
$dest_slice
)
{
if
(
defined
(
$dest_slice
)
)
{
if
(
$dest_slice_start
!=
1
||
$dest_slice_strand
!=
1
)
{
if
(
$dest_slice_strand
==
1
)
{
if
(
$dest_slice_strand
==
1
)
{
# On the positive strand.
$seq_region_start
=
$seq_region_start
-
$dest_slice_start
+
1
;
$seq_region_end
=
$seq_region_end
-
$dest_slice_start
+
1
;
$seq_region_start
=
$seq_region_start
-
$dest_slice_start
+
1
;
}
else
{
$seq_region_end
=
$seq_region_end
-
$dest_slice_start
+
1
;
my
$tmp_seq_region_start
=
$seq_region_start
;
$seq_region_start
=
$dest_slice_end
-
$seq_region_end
+
1
;
# Handle circular chromosomes.
$seq_region_end
=
$dest_slice_end
-
$tmp_seq_region_start
+
1
;
if
(
$dest_slice
->
is_circular
()
)
{
$seq_region_strand
*=
-
1
;
if
(
$seq_region_start
>
$seq_region_end
)
{
}
# Looking at a feature overlapping the chromsome origin.
}
if
(
$seq_region_end
>
$dest_slice_start
)
{
#throw away features off the end of the requested slice
# Looking at the region in the beginning of the
if
(
$seq_region_end
<
1
||
$seq_region_start
>
$dest_slice_length
||
# chromosome.
(
$dest_slice_sr_id
!=
$seq_region_id
))
{
$seq_region_start
-=
$dest_slice
->
seq_region_length
();
next
FEATURE
;
}
if
(
$seq_region_end
<
0
)
{
$seq_region_end
+=
$dest_slice
->
seq_region_length
();
}
}
elsif
(
$dest_slice_start
>
$dest_slice_end
&&
$seq_region_end
<
0
)
{
# 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_length
();
$seq_region_end
+=
$dest_slice
->
seq_region_length
();
}
}
}
else
{
# On the negative strand.
# Handle circular chromosomes.
if
(
$dest_slice
->
is_circular
()
)
{
if
(
$seq_region_start
>
$seq_region_end
)
{
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
(
$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
;
}
}
}
## end if ( $seq_region_start...)
}
else
{
# Non-circular chromosome.
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
;
}
$seq_region_strand
=
-
$seq_region_strand
;
}
## end else [ if ( $dest_slice_strand...)]
# 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
;
}
}
$slice
=
$dest_slice
;
$slice
=
$dest_slice
;
}
}
## end if ( defined($dest_slice...))
# Finally, create the new exon.
# Finally, create the new exon.
push
(
push
(
@exons
,
@exons
,
$self
->
_create_feature_fast
(
$self
->
_create_feature_fast
(
'
Bio::EnsEMBL::Exon
',
{
'
Bio::EnsEMBL::Exon
',
'
start
'
=>
$seq_region_start
,
{
'
end
'
=>
$seq_region_end
,
'
start
'
=>
$seq_region_start
,
'
strand
'
=>
$seq_region_strand
,
'
end
'
=>
$seq_region_end
,
'
adaptor
'
=>
$self
,
'
strand
'
=>
$seq_region_strand
,
'
slice
'
=>
$slice
,
'
adaptor
'
=>
$self
,
'
dbID
'
=>
$exon_id
,
'
slice
'
=>
$slice
,
'
stable_id
'
=>
$stable_id
,
'
dbID
'
=>
$exon_id
,
'
version
'
=>
$version
,
'
stable_id
'
=>
$stable_id
,
'
created_date
'
=>
$created_date
||
undef
,
'
version
'
=>
$version
,
'
modified_date
'
=>
$modified_date
||
undef
,
'
created_date
'
=>
$created_date
||
undef
,
'
phase
'
=>
$phase
,
'
modified_date
'
=>
$modified_date
||
undef
,
'
end_phase
'
=>
$end_phase
,
'
phase
'
=>
$phase
,
'
is_current
'
=>
$is_current
,
'
end_phase
'
=>
$end_phase
,
'
is_constitutive
'
=>
$is_constitutive
}
)
'
is_current
'
=>
$is_current
,
);
'
is_constitutive
'
=>
$is_constitutive
}
)
);
}
## end while ( $sth->fetch() )
}
return
\
@exons
;
return
\
@exons
;
}
}
## end sub _objs_from_sth
=head1 DEPRECATED METHODS
=head1 DEPRECATED METHODS
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment