Skip to content

Commit ff555e9

Browse files
author
Jon Hill
committed
Adding warning to UIs re clean_data
1 parent b00f54d commit ff555e9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

stk/stk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def main():
371371

372372
# Clean data
373373
parser_cm = subparsers.add_parser('clean_data',
374-
help='Remove errant taxa, uninformative trees and empty sources.'
374+
help='Renames all sources and trees sensibly. Removes errant taxa, uninformative trees and empty sources.'
375375
)
376376
parser_cm.add_argument('input',
377377
help='The input phyml file')

stk/supertree_toolkit.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3132,9 +3132,11 @@ def clean_data(XML):
31323132
# check trees are informative
31333133
XML = _check_informative_trees(XML,delete=True)
31343134

3135+
31353136
# check sources
31363137
XML = _check_sources(XML,delete=True)
3137-
3138+
XML = all_sourcenames(XML)
3139+
31383140
# fix tree names
31393141
XML = set_unique_names(XML)
31403142
XML = set_all_tree_names(XML,overwrite=True)

stk_gui/stk_gui/interface.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2429,8 +2429,13 @@ def on_clean_data(self, widget = None):
24292429
self.tree.write(f)
24302430
XML = f.getvalue()
24312431
try:
2432-
XML = stk.clean_data(XML)
2433-
XML = stk.all_sourcenames(XML)
2432+
prompt_response = dialogs.prompt(self.main_window,
2433+
"This function will remove data and rename sources and trees. Sure you want to go ahead?", gtk.MESSAGE_WARNING, True)
2434+
if (prompt_response == gtk.RESPONSE_CANCEL or
2435+
prompt_response == gtk.RESPONSE_NO):
2436+
return
2437+
elif prompt_response == gtk.RESPONSE_YES:
2438+
XML = stk.clean_data(XML)
24342439
except NoAuthors as detail:
24352440
dialogs.error(self.main_window,detail.msg)
24362441
return

0 commit comments

Comments
 (0)