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
51e3f849
Commit
51e3f849
authored
22 years ago
by
Graham McVicker
Browse files
Options
Downloads
Patches
Plain Diff
script for propogating external_db changes to all core databases
parent
60c66623
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc-scripts/external_db/external_dbs.txt
+42
-0
42 additions, 0 deletions
misc-scripts/external_db/external_dbs.txt
misc-scripts/external_db/update_external_dbs.pl
+127
-0
127 additions, 0 deletions
misc-scripts/external_db/update_external_dbs.pl
with
169 additions
and
0 deletions
misc-scripts/external_db/external_dbs.txt
0 → 100644
+
42
−
0
View file @
51e3f849
100 AFFY_HG_U133 1 XREF
110 AFFY_HG_U95 1 XREF
120 AFFY_MG_U74 1 XREF
130 AFFY_MG_U74v2 1 XREF
140 AFFY_Mu11Ksub 1 XREF
150 AFFY_RG_U34 1 XREF
160 AFFY_RN_U34 1 XREF
170 AFFY_RT_U34 1 XREF
200 Anopheles_paper 1 KNOWNXREF
210 Anopheles_symbol 1 KNOWN
300 BRIGGSAE_HYBRID 1 KNOWNXREF
400 Celera_Gene 1 PRED
410 Celera_Pep 1 PRED
420 Celera_Trans 1 PRED
500 drosophila_gene_id 1 KNOWNXREF
600 DROS_ORTH 1 ORTH
700 EMBL 1 KNOWNXREF
800 flybase_gene 1 KNOWNXREF
810 flybase_symbol 1 KNOWNXREF
820 flybase_transcript 1 KNOWNXREF
900 GKB 1 XREF
1000 GO 1 KNOWNXREF
1100 HUGO 1 KNOWNXREF
1200 Interpro 1 XREF
1300 LocusLink 1 KNOWNXREF
1400 MarkerSymbol 1 KNOWNXREF
1500 MIM 1 KNOWNXREF
1600 PDB 1 KNOWNXREF
1700 protein_id 1 KNOWNXREF
1800 RefSeq 1 KNOWN
1900 Sanger_Hver1_2_1 1 XREF
1910 Sanger_Mver1_1_1 1 XREF
2000 SPTREMBL 1 KNOWN
2100 Superfamily 1 KNOWNXREF
2200 SWISSPROT 1 KNOWN
2300 Vega_gene 1 XREF
2310 Vega_transcript 1 XREF
2320 Vega_translation 1 XREF
2400 wormbase_gene 1 KNOWN
2410 wormbase_transcript 1 KNOWN
2420 wormpep_id 1 KNOWN
2500 ZFIN 1 KNOWNXREF
This diff is collapsed.
Click to expand it.
misc-scripts/external_db/update_external_dbs.pl
0 → 100644
+
127
−
0
View file @
51e3f849
#
# updates the external db tables on all of the core databases on a given host
#
use
strict
;
use
Getopt::
Long
;
use
DBI
;
use
IO::
File
;
my
(
$host
,
$user
,
$pass
,
$port
,
@dbnames
,
$file
,
$release_num
);
GetOptions
(
"
host=s
",
\
$host
,
"
user=s
",
\
$user
,
"
pass=s
",
\
$pass
,
"
port=i
",
\
$port
,
"
file=s
",
\
$file
,
"
dbnames=s@
",
\
@dbnames
,
"
release_num=i
",
\
$release_num
);
#both host and file are required
usage
()
if
(
!
$host
||
!
$file
);
#release num XOR dbname are required
usage
()
if
((
$release_num
&&
@dbnames
)
||
(
!
$release_num
&&
!
@dbnames
));
$port
||=
3306
;
my
$dsn
=
"
DBI:mysql:host=
$host
;port=
$port
";
my
$db
=
DBI
->
connect
(
$dsn
,
$user
,
$pass
,
{
RaiseError
=>
1
}
);
if
(
$release_num
)
{
@dbnames
=
map
{
$_
->
[
0
]
}
@
{
$db
->
selectall_arrayref
(
"
show databases
"
)
};
#
# filter out all non-core databases
#
@dbnames
=
grep
{
/^[a-zA-Z]+\_[a-zA-Z]+\_(core|est|estgene)\_${release_num}\_\d+$/
}
@dbnames
;
}
#
# make sure the user wishes to continue
#
print
STDERR
"
The following databases will be external_db updated:
\n
";
print
join
("
\n
",
@dbnames
);
print
"
\n
continue with update (yes/no)>
";
my
$input
=
lc
(
<
STDIN
>
);
chomp
(
$input
);
if
(
$input
ne
'
yes
')
{
print
"
external_db conversion aborted
\n
";
exit
();
}
#
# read all of the new external_db entries from the file
#
my
$fh
=
IO::
File
->
new
();
$fh
->
open
(
$file
)
or
die
("
could not open input file
$file
");
my
@rows
;
while
(
<
$fh
>
)
{
my
@a
=
split
(
/\t/
);
push
@rows
,
{'
external_db_id
'
=>
$a
[
0
],
'
db_name
'
=>
$a
[
1
],
'
release
'
=>
$a
[
2
],
'
status
'
=>
$a
[
3
]};
}
$fh
->
close
();
foreach
my
$dbname
(
@dbnames
)
{
print
STDERR
"
updating
$dbname
\n
";
$db
->
do
("
use
$dbname
");
my
$sth
=
$db
->
prepare
('
DELETE FROM external_db
');
$sth
->
execute
();
$sth
->
finish
();
$sth
=
$db
->
prepare
('
INSERT INTO external_db (external_db_id, db_name,
release, status)
VALUES (?,?,?,?)
');
foreach
my
$row
(
@rows
)
{
$sth
->
execute
(
$row
->
{'
external_db_id
'},
$row
->
{'
db_name
'},
$row
->
{'
release
'},
$row
->
{'
status
'});
}
$sth
->
finish
();
}
print
STDERR
"
updates complete
\n
";
sub
usage
{
print
STDERR
<<EOF
Usage: update_external_db options
Where options are: -host hostname
-user username
-pass password
-port port_of_server optional
-release the release of the database to update used to
match database names. e.g. 13
-file the path of the file containing the insert statements
of the entries of the external_db table
-dbnames db1
the names of the database to update. if not provided
all of the core databases matching the release arg
will be updated. Either -dbnames or -release must
be specified, but not both. Multiple dbnames can
be provided.
E.g.:
#update 2 databases
perl update_external_dbs.pl -host ecs1c -file external_dbs.txt -user ensadmin -pass secret -dbnames homo_sapiens_core_14_33 -dbnames mus_musculus_core_14_30
#update all core databases for release 14
perl update_external_dbs.pl -host ecs2d -file external_dbs.txt -user ensadmin -pass secret -release 14
EOF
;
exit
;
}
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