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
465106e3
Commit
465106e3
authored
11 years ago
by
Andy Yates
Browse files
Options
Downloads
Patches
Plain Diff
[ENSCORESW-477]. Added methods to allow lookup of OntologyTerm from an OntologyXref
parent
465d3bc0
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/OntologyXref.pm
+31
-0
31 additions, 0 deletions
modules/Bio/EnsEMBL/OntologyXref.pm
modules/t/ontologyTerm.t
+14
-4
14 additions, 4 deletions
modules/t/ontologyTerm.t
with
45 additions
and
4 deletions
modules/Bio/EnsEMBL/OntologyXref.pm
+
31
−
0
View file @
465106e3
...
...
@@ -64,9 +64,40 @@ identifier but with different evidence tags. For this reason a single
package
Bio::EnsEMBL::
OntologyXref
;
use
strict
;
use
warnings
;
use
base
qw( Bio::EnsEMBL::DBEntry )
;
require
Bio::EnsEMBL::
Registry
;
=head2 get_OntologyTerm
Example : $ontology_xref->get_OntologyTerm();
Description: Queries the OntologyTermAdaptor for a term which is the same
as the primary id of this object. This method requires a
OntologyDBAdaptor to be available in the Bio::EnsEMBL::Registry.
If you have loaded data from an Ensembl release using
Bio::EnsEMBL::Registry->load_registry_from_db() then this should
work.
Returntype : Bio::EnsEMBL::OntologyTerm
Exceptions : None
Caller : general
Status : Experimantal
=cut
sub
get_OntologyTerm
{
my
(
$self
)
=
@_
;
my
$dbas
=
Bio::EnsEMBL::
Registry
->
get_all_DBAdaptors
(
-
GROUP
=>
'
ontology
');
foreach
my
$ontology_dba
(
@
{
$dbas
})
{
my
$ota
=
$ontology_dba
->
get_OntologyTermAdaptor
();
my
$term
=
$ota
->
fetch_by_accession
(
$self
->
primary_id
());
return
$term
if
$term
;
}
return
;
}
=head2 add_linkage_type
Arg [1] : string $value
...
...
This diff is collapsed.
Click to expand it.
modules/t/ontologyTerm.t
+
14
−
4
View file @
465106e3
...
...
@@ -14,21 +14,21 @@ use Bio::EnsEMBL::Translation;
use
Bio::EnsEMBL::
Gene
;
use
Bio::EnsEMBL::
DnaDnaAlignFeature
;
# switch on the
debug
prints
# switch on the
note
prints
our
$verbose
=
0
;
debug
("
Startup test
");
note
("
Startup test
");
ok
(
1
);
my
$multi
=
Bio::EnsEMBL::Test::
MultiTestDB
->
new
('
ontology
');
my
$odb
=
$multi
->
get_DBAdaptor
("
ontology
");
debug
("
Ontology database instatiated
");
note
("
Ontology database instatiated
");
ok
(
$odb
);
my
$human
=
Bio::EnsEMBL::Test::
MultiTestDB
->
new
();
my
$db
=
$human
->
get_DBAdaptor
("
core
");
debug
("
Test database instatiated
");
note
("
Test database instatiated
");
ok
(
$db
);
my
$go_adaptor
=
$odb
->
get_OntologyTermAdaptor
();
...
...
@@ -69,6 +69,16 @@ is(@{$go_roots}, 1, "Found go roots");
my
$efo_roots
=
$go_adaptor
->
fetch_all_roots
('
efo
');
is
(
@
{
$efo_roots
},
0
,
"
Found no efo roots
");
#Now go back to the OntologyXref & see if we can do the reverse lookup
{
my
$go_db_links
=
$genes
->
[
0
]
->
get_all_DBLinks
('
GO
');
foreach
my
$dbentry
(
@
{
$go_db_links
})
{
my
$term
=
$dbentry
->
get_OntologyTerm
();
my
$direct_term
=
$go_adaptor
->
fetch_by_accession
(
$dbentry
->
primary_id
());
is_deeply
(
$term
,
$direct_term
,
'
Fetching the OntologyTerm from the OntologyXref should match the same object from OntologyTermAdaptor
');
}
}
done_testing
();
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