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
68924315
Commit
68924315
authored
20 years ago
by
Arne Stabenau
Browse files
Options
Downloads
Patches
Plain Diff
not workibng layout for attribute type loading system
parent
5194744d
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/attribute_types/attrib_type.txt
+14
-0
14 additions, 0 deletions
misc-scripts/attribute_types/attrib_type.txt
misc-scripts/attribute_types/upload_attributes.pl
+105
-0
105 additions, 0 deletions
misc-scripts/attribute_types/upload_attributes.pl
with
119 additions
and
0 deletions
misc-scripts/attribute_types/attrib_type.txt
0 → 100644
+
14
−
0
View file @
68924315
# this file is intended to hold all valid attrib_type
# table entries for all ensembl databases that we release
#
# If you use the provided upload script, commentlines and
# emptry lines should be automatically removed, all
# other lines should contain tab delimited database entries
# for the attrib_type table
# each attribute type should be preceeded with a comment that
# describes its uses.
This diff is collapsed.
Click to expand it.
misc-scripts/attribute_types/upload_attributes.pl
0 → 100644
+
105
−
0
View file @
68924315
# Stolen from external db directory this script performs
# the similar function of uploading all valid attribute types
# into the attrib_type table of all databases that are going to
# be released.
use
strict
;
use
Getopt::
Long
;
use
DBI
;
use
IO::
File
;
use
FindBin
;
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
);
$file
||=
$
FindBin::
Bin
.
"
/attrib_type.txt
";
usage
()
if
(
!
$host
);
#release num XOR dbname are required
usage
()
if
((
$release_num
&&
@dbnames
)
||
(
!
$release_num
&&
!
@dbnames
));
my
$attribs
=
read_attrib_file
(
$file
);
$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|vega)\_${release_num}\_\d+[A-Za-z]?$/
}
@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
"
Attrib_type loading aborted
\n
";
exit
();
}
# if any attrib_types are loaded that are different from
# the file, a consistency problem is reported and the
# upload is not done.
# alternatively consistency can be enforceed to a certain degree
sub
check_consistency
{
my
$attribs
=
shift
;
my
$database_names
=
shift
;
my
$db
=
shift
;
}
sub
read_attrib_file
{
my
$file
=
shift
;
#
# read all attrib_type entries from the file
#
my
$fh
=
IO::
File
->
new
();
$fh
->
open
(
$file
)
or
die
("
could not open input file
$file
");
my
@rows
;
my
$row
;
while
(
$row
=
<
$fh
>
)
{
chomp
(
$row
);
next
if
(
/^\S*$/
);
next
if
(
/^\#/
);
my
@a
=
split
(
/\t/
,
$row
);
push
@rows
,
{'
attrib_type_id
'
=>
$a
[
0
],
'
code
'
=>
$a
[
1
],
'
name
'
=>
$a
[
2
],
'
description
'
=>
$a
[
3
]};
}
$fh
->
close
();
return
\
@rows
;
}
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