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
f6dbcb00
Commit
f6dbcb00
authored
12 years ago
by
Kieron Taylor
Browse files
Options
Downloads
Patches
Plain Diff
Added in taxon id cache value updating to prevent it resetting itself in subsequent calls.
parent
2292b772
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/production_database/scripts/populate_species_meta.pl
+24
-21
24 additions, 21 deletions
...ipts/production_database/scripts/populate_species_meta.pl
with
24 additions
and
21 deletions
misc-scripts/production_database/scripts/populate_species_meta.pl
+
24
−
21
View file @
f6dbcb00
...
...
@@ -136,29 +136,29 @@ sub databases {
}
sub
_query_production
{
my
(
$self
,
$sql
)
=
@_
;
my
(
$self
,
$sql
,
@arguments
)
=
@_
;
my
$dbc
=
$self
->
_production_dbc
();
my
$h
=
$dbc
->
sql_helper
();
my
$
hash
;
my
%
hash
;
$h
->
execute_no_return
(
-
SQL
=>
$sql
,
-
PARAMS
=>
[
$taxon
],
-
PARAMS
=>
[
join
('
,
',
@arguments
)
],
-
CALLBACK
=>
sub
{
my
(
$row
)
=
@_
;
my
$i
=
0
;
$hash
->
{'
species.common_name
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.display_name
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.scientific_name
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.production_name
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.url
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.taxonomy_id
'}
=
$row
->
[
$i
++
];
$hash
->
{'
species.stable_id_prefix
'}
=
$row
->
[
$i
++
];
$hash
{'
species.common_name
'}
=
$row
->
[
$i
++
];
$hash
{'
species.display_name
'}
=
$row
->
[
$i
++
];
$hash
{'
species.scientific_name
'}
=
$row
->
[
$i
++
];
$hash
{'
species.production_name
'}
=
$row
->
[
$i
++
];
$hash
{'
species.url
'}
=
$row
->
[
$i
++
];
$hash
{'
species.taxonomy_id
'}
=
$row
->
[
$i
++
];
$hash
{'
species.stable_id_prefix
'}
=
$row
->
[
$i
++
];
return
;
}
);
return
$
hash
;
return
\
%
hash
;
}
sub
_production
{
...
...
@@ -170,26 +170,29 @@ sub _production {
my
$taxon
=
$self
->
_db_to_taxon
(
$db
);
my
$sql
=
'
select common_name, web_name, scientific_name, production_name, url_name, taxon, species_prefix from species where taxon =?
';
my
$hash
=
$self
->
_query_production
(
$sql
);
my
$hash
_ref
=
$self
->
_query_production
(
$sql
,
$taxon
);
if
(
!
exists
$hash
->
{'
species.common_name
'})
{
# taxon id was *probably* not obtained, try again using database name
if
(
!
exists
$hash_ref
->
{'
species.common_name
'})
{
warning
("
Failed to find original taxon id for
$db
. Attempting to obtain by DB name instead
");
my
$db_name
=
$db
;
$db_name
=~
s/_\w+_\d+_.+$//
;
# regex chops tail end off core-like databases. This must be extended if new naming schemes are used.
$db_name
=~
s/_(core|otherfeatures|vega|rnaseq|cdna)_.+?_.+?$//
;
warning
("
Guessed db_name:
"
.
$db_name
);
$sql
=
'
select common_name, web_name, scientific_name, production_name, url_name, taxon, species_prefix from species where db_name = ?
';
$self
->
_query_production
(
$sql
);
$hash_ref
=
$self
->
_query_production
(
$sql
,
$db_name
);
# Update $taxon to reflect new guessed id
$taxon
=
$hash
->
{'
species.taxonomy_id
'};
$taxon
=
$hash_ref
->
{'
species.taxonomy_id
'};
warning
("
Chosen taxon id:
"
.
$taxon
);
# hack this puppy. Update cached taxon to reflect better guess. Later call of _db_to_taxon was ignoring this.
$self
->
{'
db_to_taxon
'}
->
{
$db
}
=
$taxon
;
}
$hash
->
{'
species.alias
'}
=
$h
->
execute_simple
(
$hash
_ref
->
{'
species.alias
'}
=
$h
->
execute_simple
(
-
SQL
=>
'
select sa.alias from species_alias sa join species s using (species_id) where s.taxon =?
',
-
PARAMS
=>
[
$taxon
]
-
PARAMS
=>
[
$taxon
]
,
);
return
$hash
;
return
$hash
_ref
;
}
sub
_taxonomy
{
...
...
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