def save_selection(self, mode="selection"):
"""
Save selection in a single file.
"""
# Builds the selection.
selection = None
if mode == "selection":
selection = self.get_selected_sequences()
elif mode == "all":
selection = self.get_all_sequences()
# Ask users if they want to include indels in the sequences to save.
remove_indels_choice = False
for e in selection:
if "-" in e.my_sequence:
remove_indels_choice = tkMessageBox.askyesno(message="Would you like to remove indels from the sequences when saving them to a file?", title="Save Selection", parent=self.main_window)
break
# Ask users to chose a directory where to save the files.
filepath=asksaveasfilename(filetypes=[("fasta","*.fasta")],parent=self.main_window)
if not filepath == "":
dirpath = os.path.dirname(filepath)
filename = os.path.splitext(os.path.basename(filepath))[0]
self.build_sequences_file(selection, filename, file_format="fasta", remove_indels=remove_indels_choice, use_structural_information=False, new_directory=dirpath)
评论列表
文章目录