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
74c56c98
Commit
74c56c98
authored
18 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Now looks in gene_archive when calculating highest existing stable ID.
parent
ef162329
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/generate_stable_ids.pl
+36
-16
36 additions, 16 deletions
misc-scripts/generate_stable_ids.pl
with
36 additions
and
16 deletions
misc-scripts/generate_stable_ids.pl
+
36
−
16
View file @
74c56c98
...
...
@@ -35,22 +35,7 @@ foreach my $type (@types) {
my
$sth
;
# get starting stable ID, either specified or current max
my
$new_stable_id
;
if
(
$start
)
{
$new_stable_id
=
$start
;
}
else
{
$sth
=
$dbi
->
prepare
("
SELECT MAX(stable_id) FROM
$table
");
$sth
->
execute
();
if
(
my
@row
=
$sth
->
fetchrow_array
())
{
$new_stable_id
=
$row
[
0
];
}
else
{
die
"
Can't get max
$type
stable ID from
$table
\n
";
}
}
my
$new_stable_id
=
$start
?
$start
:
get_highest_stable_id
(
$dbi
,
$type
);
# get timestamp so all new stable IDs have the same created/modified dates
$sth
=
$dbi
->
prepare
("
SELECT NOW()
");
...
...
@@ -89,6 +74,41 @@ sub increment_stable_id {
# --------------------------------------------------------------------------------
sub
get_highest_stable_id
{
my
(
$dbi
,
$type
)
=
@_
;
my
$sid
=
$type
.
"
_stable_id
";
my
(
$highest_from_current
,
$highest_from_archive
);
# get highest stable ID from the relevant table
my
$sth
=
$dbi
->
prepare
("
SELECT MAX(stable_id) FROM
$sid
");
$sth
->
execute
();
if
(
my
@row
=
$sth
->
fetchrow_array
())
{
$highest_from_current
=
$row
[
0
];
}
else
{
die
"
Can't get max
$type
stable ID from
$sid
\n
";
}
return
$highest_from_current
if
(
$type
eq
"
exon
");
# and from relevant archive
$sth
=
$dbi
->
prepare
("
SELECT MAX(
$sid
) FROM gene_archive
");
$sth
->
execute
();
if
(
my
@row
=
$sth
->
fetchrow_array
())
{
$highest_from_archive
=
$row
[
0
];
}
else
{
die
"
Can't get max
$type
stable ID from gene_archive
\n
";
}
my
$max
=
(
$highest_from_current
ge
$highest_from_archive
)
?
$highest_from_current
:
$highest_from_archive
;
return
$max
;
}
# --------------------------------------------------------------------------------
sub
usage
{
print
<<
"
EOF
";
...
...
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