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
91ec38aa
Commit
91ec38aa
authored
16 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Read new format file: tab separated, and with display_label as 3rd column.
parent
9404819a
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/analysis_description/load_analysis_descriptions.pl
+46
-51
46 additions, 51 deletions
...cripts/analysis_description/load_analysis_descriptions.pl
with
46 additions
and
51 deletions
misc-scripts/analysis_description/load_analysis_descriptions.pl
+
46
−
51
View file @
91ec38aa
...
...
@@ -16,21 +16,21 @@
The script reads the analysis description file also found in this directory
analysis.descriptions and loads the descriptions which match the logic names in
the analysis table
the analysis table
. Display labels are also set from this file.
It will warn about analyses present in the database which don't have descriptions
in the file
in the file
.
=head1 OPTIONS
Database options
Database options
-dbhost host name for database (gets put as host= in locator)
-dbport For RDBs, what port to connect to (port= in locator)
-dbname For RDBs, what name to connect to (dbname= in locator)
-dbuser For RDBs, what username to connect as (dbuser= in locator)
-dbpass For RDBs, what password to use (dbpass= in locator)
-
description_file p
ath to file containing descriptions. The file
-
file P
ath to file containing descriptions. The file
analysis.descriptions in this directory can be used and is an
example of the format
-help print out documentation
...
...
@@ -58,15 +58,13 @@ my $dbname = '';
my
$file
;
my
$help
=
0
;
&GetOptions
(
'
host|dbhost=s
'
=>
\
$dbhost
,
'
dbname=s
'
=>
\
$dbname
,
'
user|dbuser=s
'
=>
\
$dbuser
,
'
pass|dbpass=s
'
=>
\
$dbpass
,
'
port|dbport=s
'
=>
\
$dbport
,
&GetOptions
('
host|dbhost=s
'
=>
\
$dbhost
,
'
dbname=s
'
=>
\
$dbname
,
'
user|dbuser=s
'
=>
\
$dbuser
,
'
pass|dbpass=s
'
=>
\
$dbpass
,
'
port|dbport=s
'
=>
\
$dbport
,
'
file|descriptions=s
'
=>
\
$file
,
'
h|help!
'
=>
\
$help
,
);
'
h|help!
'
=>
\
$help
);
if
(
!
$dbhost
||
!
$dbname
){
print
("
Need to pass in -dbhost
$dbhost
and -dbname
$dbname
\n
");
...
...
@@ -85,55 +83,52 @@ if($help){
useage
();
}
my
$db
=
new
Bio::EnsEMBL::DBSQL::
DBAdaptor
(
-
host
=>
$dbhost
,
-
user
=>
$dbuser
,
-
dbname
=>
$dbname
,
-
pass
=>
$dbpass
,
-
port
=>
$dbport
,
);
my
$db
=
new
Bio::EnsEMBL::DBSQL::
DBAdaptor
(
-
host
=>
$dbhost
,
-
user
=>
$dbuser
,
-
dbname
=>
$dbname
,
-
pass
=>
$dbpass
,
-
port
=>
$dbport
);
open
(
FH
,
$file
)
or
throw
("
Failed to open
$file
$@
");
my
$aa
=
$db
->
get_AnalysisAdaptor
;
my
$analyses
=
$aa
->
fetch_all
;
my
$aa
=
$db
->
get_AnalysisAdaptor
()
;
my
$analyses
=
$aa
->
fetch_all
()
;
my
%hash
;
foreach
my
$analysis
(
@$analyses
){
$hash
{
lc
(
$analysis
->
logic_name
)}
=
$analysis
;
$hash
{
lc
(
$analysis
->
logic_name
()
)}
=
$analysis
;
}
LINE:while
(
<
FH
>
){
/^(\S+)\s+(\S+)\s+(.+)/
and
do
{
my
(
$displayable
,
$logic_name
,
$description
)
=
(
$
1
,
$
2
,
$
3
);
#print "Parsed ".$displayable." ".$logic_name." ".$description."\n";
$description
=~
s/^\s+//
;
$description
=~
s/\s+$//
;
next
if
not
$description
;
if
(
exists
$hash
{
lc
(
$logic_name
)})
{
my
$analysis
=
$hash
{
lc
(
$logic_name
)};
$analysis
->
description
(
$description
);
$analysis
->
displayable
(
$displayable
);
my
$display_label
=
$logic_name
;
$display_label
=~
s/_//g
;
$analysis
->
display_label
(
$display_label
);
$aa
->
update
(
$analysis
);
delete
$hash
{
lc
(
$logic_name
)};
}
LINE:while
(
my
$row
=
<
FH
>
){
chomp
(
$row
);
next
if
(
$row
=~
/^#/
);
# skip comments
next
if
(
$row
=~
/^$/
);
# and blank lines
next
if
(
$row
=~
/^\s+$/
);
# and whitespace-only lines
my
(
$displayable
,
$logic_name
,
$display_label
,
$description
)
=
split
(
/\t/
,
$row
);
#print join("\t", $displayable, $logic_name, $display_label, $description, "\n");
$description
=~
s/^\s+//
;
$description
=~
s/\s+$//
;
next
if
not
$description
;
if
(
exists
$hash
{
lc
(
$logic_name
)})
{
my
$analysis
=
$hash
{
lc
(
$logic_name
)};
$analysis
->
description
(
$description
);
$analysis
->
displayable
(
$displayable
);
$analysis
->
display_label
(
$display_label
);
$aa
->
update
(
$analysis
);
delete
$hash
{
lc
(
$logic_name
)};
}
}
close
(
FH
)
or
throw
("
Failed to close
$file
$@
");
if
(
scalar
(
keys
%hash
)
==
0
)
{
print
"
\n
All analysis descriptions have been updated, every analysis has a description now
\n
"
;
if
(
scalar
(
keys
%hash
)
==
0
)
{
print
"
\n
All analysis descriptions have been updated, every analysis has a description now
\n
"
;
}
else
{
foreach
my
$k
(
keys
%hash
)
{
warning
"
No description was found for logic name
$k
(
"
.
$hash
{
$k
}
->
dbID
.
"
)
\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