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
056faa88
Commit
056faa88
authored
15 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
Don't try to invert some relationships.
Properly assign internal IDs to terms when loading 2+ ontologies.
parent
8858a0cb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/ontology/scripts/load_OBO_file.pl
+16
-35
16 additions, 35 deletions
misc-scripts/ontology/scripts/load_OBO_file.pl
with
16 additions
and
35 deletions
misc-scripts/ontology/scripts/load_OBO_file.pl
+
16
−
35
View file @
056faa88
...
...
@@ -56,8 +56,13 @@ sub write_ontology {
$sth
->
execute
();
$namespaces
->
{
$namespace
}
=
{
'
id
'
=>
++
$count
,
'
name
'
=>
$ontology
};
$namespaces
->
{
$namespace
}
=
{
'
id
'
=>
$dbh
->
last_insert_id
(
undef
,
undef
,
'
ontology
',
'
ontology_id
'
),
'
name
'
=>
$ontology
};
++
$count
;
}
$dbh
->
do
("
OPTIMIZE TABLE ontology
");
...
...
@@ -95,7 +100,9 @@ sub write_term {
$sth
->
execute
();
$term
->
{'
id
'}
=
++
$count
;
$term
->
{'
id
'}
=
$dbh
->
last_insert_id
(
undef
,
undef
,
'
term
',
'
term_id
'
);
++
$count
;
}
$dbh
->
do
("
OPTIMIZE TABLE term
");
...
...
@@ -153,21 +160,6 @@ sub write_relation_type {
#-----------------------------------------------------------------------
# Relation types to invert (from => to).
# Extracted from http://www.obofoundry.org/ro/ro.obo (May 27, 2009)
our
%inverse_type
=
(
'
has_part
'
=>
'
part_of
',
'
has_integral_part
'
=>
'
integral_part_of
',
'
has_proper_part
'
=>
'
proper_part_of
',
'
location_of
'
=>
'
located_in
',
'
contains
'
=>
'
contained_in
',
'
derived_into
'
=>
'
derives_from
',
'
precedes
'
=>
'
preceded_by
',
'
has_participant
'
=>
'
participates_in
',
'
has_agent
'
=>
'
agent_in
',
'
has_improper_part
'
=>
'
improper_part_of
'
# obsolete
);
sub
write_relation
{
my
(
$dbh
,
$truncate
,
$terms
,
$relation_types
)
=
@_
;
...
...
@@ -194,28 +186,17 @@ sub write_relation {
foreach
my
$parent_acc
(
sort
(
@
{
$child_term
->
{'
parents
'}{
$relation_type
}
}
)
)
{
if
(
exists
(
$inverse_type
{
$relation_type
}
)
)
{
$relation_type
=
$inverse_type
{
$relation_type
};
$sth
->
bind_param
(
1
,
$terms
->
{
$parent_acc
}{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
2
,
$child_term
->
{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
3
,
$relation_types
->
{
$relation_type
}{'
id
'},
SQL_INTEGER
);
}
else
{
$sth
->
bind_param
(
1
,
$child_term
->
{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
2
,
$terms
->
{
$parent_acc
}{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
3
,
$relation_types
->
{
$relation_type
}{'
id
'},
SQL_INTEGER
);
}
$sth
->
bind_param
(
1
,
$child_term
->
{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
2
,
$terms
->
{
$parent_acc
}{'
id
'},
SQL_INTEGER
);
$sth
->
bind_param
(
3
,
$relation_types
->
{
$relation_type
}{'
id
'},
SQL_INTEGER
);
$sth
->
execute
();
++
$count
;
}
}
## end foreach my $relation_type (...
}
## end foreach my $child_term ( sort...
}
}
$dbh
->
do
("
OPTIMIZE TABLE relation
");
$dbh
->
do
("
UNLOCK TABLES
");
...
...
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