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
e149cf61
Commit
e149cf61
authored
17 years ago
by
Andreas Kusalananda Kähäri
Browse files
Options
Downloads
Patches
Plain Diff
Formatting, sorting stuff.
parent
05a2449e
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/xref_mapping/xref_config2sql.pl
+66
-70
66 additions, 70 deletions
misc-scripts/xref_mapping/xref_config2sql.pl
with
66 additions
and
70 deletions
misc-scripts/xref_mapping/xref_config2sql.pl
+
66
−
70
View file @
e149cf61
...
...
@@ -24,10 +24,9 @@ use warnings;
use
Config::
IniFiles
;
my
$config
=
Config::
IniFiles
->
new
(
-
file
=>
(
defined
$ARGV
[
0
]
&&
-
f
$ARGV
[
0
]
?
$ARGV
[
0
]
:
'
xref_config.ini
'
)
);
Config::
IniFiles
->
new
(
-
file
=>
(
defined
$ARGV
[
0
]
&&
-
f
$ARGV
[
0
]
?
$ARGV
[
0
]
:
'
xref_config.ini
'
)
);
# Do the species.
...
...
@@ -36,28 +35,27 @@ print("# SPECIES\n");
print
("
\n
");
foreach
my
$section
(
$config
->
GroupMembers
('
species
')
)
{
my
$species_name
=
substr
(
$section
,
8
);
my
$species_name
=
substr
(
$section
,
8
);
my
@taxonomy_ids
=
split
(
/\n/
,
$config
->
val
(
$section
,
'
taxonomy_id
'
)
);
my
@taxonomy_ids
=
split
(
/\n/
,
$config
->
val
(
$section
,
'
taxonomy_id
'
)
);
my
$species_id
=
$taxonomy_ids
[
0
];
my
$species_id
=
$taxonomy_ids
[
0
];
printf
(
"
# Species '%s' (id = %d)
\n
",
$species_name
,
$species_id
);
printf
(
"
# Species '%s' (id = %d)
\n
",
$species_name
,
$species_id
);
foreach
my
$taxonomy_id
(
@taxonomy_ids
)
{
print
(
"
INSERT INTO species
"
.
"
(species_id, taxonomy_id, name, aliases)
\n
"
);
foreach
my
$taxonomy_id
(
@taxonomy_ids
)
{
print
(
"
INSERT INTO species
"
.
"
(species_id, taxonomy_id, name, aliases)
\n
"
);
printf
(
"
VALUES (%d, %d, '%s', '%s');
\n
",
$species_id
,
$taxonomy_id
,
$species_name
,
$config
->
val
(
$section
,
'
aliases
'
)
);
}
printf
(
"
VALUES (%d, %d, '%s', '%s');
\n
",
$species_id
,
$taxonomy_id
,
$species_name
,
$config
->
val
(
$section
,
'
aliases
'
)
);
}
print
("
\n
");
print
("
\n
");
}
# Do the sources.
print
(
'
#
'
x
80
,
"
\n
"
);
...
...
@@ -65,26 +63,25 @@ print("# SOURCES\n");
print
("
\n
");
my
$source_id
=
0
;
foreach
my
$section
(
$config
->
GroupMembers
('
source
')
)
{
my
$source_name
=
substr
(
$section
,
7
);
foreach
my
$section
(
sort
(
$config
->
GroupMembers
('
source
')
)
)
{
my
$source_name
=
substr
(
$section
,
7
);
$config
->
newval
(
$section
,
'
id
',
++
$source_id
);
$config
->
newval
(
$section
,
'
id
',
++
$source_id
);
printf
(
"
# Source '%s' (id = %d)
\n
",
$source_name
,
$source_id
);
printf
(
"
# Source '%s' (id = %d)
\n
",
$source_name
,
$source_id
);
print
(
"
INSERT INTO source
"
.
"
(name, source_release, download, ordered,
"
.
"
priority, priority_description)
\n
"
);
print
(
"
INSERT INTO source
"
.
"
(name, source_release, download, ordered,
"
.
"
priority, priority_description)
\n
"
);
printf
(
"
VALUES ('%s', '1', '%s', %d, %d, '%s');
\n
",
$config
->
val
(
$section
,
'
name
'
),
$config
->
val
(
$section
,
'
download
'
),
$config
->
val
(
$section
,
'
order
'
),
$config
->
val
(
$section
,
'
priority
'
),
$config
->
val
(
$section
,
'
prio_descr
'
)
);
print
("
\n
");
printf
(
"
VALUES ('%s', '1', '%s', %d, %d, '%s');
\n
",
$config
->
val
(
$section
,
'
name
'
),
$config
->
val
(
$section
,
'
download
'
),
$config
->
val
(
$section
,
'
order
'
),
$config
->
val
(
$section
,
'
priority
'
),
$config
->
val
(
$section
,
'
prio_descr
'
)
);
print
("
\n
");
}
# Do the data files.
...
...
@@ -93,52 +90,51 @@ print( '#' x 80, "\n" );
print
("
# DATA FILES
\n
");
print
("
\n
");
foreach
my
$species_section
(
$config
->
GroupMembers
('
species
')
)
{
my
$species_name
=
substr
(
$species_section
,
8
);
foreach
my
$species_section
(
sort
(
$config
->
GroupMembers
('
species
')
)
)
{
my
$species_name
=
substr
(
$species_section
,
8
);
my
@taxonomy_ids
=
split
(
/\n/
,
$config
->
val
(
$species_section
,
'
taxonomy_id
'
)
);
my
@taxonomy_ids
=
split
(
/\n/
,
$config
->
val
(
$species_section
,
'
taxonomy_id
'
)
);
my
$species_id
=
$taxonomy_ids
[
0
];
print
(
'
#
',
'
-
'
x
79
,
"
\n
"
);
printf
(
"
# Data for species '%s' (id = %d)
\n
",
$species_name
,
$species_id
);
print
(
'
#
',
'
-
'
x
79
,
"
\n
"
);
print
("
\n
");
my
$species_id
=
$taxonomy_ids
[
0
];
print
(
'
#
',
'
-
'
x
79
,
"
\n
"
);
printf
(
"
# Data for species '%s' (id = %d)
\n
",
$species_name
,
$species_id
);
print
(
'
#
',
'
-
'
x
79
,
"
\n
"
);
print
("
\n
");
foreach
my
$source_name
(
split
(
/\n/
,
$config
->
val
(
$species_section
,
'
source
'
)
)
)
{
my
$source_section
=
sprintf
(
"
source %s
",
$source_name
);
foreach
my
$source_name
(
sort
(
split
(
/\n/
,
$config
->
val
(
$species_section
,
'
source
'
)
)
)
)
{
my
$source_section
=
sprintf
(
"
source %s
",
$source_name
);
printf
(
"
# Data from source '%s' (id = %d)
\n
",
$source_name
,
$config
->
val
(
$source_section
,
'
id
'
)
);
printf
(
"
# Data from source '%s' (id = %d)
\n
",
$source_name
,
$config
->
val
(
$source_section
,
'
id
'
)
);
print
(
"
INSERT INTO source_url
"
.
"
(source_id, species_id, url, release_url,
"
.
"
file_modified_date, upload_date, parser)
\n
"
);
print
(
"
INSERT INTO source_url
"
.
"
(source_id, species_id, url, release_url,
"
.
"
file_modified_date, upload_date, parser)
\n
"
);
my
@uris
=
split
(
/\n/
,
$config
->
val
(
$source_section
,
'
data_uri
',
''
)
);
my
@uris
=
split
(
/\n/
,
$config
->
val
(
$source_section
,
'
data_uri
',
''
)
);
my
$release_uri
=
$config
->
val
(
$source_section
,
'
release_uri
'
);
my
$release_uri
=
$config
->
val
(
$source_section
,
'
release_uri
'
);
if
(
$release_uri
!~
/\w/
)
{
$release_uri
=
'
\N
';
}
else
{
$release_uri
=
"
'
$release_uri
'
";
}
if
(
$release_uri
!~
/\w/
)
{
$release_uri
=
'
\N
';
}
else
{
$release_uri
=
"
'
$release_uri
'
";
}
printf
(
"
VALUES (%d, %d, '%s', %s, now(), now(), '%s');
\n
",
$config
->
val
(
$source_section
,
'
id
'
),
$species_id
,
join
(
'
',
@uris
),
$release_uri
,
$config
->
val
(
$source_section
,
'
parser
'
)
);
printf
(
"
VALUES (%d, %d, '%s', %s, now(), now(), '%s');
\n
",
$config
->
val
(
$source_section
,
'
id
'
),
$species_id
,
join
(
'
',
@uris
),
$release_uri
,
$config
->
val
(
$source_section
,
'
parser
'
)
);
print
("
\n
");
}
## end foreach my $source_name ( s
pli
t...
print
("
\n
");
}
## end foreach my $source_name ( s
or
t...
}
## end foreach my $species_section...
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