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
39bcb9b0
Commit
39bcb9b0
authored
15 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
Re-do some of the cleanup to fetch_all_by_Slice().
parent
88b3b9b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
+2
-6
2 additions, 6 deletions
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+36
-36
36 additions, 36 deletions
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
with
38 additions
and
42 deletions
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
+
2
−
6
View file @
39bcb9b0
...
...
@@ -565,7 +565,7 @@ sub fetch_all_by_Slice {
# Associate transcript identifiers with genes.
my
%g_hash
=
map
{
$_
->
dbID
=>
$_
}
@$genes
;
my
%g_hash
=
map
{
$_
->
dbID
=>
$_
}
@
{
$genes
}
;
my
$g_id_str
=
join
(
'
,
',
keys
(
%g_hash
)
);
...
...
@@ -585,8 +585,6 @@ sub fetch_all_by_Slice {
$tr_g_hash
{
$tr_id
}
=
$g_hash
{
$g_id
};
}
$sth
->
finish
();
my
$ta
=
$self
->
db
()
->
get_TranscriptAdaptor
();
my
$transcripts
=
$ta
->
fetch_all_by_Slice
(
$ext_slice
,
...
...
@@ -596,9 +594,7 @@ sub fetch_all_by_Slice {
# Move transcripts onto gene slice, and add them to genes.
foreach
my
$tr
(
@
{
$transcripts
}
)
{
if
(
!
exists
(
$tr_g_hash
{
$tr
->
dbID
()
}
)
)
{
next
;
}
if
(
!
exists
(
$tr_g_hash
{
$tr
->
dbID
()
}
)
)
{
next
}
my
$new_tr
;
if
(
$slice
!=
$ext_slice
)
{
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/DBSQL/TranscriptAdaptor.pm
+
36
−
36
View file @
39bcb9b0
...
...
@@ -348,11 +348,7 @@ sub fetch_all_by_Gene {
=cut
sub
fetch_all_by_Slice
{
my
$self
=
shift
;
my
$slice
=
shift
;
my
$load_exons
=
shift
;
my
$logic_name
=
shift
;
my
$constraint
=
shift
;
my
(
$self
,
$slice
,
$load_exons
,
$logic_name
,
$constraint
)
=
@_
;
my
$transcripts
;
if
(
defined
(
$constraint
)
&&
$constraint
ne
''
)
{
...
...
@@ -364,7 +360,7 @@ sub fetch_all_by_Slice {
}
# if there are 0 or 1 transcripts still do lazy-loading
if
(
!
$load_exons
||
@$transcripts
<
2
)
{
if
(
!
$load_exons
||
@$transcripts
<
2
)
{
return
$transcripts
;
}
...
...
@@ -372,54 +368,58 @@ sub fetch_all_by_Slice {
# faster than 1 query per transcript
# first check if the exons are already preloaded
return
$transcripts
if
(
exists
$transcripts
->
[
0
]
->
{'
_trans_exon_array
'});
# FIXME: Should test all exons.
if
(
exists
(
$transcripts
->
[
0
]
->
{'
_trans_exon_array
'}
)
)
{
return
$transcripts
;
}
# get extent of region spanned by transcripts
my
(
$min_start
,
$max_end
);
my
(
$min_start
,
$max_end
);
foreach
my
$tr
(
@$transcripts
)
{
if
(
!
defined
(
$min_start
)
||
$tr
->
seq_region_start
()
<
$min_start
)
{
if
(
!
defined
(
$min_start
)
||
$tr
->
seq_region_start
()
<
$min_start
)
{
$min_start
=
$tr
->
seq_region_start
();
}
if
(
!
defined
(
$max_end
)
||
$tr
->
seq_region_end
()
>
$max_end
)
{
$max_end
=
$tr
->
seq_region_end
();
if
(
!
defined
(
$max_end
)
||
$tr
->
seq_region_end
()
>
$max_end
)
{
$max_end
=
$tr
->
seq_region_end
();
}
}
my
$ext_slice
;
if
(
$min_start
>=
$slice
->
start
()
&&
$max_end
<=
$slice
->
end
())
{
if
(
$min_start
>=
$slice
->
start
()
&&
$max_end
<=
$slice
->
end
()
)
{
$ext_slice
=
$slice
;
}
else
{
my
$sa
=
$self
->
db
()
->
get_SliceAdaptor
();
$ext_slice
=
$sa
->
fetch_by_region
(
$slice
->
coord_system
->
name
(),
$slice
->
seq_region_name
(),
$min_start
,
$max_end
,
$slice
->
strand
(),
$slice
->
coord_system
->
version
());
$ext_slice
=
$sa
->
fetch_by_region
(
$slice
->
coord_system
->
name
(),
$slice
->
seq_region_name
(),
$min_start
,
$max_end
,
$slice
->
strand
(),
$slice
->
coord_system
->
version
()
);
}
# associate exon identifiers with transcripts
my
%tr_hash
=
map
{
$_
->
dbID
=>
$_
}
@$transcripts
;
my
%tr_hash
=
map
{
$_
->
dbID
=>
$_
}
@
{
$transcripts
}
;
my
$tr_id_str
=
'
(
'
.
join
('
,
',
keys
%tr_hash
)
.
'
)
'
;
my
$tr_id_str
=
join
(
'
,
',
keys
(
%tr_hash
)
)
;
my
$sth
=
$self
->
prepare
("
SELECT transcript_id, exon_id, rank
"
.
"
FROM exon_transcript
"
.
"
WHERE transcript_id IN
$tr_id_str
");
my
$sth
=
$self
->
prepare
(
"
SELECT transcript_id, exon_id, rank
"
.
"
FROM exon_transcript
"
.
"
WHERE transcript_id IN (
$tr_id_str
)
"
);
$sth
->
execute
();
my
(
$ex
_id
,
$
tr
_id
,
$rank
);
$sth
->
bind_columns
(
\
$tr_id
,
\
$ex_id
,
\
$rank
);
my
(
$tr
_id
,
$
ex
_id
,
$rank
);
$sth
->
bind_columns
(
\
(
$tr_id
,
$ex_id
,
$rank
)
);
my
%ex_tr_hash
;
while
(
$sth
->
fetch
())
{
while
(
$sth
->
fetch
()
)
{
$ex_tr_hash
{
$ex_id
}
||=
[]
;
push
@
{
$ex_tr_hash
{
$ex_id
}},
[
$tr_hash
{
$tr_id
},
$rank
]
;
push
(
@
{
$ex_tr_hash
{
$ex_id
}
},
[
$tr_hash
{
$tr_id
},
$rank
]
)
;
}
$sth
->
finish
();
my
$ea
=
$self
->
db
()
->
get_ExonAdaptor
();
my
$exons
=
$ea
->
fetch_all_by_Slice_constraint
(
$ext_slice
,
...
...
@@ -427,21 +427,21 @@ sub fetch_all_by_Slice {
join
(
'
,
',
sort
{
$a
<=>
$b
}
keys
(
%ex_tr_hash
)
)
)
);
# move exons onto transcript slice, and add them to transcripts
foreach
my
$ex
(
@$exons
)
{
foreach
my
$ex
(
@
{
$exons
}
)
{
my
$new_ex
;
if
(
$slice
!=
$ext_slice
)
{
$new_ex
=
$ex
->
transfer
(
$slice
)
if
(
$slice
!=
$ext_slice
);
if
(
!
$new_ex
)
{
throw
("
Unexpected. Exon could not be transfered onto transcript slice.
");
if
(
$slice
!=
$ext_slice
)
{
$new_ex
=
$ex
->
transfer
(
$slice
);
if
(
!
defined
(
$new_ex
)
)
{
throw
("
Unexpected.
"
.
"
Exon could not be transfered onto Transcript slice.
"
);
}
}
else
{
$new_ex
=
$ex
;
}
foreach
my
$row
(
@
{
$ex_tr_hash
{
$new_ex
->
dbID
()
}}
)
{
my
(
$tr
,
$rank
)
=
@$row
;
$tr
->
add_Exon
(
$new_ex
,
$rank
);
foreach
my
$row
(
@
{
$ex_tr_hash
{
$new_ex
->
dbID
()
}
}
)
{
my
(
$tr
,
$rank
)
=
@
{
$row
}
;
$tr
->
add_Exon
(
$new_ex
,
$rank
);
}
}
...
...
@@ -451,7 +451,7 @@ sub fetch_all_by_Slice {
$tla
->
fetch_all_by_Transcript_list
(
$transcripts
);
return
$transcripts
;
}
}
## end sub fetch_all_by_Slice
=head2 fetch_all_by_external_name
...
...
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