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
53f063aa
Commit
53f063aa
authored
18 years ago
by
Damian Smedley
Browse files
Options
Downloads
Patches
Plain Diff
changed so can run on all core databases etc
parent
bb1738e9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/meta_coord/update_meta_coord.pl
+34
-23
34 additions, 23 deletions
misc-scripts/meta_coord/update_meta_coord.pl
with
34 additions
and
23 deletions
misc-scripts/meta_coord/update_meta_coord.pl
+
34
−
23
View file @
53f063aa
...
...
@@ -5,9 +5,9 @@ use Bio::EnsEMBL::DBSQL::DBConnection;
use
Getopt::
Long
;
my
$help
=
0
;
my
(
$host
,
$port
,
$user
,
$pass
,
$db
name
);
my
(
$host
,
$port
,
$user
,
$pass
,
$db
pattern
);
my
$usage
=
"
\n
$0 --host ecs2 --port 3364 --user ensadmin --pass ensembl --db
name homo_sapiens_core_27_35a
my
$usage
=
"
\n
$0 --host ecs2 --port 3364 --user ensadmin --pass ensembl --db
pattern core
[--help] displays this menu.
...
...
@@ -39,7 +39,7 @@ GetOptions('help' => \$help,
'
port=i
'
=>
\
$port
,
'
user=s
'
=>
\
$user
,
'
pass=s
'
=>
\
$pass
,
'
db
name
=s
'
=>
\
$db
name
);
'
db
pattern
=s
'
=>
\
$db
pattern
);
#print "help: $help argv:" . scalar(@ARGV) . "$host $port $user $pass $dbname\n";
...
...
@@ -48,13 +48,24 @@ GetOptions('help' => \$help,
# exit 0;
#}
my
$dbc
=
new
Bio::EnsEMBL::DBSQL::
DBConnection
(
-
host
=>
$host
,
my
$dsn
=
"
DBI:mysql:host=
$host
";
$dsn
.=
"
;port=
$port
"
if
(
$port
);
my
$db
=
DBI
->
connect
(
$dsn
,
$user
,
$pass
);
my
@dbnames
=
map
{
$_
->
[
0
]
}
@
{
$db
->
selectall_arrayref
("
show databases
")};
for
my
$dbname
(
@dbnames
)
{
next
if
(
$dbname
!~
/$dbpattern/
);
my
$dbc
=
new
Bio::EnsEMBL::DBSQL::
DBConnection
(
-
host
=>
$host
,
-
port
=>
$port
,
-
user
=>
$user
,
-
pass
=>
$pass
,
-
dbname
=>
$dbname
);
my
@table_names
=
qw(
my
@table_names
=
qw(
assembly_exception
gene
exon
...
...
@@ -76,27 +87,27 @@ my @table_names = qw(
transcript
)
;
unless
(
system
("
mysql -h
$host
-P
$port
-u
$user
-p
$pass
-N -e 'select * from meta_coord'
$dbname
>
$dbname
.meta_coord.backup
")
==
0
)
{
print
STDERR
"
Can't dump the original meta_coord for back up
\n
";
exit
1
;
}
else
{
print
STDERR
"
original meta_coord table backed up in
$dbname
.meta_coord.backup
\n
";
}
unless
(
system
("
mysql -h
$host
-P
$port
-u
$user
-p
$pass
-N -e 'select * from meta_coord'
$dbname
>
$dbname
.meta_coord.backup
")
==
0
)
{
print
STDERR
"
Can't dump the original meta_coord for back up
\n
";
exit
1
;
}
else
{
print
STDERR
"
original meta_coord table backed up in
$dbname
.meta_coord.backup
\n
";
}
foreach
my
$table_name
(
@table_names
)
{
print
STDERR
"
Updating
$table_name
table entries...
";
my
$sql
=
"
delete from meta_coord where table_name = ?
";
my
$sth
=
$dbc
->
prepare
(
$sql
);
$sth
->
execute
(
$table_name
);
$sth
->
finish
;
foreach
my
$table_name
(
@table_names
)
{
print
STDERR
"
Updating
$table_name
table entries...
";
my
$sql
=
"
delete from meta_coord where table_name = ?
";
my
$sth
=
$dbc
->
prepare
(
$sql
);
$sth
->
execute
(
$table_name
);
$sth
->
finish
;
$sql
=
"
insert into meta_coord
"
.
$sql
=
"
insert into meta_coord
"
.
"
select '
$table_name
',s.coord_system_id, max(t.seq_region_end-t.seq_region_start+1)
"
.
"
from
$table_name
t, seq_region s
"
.
"
where t.seq_region_id=s.seq_region_id group by s.coord_system_id
";
$sth
=
$dbc
->
prepare
(
$sql
);
$sth
->
execute
;
$sth
->
finish
;
print
STDERR
"
Done
\n
";
$sth
=
$dbc
->
prepare
(
$sql
);
$sth
->
execute
;
$sth
->
finish
;
print
STDERR
"
Done
\n
";
}
}
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