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
9cb30616
Commit
9cb30616
authored
Jul 10, 2013
by
Kieron Taylor
😠
Browse files
New method to support bulk transcript lookups.
parent
687906f1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
18 deletions
+43
-18
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
+43
-18
No files found.
modules/Bio/EnsEMBL/DBSQL/DBEntryAdaptor.pm
View file @
9cb30616
...
...
@@ -836,26 +836,42 @@ sub _store_object_xref_mapping {
=cut
sub
get_external_db_id
{
my
(
$self
,
$db_name
,
$db_release
,
$ignore_release
)
=
@_
;
my
$sql_helper
=
$self
->
dbc
->
sql_helper
;
my
$sql
=
'
SELECT external_db_id FROM external_db WHERE db_name = ?
';
my
@bound_params
;
push
@bound_params
,
$db_name
;
unless
(
$ignore_release
)
{
if
(
$db_release
)
{
$sql
.=
'
AND db_release = ?
';
push
@bound_params
,
$db_release
;
}
else
{
$sql
.=
'
AND db_release is NULL
';
my
$self
=
shift
;
my
$db_ids
=
$self
->
get_external_db_ids
(
@
_
);
return
shift
@$db_ids
;
}
=head2 get_external_db_ids_like
=cut
sub
get_external_db_ids
{
my
(
$self
,
$db_name
,
$db_release
,
$ignore_release
)
=
@_
;
my
$sql_helper
=
$self
->
dbc
->
sql_helper
;
my
$sql
=
'
SELECT external_db_id FROM external_db WHERE db_name
';
if
(
$db_name
=~
/%|_/
)
{
$sql
.=
'
LIKE ?
';
}
else
{
$sql
.=
'
= ?
';
}
}
my
(
$db_id
)
=
@
{
$sql_helper
->
execute_simple
(
-
SQL
=>
$sql
,
-
PARAMS
=>
\
@bound_params
)
};
return
$db_id
;
my
@bound_params
;
push
@bound_params
,
$db_name
;
unless
(
$ignore_release
)
{
if
(
$db_release
)
{
$sql
.=
'
AND db_release = ?
';
push
@bound_params
,
$db_release
;
}
else
{
$sql
.=
'
AND db_release is NULL
';
}
}
my
@db_ids
=
@
{
$sql_helper
->
execute_simple
(
-
SQL
=>
$sql
,
-
PARAMS
=>
\
@bound_params
)
};
return
\
@db_ids
;
}
=head2 _check_external_db
Arg [1] : DBEntry object
...
...
@@ -1612,6 +1628,13 @@ sub list_transcript_ids_by_extids {
return
keys
%T
;
}
sub
list_transcript_ids_by_external_db_id
{
my
(
$self
,
$external_db_id
)
=
@_
;
my
%T
=
map
{
(
$_
,
1
)
}
$self
->
_type_by_external_db_id
(
$external_db_id
,
'
Translation
',
'
transcript
'
),
$self
->
_type_by_external_db_id
(
$external_db_id
,
'
Transcript
',
'
transcript
'
);
return
keys
%T
;
}
=head2 list_translation_ids_by_extids
...
...
@@ -1841,7 +1864,9 @@ SQL
Arg [1] : integer $type - external_db_id
Arg [2] : string $ensType - ensembl_object_type
Arg [3] : (optional) string $extraType
other object type to be returned
other object type to be returned. This references the _id fields of
the transcript table, and if left unset defaults to the translation_id
from the translation table.
Example : $self->_type_by_external_db_id(1030, 'Translation');
Description: Gets.
NOTE: In a multi-species database, this method will
...
...
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