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
de5762cb
Commit
de5762cb
authored
11 years ago
by
Magali Ruffier
Browse files
Options
Downloads
Patches
Plain Diff
ENSCORESW-388
: also store alt_ids when loading ontologies
parent
8113a93d
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
+25
-2
25 additions, 2 deletions
misc-scripts/ontology/scripts/load_OBO_file.pl
with
25 additions
and
2 deletions
misc-scripts/ontology/scripts/load_OBO_file.pl
+
25
−
2
View file @
de5762cb
...
...
@@ -166,14 +166,16 @@ sub write_subset {
sub
write_term
{
my
(
$dbh
,
$terms
,
$subsets
,
$namespaces
,
$unknown_onto_id
)
=
@_
;
print
("
Writing to 'term'
and
'synonym' tables...
\n
");
print
("
Writing to 'term'
,
'synonym'
and 'alt_id'
tables...
\n
");
$dbh
->
do
("
LOCK TABLES term WRITE, synonym WRITE
");
$dbh
->
do
("
LOCK TABLES term WRITE, synonym
WRITE, alt_id
WRITE
");
my
$statement
=
"
INSERT IGNORE INTO term (ontology_id, subsets, accession, name, definition, is_root, is_obsolete) VALUES (?,?,?,?,?,?,?)
";
my
$syn_stmt
=
"
INSERT INTO synonym (term_id, name) VALUES (?,?)
";
my
$alt_stmt
=
"
INSERT INTO alt_id (term_id, accession) VALUES (?,?)
";
my
$existing_term_st
=
"
SELECT term_id, ontology_id FROM term WHERE accession = ?
";
my
$update_stmt
=
"
UPDATE term SET ontology_id = ?, subsets = ?, name = ?, definition = ?, is_root = ? WHERE term_id = ?
";
...
...
@@ -181,6 +183,7 @@ sub write_term {
my
$sth
=
$dbh
->
prepare
(
$statement
);
my
$update_sth
=
$dbh
->
prepare
(
$update_stmt
);
my
$syn_sth
=
$dbh
->
prepare
(
$syn_stmt
);
my
$alt_sth
=
$dbh
->
prepare
(
$alt_stmt
);
my
$existing_term_sth
=
$dbh
->
prepare
(
$existing_term_st
);
my
$count
=
0
;
...
...
@@ -287,12 +290,30 @@ sub write_term {
}
}
}
if
(
!
$term
->
{
alt_id
}
->
is_empty
)
{
if
(
$reuse
)
{
print
"
REUSE: SKIPPING ALT_ID writing as term already exists in this database
\n
";
}
else
{
foreach
my
$acc
(
$term
->
{'
alt_id
'}
->
get_set
())
{
$alt_sth
->
bind_param
(
1
,
$term
->
{
id
},
SQL_INTEGER
);
$alt_sth
->
bind_param
(
2
,
$acc
,
SQL_VARCHAR
);
$alt_sth
->
execute
();
++
$syn_count
;
}
}
}
}
}
## end foreach my $accession ( sort...)
alarm
(
0
);
$dbh
->
do
("
OPTIMIZE TABLE term
");
$dbh
->
do
("
OPTIMIZE TABLE synonym
");
$dbh
->
do
("
OPTIMIZE TABLE alt_id
");
$dbh
->
do
("
UNLOCK TABLES
");
printf
("
\t
Wrote %d entries into 'term', updated %d entries in 'term' and wrote %d entries into 'synonym'
\n
",
$count
,
$updated_count
,
$syn_count
);
...
...
@@ -707,6 +728,8 @@ foreach my $t (@{$ontology->get_terms()}) {
push
(
@
{
$term
{'
synonyms
'}},
$t_synonym
->
def_as_string
());
}
$term
{'
alt_id
'}
=
$t
->
alt_id
();
$terms
{
$term
{'
accession
'}}
=
{
%term
};
}
...
...
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