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
2f75e83f
Commit
2f75e83f
authored
22 years ago
by
Alistair Rust
Browse files
Options
Downloads
Patches
Plain Diff
Refactored versions of external name and external db which now uses the
relevant_xref_id columns.
parent
8c54544e
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
+79
-0
79 additions, 0 deletions
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
modules/Bio/EnsEMBL/Gene.pm
+26
-11
26 additions, 11 deletions
modules/Bio/EnsEMBL/Gene.pm
with
105 additions
and
11 deletions
modules/Bio/EnsEMBL/DBSQL/GeneAdaptor.pm
+
79
−
0
View file @
2f75e83f
...
@@ -901,6 +901,85 @@ sub deleteObj {
...
@@ -901,6 +901,85 @@ sub deleteObj {
#flush the cache
#flush the cache
%
{
$self
->
{'
_slice_gene_cache
'}}
=
();
%
{
$self
->
{'
_slice_gene_cache
'}}
=
();
}
}
=head2 get_external_name
Arg [1] : int $dbID
the database identifier of the gene whose external name is
sought
Example : $external_name = $gene_adaptor->get_external_name(42);
Description: Retrieves the external name for a gene. This is implemented
by joining across the xref and gene tables, using the
relevant_xref_id column.
Returntype : string
Exceptions : thrown if $dbId arg is not defined
Caller : general
=cut
sub
get_external_name
{
my
(
$self
,
$dbID
)
=
@_
;
if
(
!
defined
$dbID
)
{
$self
->
throw
("
Must call with a dbID
");
}
my
$sth
=
$self
->
prepare
("
SELECT x.display_label
FROM gene g,
xref x
WHERE g.gene_id = ?
AND g.relevant_xref_id = x.xref_id
");
$sth
->
execute
(
$dbID
);
my
(
$xref
)
=
$sth
->
fetchrow_array
();
if
(
!
defined
$xref
)
{
return
undef
;
}
return
$xref
;
}
=head2 get_external_dbname
Arg [1] : int $dbID
the database identifier of the gene for which the name of
external db from which its external name is derived.
Example : $external_dbname = $gene_adaptor->get_external_dbname(42);
Description: Retrieves the external db name for a gene from which its external
name is derived.. This is implemented by joining across the xref,
gene and external_db tables, using the relevant_xref_id column.
Returntype : string
Exceptions : thrown if $dbId arg is not defined
Caller : general
=cut
sub
get_external_dbname
{
my
(
$self
,
$dbID
)
=
@_
;
if
(
!
defined
$dbID
)
{
$self
->
throw
("
Must call with a dbID
");
}
my
$sth
=
$self
->
prepare
("
SELECT e.db_name
FROM gene g,
xref x,
external_db e
WHERE g.gene_id = ?
AND g.relevant_xref_id = x.xref_id
AND x.external_db_id = e.external_db_id
");
$sth
->
execute
(
$dbID
);
my
(
$db_name
)
=
$sth
->
fetchrow_array
();
if
(
!
defined
$db_name
)
{
return
undef
;
}
return
$db_name
;
}
...
...
This diff is collapsed.
Click to expand it.
modules/Bio/EnsEMBL/Gene.pm
+
26
−
11
View file @
2f75e83f
...
@@ -380,11 +380,7 @@ sub dbID {
...
@@ -380,11 +380,7 @@ sub dbID {
Arg [1] : string $external_name
Arg [1] : string $external_name
Example : none
Example : none
Description: get/set for attribute external_name. It initially calculates
Description: get/set for attribute external_name.
the longest transcript for the gene in question and then
delegates the call to the external_name method on Transcript.
Species dependant searching is handled by this method on
Transcript.
Returntype : string
Returntype : string
Exceptions : none
Exceptions : none
Caller : general
Caller : general
...
@@ -392,6 +388,18 @@ sub dbID {
...
@@ -392,6 +388,18 @@ sub dbID {
=cut
=cut
sub
external_name
{
sub
external_name
{
my
(
$self
,
$ext_name
)
=
@_
;
if
(
defined
$ext_name
)
{
$self
->
{'
_ext_name
'}
=
$ext_name
;
}
if
(
exists
$self
->
{'
_ext_name
'}
)
{
return
$self
->
{'
_ext_name
'};
}
$self
->
{'
_ext_name
'}
=
$self
->
adaptor
->
get_external_name
(
$self
->
dbID
);
return
$self
->
{'
_ext_name
'};
}
}
...
@@ -401,11 +409,7 @@ sub external_name {
...
@@ -401,11 +409,7 @@ sub external_name {
Arg [1] : string $external_db
Arg [1] : string $external_db
Example : none
Example : none
Description: get/set for attribute external_db. The db is the one that
Description: get/set for attribute external_db. The db is the one that
belongs to the external_name. It initially calculates
belongs to the external_name.
the longest transcript for the gene in question and then
delegates the call to the external_db method on Transcript.
Species dependant searching is handled by this method on
Transcript.
Returntype : string
Returntype : string
Exceptions : none
Exceptions : none
Caller : general
Caller : general
...
@@ -413,7 +417,18 @@ sub external_name {
...
@@ -413,7 +417,18 @@ sub external_name {
=cut
=cut
sub
external_db
{
sub
external_db
{
my
(
$self
,
$arg
)
=
@_
;
my
(
$self
,
$ext_dbname
)
=
@_
;
if
(
defined
$ext_dbname
)
{
$self
->
{'
_ext_dbname
'}
=
$ext_dbname
;
}
if
(
exists
$self
->
{'
_ext_dbname
'}
)
{
return
$self
->
{'
_ext_dbname
'};
}
$self
->
{'
_ext_dbname
'}
=
$self
->
adaptor
->
get_external_dbname
(
$self
->
dbID
);
return
$self
->
{'
_ext_dbname
'};
}
}
...
...
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