Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
BIGSdb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Emmanuel QUEVILLON
BIGSdb
Commits
649e9aba
Commit
649e9aba
authored
May 27, 2016
by
Keith Jolley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Option to reset classification groups.
parent
55e64f47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
scripts/automation/cluster.pl
scripts/automation/cluster.pl
+28
-4
No files found.
scripts/automation/cluster.pl
View file @
649e9aba
...
...
@@ -54,8 +54,12 @@ my $log_conf =
Log::
Log4perl
->
init
(
\
$log_conf
);
my
$logger
=
Log::Log4perl::
get_logger
('
BIGSdb.Script
');
my
%opts
;
GetOptions
(
'
cscheme=i
'
=>
\
$opts
{'
cscheme_id
'},
'
database=s
'
=>
\
$opts
{'
database
'},
'
help
'
=>
\
$opts
{'
help
'},
)
or
die
("
Error in command line arguments
\n
");
GetOptions
(
'
cscheme=i
'
=>
\
$opts
{'
cscheme_id
'},
'
database=s
'
=>
\
$opts
{'
database
'},
'
help
'
=>
\
$opts
{'
help
'},
'
reset
'
=>
\
$opts
{'
reset
'}
)
or
die
("
Error in command line arguments
\n
");
if
(
$opts
{'
help
'}
)
{
show_help
();
exit
;
...
...
@@ -82,6 +86,10 @@ my $script = BIGSdb::Offline::Script->new(
die
"
This script can only be run against a seqdef database.
\n
"
if
(
$script
->
{'
system
'}
->
{'
dbtype
'}
//
''
)
ne
'
sequences
';
perform_sanity_checks
();
if
(
$opts
{'
reset
'}
)
{
reset_scheme
();
exit
;
}
main
();
$script
->
db_disconnect
;
...
...
@@ -139,6 +147,19 @@ sub main {
return
;
}
sub
reset_scheme
{
eval
{
$script
->
{'
db
'}
->
do
(
'
DELETE FROM classification_groups WHERE cg_scheme_id=?
',
undef
,
$opts
{'
cscheme_id
'}
);
};
if
(
$@
)
{
$script
->
{'
db
'}
->
rollback
;
die
"
$@
\n
";
}
$script
->
{'
db
'}
->
commit
;
say
"
Classification group
$opts
{'cscheme_id'} reset.
";
return
;
}
sub
merge_groups
{
my
(
$groups
,
$merged_group_id
,
$comment
)
=
@_
;
my
$scheme_id
=
get_cscheme_info
()
->
{'
scheme_id
'};
...
...
@@ -277,8 +298,8 @@ sub get_ungrouped_profiles {
}
sub
get_cscheme_info
{
return
$script
->
{'
datastore
'}
->
run_query
(
'
SELECT * FROM classification_schemes WHERE id=?
',
$opts
{'
cscheme_id
'},
{
fetch
=>
'
row_hashref
'
}
);
return
$script
->
{'
datastore
'}
->
run_query
(
'
SELECT * FROM classification_schemes WHERE id=?
',
$opts
{'
cscheme_id
'},
{
fetch
=>
'
row_hashref
'
}
);
}
sub
check_cscheme_exists
{
...
...
@@ -320,6 +341,9 @@ ${bold}--database$norm ${under}NAME$norm
$
{
bold
}
--
help$norm
This
help
page
.
$
{
bold
}
--
reset
$norm
Remove
all
groups
and
profiles
currently
defined
for
classification
group
.
HELP
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment