Beispiel #1
0
    def create_move_pdbqt(self):
        move_pdbqt_labelframe = Labelframe(self.root, text="移动受体文件")
        move_pdbqt_labelframe.place(x=10, y=100, width=570, height=50)

        choose_pdbqt_dir = SButton(move_pdbqt_labelframe,
                                   text="选择文件",
                                   x=10,
                                   y=0)
        create_tooltip(choose_pdbqt_dir.button, "选择包含pdbqt受体的文件夹")
        self.choose_pdbqt_dir_entry = SEntry(
            move_pdbqt_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("pdbqt_dir"),
            x=100,
            y=3,
            width=350)
        create_tooltip(self.choose_pdbqt_dir_entry.entry, "选择包含pdbqt受体的文件夹")
        choose_pdbqt_dir.bind_open_dir(
            self.choose_pdbqt_dir_entry.textvariable, title="选择有pdbqt受体的文件夹")
        move_button = SButton(move_pdbqt_labelframe,
                              text="生成文件",
                              x=460,
                              y=0,
                              width=90)
        create_tooltip(move_button.button, "开始移动pdbqt文件并重命名为preped.pdbqt")
        move_button.button.bind("<Button-1>", self.move_file)
Beispiel #2
0
    def _choose_ligand_frame(self):
        choose_ligand_labelframe = LabelFrame(self.root, text="选择配体")
        choose_ligand_labelframe.place(x=10, y=10, width=570, height=50)

        choose_ligands = SButton(root=choose_ligand_labelframe,
                                 text="选择单/多个配体",
                                 x=10,
                                 y=0)
        create_tooltip(choose_ligands.button, "选择单/多个配体,配体格式必须是pdbqt!")
        choose_ligand_dir = SButton(root=choose_ligand_labelframe,
                                    text="选择文件夹",
                                    x=110,
                                    y=0)
        create_tooltip(choose_ligand_dir.button, "选择包含pdbqt格式配体的文件夹。")
        self.choose_ligand_entry = SEntry(
            root=choose_ligand_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("choose_docking_ligands"),
            x=200,
            y=4,
            width=360)
        create_tooltip(self.choose_ligand_entry.entry, "选择的配体或者包含配体的文件夹")
        choose_ligands.bind_open_files(
            entry_text=self.choose_ligand_entry.textvariable,
            title="选择单/多个配体",
            file_type="pdbqt")
        choose_ligand_dir.bind_open_dir(
            entry_text=self.choose_ligand_entry.textvariable,
            title="选择包含pdbqt配体的文件夹")
Beispiel #3
0
    def vina_validate(self, event):
        self.windows = STopLevel(self.root,
                                 win_x=570,
                                 win_y=50,
                                 title="计算RMSD").toplevel

        # 选择目录
        input_button = SButton(self.windows, text="选择验证目录", x=10, y=10)
        create_tooltip(input_button.button, "选择要验证的目录。该目录必须包含配体和受体!")
        self.input_path_entry = SEntry(
            self.windows,
            textvariable=StringVar(),
            text=Configer.get_para("validate_folder")
            if self.validate_folder == "" else self.validate_folder,
            x=100,
            y=13,
            width=360)
        create_tooltip(self.input_path_entry.entry, "选择的要验证的目录")
        input_button.bind_open_dir(
            entry_text=self.input_path_entry.textvariable,
            title="选择要验证的目录",
            parent=self.windows)

        validate_button = SButton(self.windows, "开始验证", x=465, y=10)
        create_tooltip(validate_button.button, "开始验证Vina方案")
        validate_button.button.bind("<Button-1>", self._vina_validate)

        # 关闭窗口保存参数
        self.windows.protocol(
            "WM_DELETE_WINDOW", lambda: self.save_validate(
                self.windows, self.input_path_entry.textvariable.get()))
Beispiel #4
0
    def create_extract_scores(self):
        extract_scores_labelframe = Labelframe(self.root, text="提取分数")
        extract_scores_labelframe.place(x=10, y=155, width=570, height=50)

        choose_score = SButton(root=extract_scores_labelframe,
                               text="选择单个文件",
                               x=10,
                               y=0)
        create_tooltip(choose_score.button, "选择单个打分结果pdbqt文件")
        choose_scores_dir = SButton(root=extract_scores_labelframe,
                                    text="选择文件夹",
                                    x=100,
                                    y=0)
        create_tooltip(choose_scores_dir.button, "选择多个打分结果所在的文件夹")
        self.choose_scores_entry = SEntry(
            root=extract_scores_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("choose_score_file"),
            x=190,
            y=4,
            width=260)
        create_tooltip(self.choose_scores_entry.entry, "选择的文件/文件夹")
        choose_score.bind_open_file(self.choose_scores_entry.textvariable,
                                    title="选择对接结果pdbqt文件",
                                    file_type="pdbqt")
        choose_scores_dir.bind_open_dir(self.choose_scores_entry.textvariable,
                                        title="选择含有对接结果的文件夹")
        extract_button = SButton(extract_scores_labelframe,
                                 text="提取分数",
                                 x=460,
                                 y=0,
                                 width=90)
        create_tooltip(extract_button.button, "提取分数结果。如果是单个文件直接显示窗口。"
                       "如果选择文件夹,则输出txt文件到选择的文件夹")
        extract_button.button.bind("<Button-1>", self.extract_score)
Beispiel #5
0
    def _choose_ligand_frame(self):
        choose_ligand_labelframe = LabelFrame(self.root, text="选择/提取配体")
        choose_ligand_labelframe.place(x=10, y=10, width=570, height=120)

        # 选择输入配体的格式
        SLabel(root=choose_ligand_labelframe, text="输入格式:",
               x=10, y=0)
        input_format_text = ("pdbqt", "sdf", "pdb")
        self.input_format = SCombbox(root=choose_ligand_labelframe, textvariable=StringVar(),
                                     values=input_format_text,
                                     default_value=Configer.get_para("complex_ligand_format"),
                                     x=80, y=0, width=60)
        create_tooltip(self.input_format.combobox, "导入配体的格式")

        # 选择第几个配体
        SLabel(root=choose_ligand_labelframe, text="选择第",
               x=160, y=0)
        self.complex_ligand_num_entry = SEntry(choose_ligand_labelframe, textvariable=StringVar(),
                                               text=Configer.get_para("complex_ligand_num"),
                                               x=205, y=2, width=20)
        create_tooltip(self.complex_ligand_num_entry.entry, "只针对多构象pdbqt文件。输入"
                                                            "要进行复合或者提取的构象。"
                                                            "如果为0则全部提取/复合")
        SLabel(root=choose_ligand_labelframe, text="个构象",
               x=230, y=0)

        # 选择配体
        choose_ligands_button = SButton(choose_ligand_labelframe, text="选择单/多个配体", x=10, y=30)
        create_tooltip(choose_ligands_button.button, "选择一个或者多个所选格式的配体")
        choose_ligand_dir_button = SButton(choose_ligand_labelframe, text="选择文件夹", x=110, y=30)
        create_tooltip(choose_ligand_dir_button.button, "选择包含配体的文件夹,匹配其中所选格式的文件")
        self.choose_ligands_entry = SEntry(root=choose_ligand_labelframe, textvariable=StringVar(),
                                           text=Configer.get_para("choose_complex_ligands"),
                                           x=200, y=34, width=360)
        create_tooltip(self.choose_ligands_entry.entry, "所选的配体或者包含配体的目录")
        choose_ligands_button.bind_open_files(entry_text=self.choose_ligands_entry.textvariable,
                                              title="选择单/多个配体",
                                              file_type=self.input_format.textvariable)
        choose_ligand_dir_button.bind_open_dir(entry_text=self.choose_ligands_entry.textvariable,
                                               title="选择包含配体文件的文件夹")

        # 选择单独输出配体文件夹
        choose_output_button = SButton(choose_ligand_labelframe, text="提取配体输出路径", x=10, y=65)
        create_tooltip(choose_output_button.button, "单独提取配体,选择要输出的文件夹。")
        self.extract_output_entry = SEntry(choose_ligand_labelframe,
                                           textvariable=StringVar(),
                                           text=Configer.get_para("extract_pdbqt_dir"),
                                           x=120, y=65 + 3, width=340)
        create_tooltip(self.extract_output_entry.entry, "输出的文件夹")
        choose_output_button.bind_open_dir(entry_text=self.extract_output_entry.textvariable,
                                           title="选择提取配体输出的文件夹")
        extract_button = SButton(choose_ligand_labelframe, text="提取选定的配体",
                                 x=470, y=65)
        extract_button.button.bind("<Button-1>", self.extract)
        create_tooltip(extract_button.button, "提取配体")
Beispiel #6
0
    def create_buttons(self):
        gen_smi_button = SButton(self.root, text="分子生成器", x=10, y=10)
        create_tooltip(gen_smi_button.button, "根据smi生成不同取代基衍生物")
        gen_smi_button.button.bind("<Button-1>", self.gen_smi)

        cal_rmsd_button = SButton(self.root, text="计算小分子RMSD", x=110, y=10)
        create_tooltip(cal_rmsd_button.button, "计算两个小分子之间的RMSD值。")
        cal_rmsd_button.button.bind("<Button-1>", self.cal_rmsd)

        vina_validate_button = SButton(self.root, text="Vina一键验证", x=230, y=10)
        create_tooltip(vina_validate_button.button,
                       "一键验证某个含有配体的蛋白是否可以用于Vina对接。")
        vina_validate_button.button.bind("<Button-1>", self.vina_validate)
Beispiel #7
0
    def choose_chain(self):
        self.chain_list = Listbox(self.choose_chain_tab, width=30, height=10)
        self.chain_list.place(x=10, y=10, width=255, height=150)
        scroll = Scrollbar(self.chain_list)
        scroll.pack(side=RIGHT, fill=Y)
        self.chain_list.configure(yscrollcommand=scroll.set)
        scroll.config(command=self.chain_list.yview)

        pre_button = SButton(self.choose_chain_tab, "上一步", 10, 170)
        pre_button.button.bind("<Button-1>", self.jump_model)

        next_button = SButton(self.choose_chain_tab, "下一步", 165, 170)
        next_button.button.bind("<Button-1>", self.jump_ligand)
Beispiel #8
0
    def choose_ligand(self):
        self.ligand_list = Listbox(self.choose_ligand_tab, width=30, height=10)
        self.ligand_list.place(x=10, y=10, width=255, height=150)
        scroll = Scrollbar(self.ligand_list)
        scroll.pack(side=RIGHT, fill=Y)
        self.ligand_list.configure(yscrollcommand=scroll.set)
        scroll.config(command=self.ligand_list.yview)

        pre_button = SButton(self.choose_ligand_tab, "上一步", 10, 170)
        pre_button.button.bind("<Button-1>", self.jump_chain)

        next_button = SButton(self.choose_ligand_tab, "提取配体", 165, 170)
        create_tooltip(next_button.button, "提取选中的配体为pdbqt格式")
        next_button.button.bind("<Button-1>", self.save_ligand)
Beispiel #9
0
    def create_download_receptor(self):
        # frame创建
        download_receptor_labelframe = LabelFrame(self.root, text="下载受体")
        download_receptor_labelframe.place(x=LEFT_X,
                                           y=LEFT_Y,
                                           width=FULL_NOTEBOOK_WIDTH,
                                           height=TAB1_LABEL_FRAME_HEIGHT)

        # 第一排,输入pdbid
        SLabel(download_receptor_labelframe, "PDBID:", x=LEFT_X, y=0)
        self.pdb_id_entry = SEntry(download_receptor_labelframe,
                                   textvariable=StringVar(),
                                   text=Configer.get_para("pdbid"),
                                   x=70,
                                   y=0,
                                   width=50)
        create_tooltip(self.pdb_id_entry.entry, "请输入四位PDB的ID")

        # 第二排,保存位置
        pdb_save_path_button = SButton(download_receptor_labelframe,
                                       text="选择保存的路径",
                                       x=LEFT_X,
                                       y=30)
        create_tooltip(pdb_save_path_button.button, "选择下载受体要保存的位置")
        self.pdb_save_path_entry = SEntry(download_receptor_labelframe,
                                          textvariable=StringVar(),
                                          text=Configer.get_para("pdb_path"),
                                          x=110,
                                          y=34,
                                          width=440)
        create_tooltip(self.pdb_save_path_entry.entry, "文件将要保存的目录,不存在将创建文件夹")
        pdb_save_path_button.bind_open_dir(
            entry_text=self.pdb_save_path_entry.textvariable, title="选择要保存的路径")

        # 第三排,开始下载
        download_pdb_button = SButton(download_receptor_labelframe,
                                      text="开始下载",
                                      x=LEFT_X,
                                      y=60)
        create_tooltip(download_pdb_button.button, "从Protein Data Bank下载受体")
        download_pdb_button.button.bind("<Button-1>", self.download_pdb)
        self.download_progressbar = Progressbar(download_receptor_labelframe,
                                                mode="determinate")
        self.download_progressbar.place(x=100, y=62, width=380)
        create_tooltip(self.download_progressbar, "下载进度")

        self.download_state_label = SLabel(download_receptor_labelframe,
                                           text="没有下载",
                                           x=490,
                                           y=60)
Beispiel #10
0
    def _start_docking(self):
        y = 250
        docking_button = SButton(root=self.root, text="开始对接", x=10, y=y)
        create_tooltip(docking_button.button, "使用Vina进行对接")

        self.progress = Progressbar(self.root, mode="determinate")
        self.progress.place(x=100, y=y + 2, width=400)
        create_tooltip(self.progress, "对接进度")

        self.progress_label = SLabel(self.root, text="没有任务", x=510, y=y)
        docking_button.button.bind("<Button-1>", self._docking)

        text_y = 276
        current_protein_frame = Frame(self.root, width=200, height=40)
        current_protein_frame.place(x=10, y=text_y)
        self.current_protein = SLabel(root=current_protein_frame,
                                      text="",
                                      x=0,
                                      y=0)
        current_ligand_frame = Frame(self.root, width=200, height=50)
        current_ligand_frame.place(x=220, y=text_y)
        self.current_ligand = SLabel(root=current_ligand_frame,
                                     text="",
                                     x=0,
                                     y=0)
        current_time_frame = Frame(self.root, width=150, height=50)
        current_time_frame.place(x=430, y=text_y)
        self.current_time = SLabel(root=current_time_frame, text="", x=0, y=0)
Beispiel #11
0
 def _create_convert(self):
     y = 230
     convert_button = SButton(root=self.root, x=10, y=y, text="开始转换")
     create_tooltip(convert_button.button, "开始转换")
     self.progress = Progressbar(self.root, mode="determinate")
     self.progress.place(x=100, y=y + 2, width=400)
     create_tooltip(self.progress, "转换进度")
     self.progress_label = SLabel(self.root, text="没有任务", x=510, y=y)
     convert_button.button.bind("<Button-1>", self._start_convert)
Beispiel #12
0
    def extract_from_file(self):
        extract_from_file_labelframe = Labelframe(self.root, text="从文件提取配体")
        extract_from_file_labelframe.place(x=10, y=210, width=570, height=85)

        choose_file_button = SButton(extract_from_file_labelframe,
                                     text="选择输入文件",
                                     x=10,
                                     y=0)
        create_tooltip(choose_file_button.button, "选择输入的txt文件")
        self.choose_output_entry = SEntry(extract_from_file_labelframe,
                                          textvariable=StringVar(),
                                          text=Configer.get_para("output_txt"),
                                          x=100,
                                          y=3,
                                          width=450)
        create_tooltip(self.choose_output_entry.entry, "选择的txt文件")
        choose_file_button.bind_open_file(
            entry_text=self.choose_output_entry.textvariable,
            title="选择输入的txt文件",
            file_type="txt")

        choose_output_button = SButton(extract_from_file_labelframe,
                                       text="选择提取目录",
                                       x=10,
                                       y=33)
        create_tooltip(choose_output_button.button, "选择提取输出的目录")
        self.choose_extract_folder_entry = SEntry(
            extract_from_file_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("extract_folder"),
            x=100,
            y=33,
            width=350)
        create_tooltip(self.choose_extract_folder_entry.entry, "选择提取输出的目录")
        choose_output_button.bind_open_dir(
            entry_text=self.choose_extract_folder_entry.textvariable,
            title="选择输出目录")
        extract_button = SButton(extract_from_file_labelframe,
                                 text="提取配体",
                                 x=460,
                                 y=30,
                                 width=90)
        create_tooltip(extract_button.button, "根据输入的文件提取配体")
        extract_button.button.bind("<Button-1>", self.extract_file)
Beispiel #13
0
    def gen_smi(self, event):
        self.windows = STopLevel(self.root,
                                 win_x=570,
                                 win_y=100,
                                 title="分子生成器").toplevel

        # 输入smi
        SLabel(self.windows, text="输入smi", x=10, y=10)
        self.input_smi_entry = SEntry(self.windows,
                                      textvariable=StringVar(),
                                      text=Configer.get_para("input_smi") if
                                      self.input_smi == "" else self.input_smi,
                                      x=80,
                                      y=13,
                                      width=470)
        create_tooltip(self.input_smi_entry.entry, "输入含有[R]的smi文本")

        # 输出目录
        output_button = SButton(self.windows, text="选择输出目录", x=10, y=50)
        create_tooltip(output_button.button, "选择衍生物输出的目录")
        self.output_path_entry = SEntry(
            self.windows,
            textvariable=StringVar(),
            text=Configer.get_para("mol_output_path")
            if self.output_path == "" else self.output_path,
            x=100,
            y=53,
            width=360)
        create_tooltip(self.output_path_entry.entry, "选择衍生物mol的输出目录")
        output_button.bind_open_dir(
            entry_text=self.output_path_entry.textvariable,
            title="选择衍生物输出目录",
            parent=self.windows)

        gen_button = SButton(self.windows, "生成衍生物", x=465, y=50)
        create_tooltip(gen_button.button, "开始生成衍生物")
        gen_button.button.bind("<Button-1>", self._gen_smi)

        # 关闭窗口保存参数
        self.windows.protocol(
            "WM_DELETE_WINDOW", lambda: self.save_smi(
                self.windows, self.input_smi_entry.textvariable.get(),
                self.output_path_entry.textvariable.get()))
Beispiel #14
0
    def _create_choose_ligand_frame(self):
        choose_ligand_labelframe = LabelFrame(self.root, text="输入选项")
        choose_ligand_labelframe.place(x=10, y=10, width=570, height=85)

        # 选择输入配体的格式
        SLabel(root=choose_ligand_labelframe, text="输入格式:", x=10, y=0)
        input_format_text = ("mol", "sdf", "mol2", "pdb", "pdbqt", "xyz")
        self.input_format = SCombbox(
            root=choose_ligand_labelframe,
            textvariable=StringVar(),
            values=input_format_text,
            default_value=Configer.get_para("input_format"),
            x=80,
            y=0,
            width=60)
        create_tooltip(self.input_format.combobox, "导入配体的格式")

        choose_ligands_button = SButton(choose_ligand_labelframe,
                                        text="选择单/多个配体",
                                        x=10,
                                        y=30)
        create_tooltip(choose_ligands_button.button, "选择一个或者多个所选格式的配体")
        choose_ligand_dir_button = SButton(choose_ligand_labelframe,
                                           text="选择文件夹",
                                           x=110,
                                           y=30)
        create_tooltip(choose_ligand_dir_button.button,
                       "选择包含配体的文件夹,匹配其中所选格式的文件")
        self.choose_ligands_entry = SEntry(
            root=choose_ligand_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("choose_ligands"),
            x=200,
            y=34,
            width=360)
        create_tooltip(self.choose_ligands_entry.entry, "所选的配体或者包含配体的目录")
        choose_ligands_button.bind_open_files(
            entry_text=self.choose_ligands_entry.textvariable,
            title="选择单/多个配体",
            file_type=self.input_format.textvariable)
        choose_ligand_dir_button.bind_open_dir(
            entry_text=self.choose_ligands_entry.textvariable,
            title="选择包含配体文件的文件夹")
Beispiel #15
0
    def _create_output_frame(self):
        output_frame = LabelFrame(self.root, text="输出配置文件")
        output_frame.place(x=10, y=250, width=570, height=50)

        # 输出配置文件
        output_config_button = SButton(output_frame, "选择输出目录", 10, 0)
        create_tooltip(output_config_button.button, "选择config.txt输出的目录")
        self.output_config_entry = SEntry(
            root=output_frame,
            textvariable=StringVar(),
            text=Configer.get_para("output_config"),
            x=100,
            y=4,
            width=360)
        create_tooltip(self.output_config_entry.entry, "输出config.txt文件的位置")
        output_config_button.bind_open_dir(
            self.output_config_entry.textvariable, title="选择输出目录")
        gen_config_button = SButton(output_frame, "输出", 470, 0)
        create_tooltip(gen_config_button.button, "开始输出")
        gen_config_button.button.bind("<Button-1>", self.output_config)
Beispiel #16
0
    def _create_tools_frame(self):
        tools_frame = LabelFrame(self.root, text="工具")
        tools_frame.place(x=10, y=140, width=570, height=100)

        # 读取配置文件
        read_config_button = SButton(tools_frame, "读取配置文件", 10, 10)
        create_tooltip(read_config_button.button, "必须选择config.txt文件!")
        self.read_config_entry = SEntry(root=tools_frame,
                                        textvariable=StringVar(),
                                        text=Configer.get_para("read_config"),
                                        x=100,
                                        y=14,
                                        width=360)
        create_tooltip(self.read_config_entry.entry, "你选择的config.txt文件位置")
        read_config_button.bind_open_file(
            entry_text=self.read_config_entry.textvariable,
            title="请选择config.txt文件",
            file_type="txt")
        read_button = SButton(tools_frame, "读取到参数", 470, 10)
        create_tooltip(read_button.button, "读取到上方")
        read_button.button.bind("<Button-1>", self.read_config)

        # 自动生成盒子
        choose_raw_ligand_button = SButton(tools_frame, "读取共晶配体", 10, 40)
        create_tooltip(choose_raw_ligand_button.button, "必须选择共晶配体pdbqt文件!")
        self.choose_raw_ligand_entry = SEntry(
            root=tools_frame,
            textvariable=StringVar(),
            text=Configer.get_para("choose_raw_ligand"),
            x=100,
            y=44,
            width=360)
        choose_raw_ligand_button.bind_open_file(
            entry_text=self.choose_raw_ligand_entry.textvariable,
            title="请选择“共晶配体”PDBQT文件!",
            file_type="pdbqt")
        create_tooltip(self.choose_raw_ligand_entry.entry, "你选择的共晶配体pdbqt文件位置")
        gen_box_button = SButton(tools_frame, "计算对接位点", 470, 40)
        create_tooltip(gen_box_button.button, "自动计算对接位点,该对接位点为共晶配体的"
                       "最小外切正方体,结果仅供参考。")
        gen_box_button.button.bind("<Button-1>", self.gen_box)
Beispiel #17
0
    def create_all_config(self):
        all_config_labelframe = LabelFrame(self.root, text="受体全局对接")
        all_config_labelframe.place(x=10, y=10, width=570, height=85)

        choose_ligand = SButton(all_config_labelframe, text="选择配体", x=10, y=0)
        create_tooltip(choose_ligand.button, "选择参考配体pdbqt文件")
        self.choose_ligand_entry = SEntry(
            all_config_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("refer_ligand"),
            x=100,
            y=3,
            width=450)
        create_tooltip(self.choose_ligand_entry.entry, "选择的参考配体")
        choose_ligand.bind_open_file(self.choose_ligand_entry.textvariable,
                                     title="选择配体pdbqt文件",
                                     file_type="pdbqt")

        choose_receptor = SButton(all_config_labelframe,
                                  text="选择受体",
                                  x=10,
                                  y=30)
        create_tooltip(choose_receptor.button, "选择需要全局搜索的单/多个受体文件夹,具体请看帮助或者教程")
        self.choose_receptor_entry = SEntry(
            all_config_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("refer_receptor"),
            x=100,
            y=33,
            width=350)
        create_tooltip(self.choose_receptor_entry.entry, "选择的参考")
        choose_receptor.bind_open_dir(
            entry_text=self.choose_receptor_entry.textvariable,
            title="选择单/多个受体所在文件夹")
        generate_button = SButton(all_config_labelframe,
                                  text="生成文件",
                                  x=460,
                                  y=30,
                                  width=90)
        create_tooltip(generate_button.button, "生成全局对接的多个config文件")
        generate_button.button.bind("<Button-1>", self.generate_configs)
Beispiel #18
0
    def _choose_output_frame(self):
        choose_output_labelframe = LabelFrame(self.root, text="复合物输出")
        choose_output_labelframe.place(x=10, y=190, width=570, height=50)

        choose_output = SButton(root=choose_output_labelframe, text="选择输出文件夹", x=10, y=0)
        create_tooltip(choose_output.button, "选择复合物输出目录")
        self.choose_output_entry = SEntry(root=choose_output_labelframe, textvariable=StringVar(),
                                          text=Configer.get_para("choose_complex_output"),
                                          x=110, y=4, width=450)
        create_tooltip(self.choose_output_entry.entry, "所选的复合物输出目录")
        choose_output.bind_open_dir(entry_text=self.choose_output_entry.textvariable,
                                    title="选择复合物输出的文件夹")
Beispiel #19
0
    def _choose_protein_frame(self):
        choose_protein_labelframe = LabelFrame(self.root, text="选择受体")
        choose_protein_labelframe.place(x=10, y=135, width=570, height=50)

        choose_proteins = SButton(root=choose_protein_labelframe, text="选择受体", x=10, y=0)
        create_tooltip(choose_proteins.button, "选择pdbqt格式的受体")
        self.choose_proteins_entry = SEntry(root=choose_protein_labelframe, textvariable=StringVar(),
                                            text=Configer.get_para("choose_complex_proteins"),
                                            x=110, y=4, width=450)
        create_tooltip(self.choose_proteins_entry.entry, "受体文件")
        choose_proteins.bind_open_file(entry_text=self.choose_proteins_entry.textvariable,
                                       title="选择蛋白受体", file_type="pdbqt")
Beispiel #20
0
 def choose_obabel(self):
     y = 50  # python路径
     choose_obabel_path = SButton(self.top,
                                  text="选择obabel.exe的路径",
                                  x=10, y=y)
     create_tooltip(choose_obabel_path.button, "选择obabel.exe文件")
     self.choose_obabel_path_entry = SEntry(root=self.top,
                                            textvariable=StringVar(),
                                            text=Configer.get_para("obabel_path"),
                                            x=150, y=y + 4, width=230)
     create_tooltip(self.choose_obabel_path_entry.entry, "obabel.exe位置")
     choose_obabel_path.bind_open_file(entry_text=self.choose_obabel_path_entry.textvariable,
                                       title="选择obabel.exe",
                                       file_type="exe", parent=self.top)
Beispiel #21
0
 def choose_python(self):
     y = 10
     # python路径
     choose_python_path = SButton(self.top,
                                  text="选择ADT的python路径",
                                  x=10, y=y)
     create_tooltip(choose_python_path.button, "必须选择mgltools目录里面的python.exe文件!\n"
                                               "比如:\nC:/mgltools/python.exe")
     self.choose_python_path_entry = SEntry(root=self.top,
                                            textvariable=StringVar(),
                                            text=Configer.get_para("python_path"),
                                            x=150, y=y + 4, width=230)
     create_tooltip(self.choose_python_path_entry.entry, "ADT的python路径")
     choose_python_path.bind_open_file(entry_text=self.choose_python_path_entry.textvariable,
                                       title="选择ADT中的python.exe",
                                       file_type="exe", parent=self.top)
Beispiel #22
0
    def choose_model(self):
        # 禁用后两个
        self.notebook.tab(1, state="disable")
        self.notebook.tab(2, state="disable")

        self.model_list = Listbox(self.choose_model_tab, width=30, height=10)

        model_ids = ReceptorProcessor.get_model_ids(self.structure)
        Tab1.refresh_listbox(model_ids, self.model_list)

        self.model_list.place(x=10, y=10, width=255, height=150)
        scroll = Scrollbar(self.model_list)
        scroll.pack(side=RIGHT, fill=Y)
        self.model_list.configure(yscrollcommand=scroll.set)
        scroll.config(command=self.model_list.yview)

        next_button = SButton(self.choose_model_tab, "下一步", 165, 170)
        next_button.button.bind("<Button-1>", self.jump_chain)
Beispiel #23
0
    def _create_option_frame(self):
        option_label_frame = LabelFrame(self.root, text="可选")
        option_label_frame.place(x=340, y=10, width=240, height=120)

        # exhaustiveness
        SLabel(option_label_frame, text="exhaustiveness = ", x=10, y=5)
        self.exhaustiveness = SEntry(option_label_frame,
                                     textvariable=StringVar(),
                                     text=Configer.get_para("exhaustiveness"),
                                     x=140,
                                     y=5,
                                     width=20)
        create_tooltip(self.exhaustiveness.entry, "搜索度,越大耗时越长,建议保持默认")

        # num_modes
        SLabel(option_label_frame, text="num_modes = ", x=10, y=35)
        self.num_modes = SEntry(option_label_frame,
                                textvariable=StringVar(),
                                text=Configer.get_para("num_modes"),
                                x=140,
                                y=35,
                                width=20)
        create_tooltip(self.num_modes.entry, "最多生成多少种结合模式")

        # energy_range
        SLabel(option_label_frame, text="energy_range = ", x=10, y=65)
        self.energy_range = SEntry(option_label_frame,
                                   textvariable=StringVar(),
                                   text=Configer.get_para("energy_range"),
                                   x=140,
                                   y=65,
                                   width=20)

        create_tooltip(self.energy_range.entry, "最大最小结合模式能量差")

        # 恢复默认值
        default_button = SButton(option_label_frame,
                                 text="默认",
                                 x=170,
                                 y=62,
                                 width=60)
        default_button.button.bind("<Button-1>", self._change_default)
        create_tooltip(default_button.button, "恢复默认值")
Beispiel #24
0
    def getinfo(self, event):
        # 获取受体
        receptor = self.choose_raw_receptor_entry.textvariable.get()

        if not receptor.endswith(".pdb"):
            messagebox.showerror("错误!", "只支持查看单个pdb格式的文件信息!")
            return
        if Check.check_path(receptor):
            messagebox.showerror("错误", "受体路径不能包含空格!")
            return
        if not os.path.exists(receptor):
            messagebox.showerror("错误", "所选文件或者文件夹不存在!")
            return

        structure = ReceptorProcessor.get_structure(receptor)

        window = STopLevel(self.root, 500, 400, "PDB信息").toplevel
        wrap_length = 480

        s_name = structure.header["name"]
        SLabel(window, "受体名称:\n" + s_name, 10,
               10).label.configure(wraplength=wrap_length)

        s_redate = structure.header["release_date"]
        SLabel(window, "发布时间:\n" + s_redate, 10,
               70).label.configure(wraplength=wrap_length)

        s_method = structure.header["structure_method"]
        SLabel(window, "方法:\n" + s_method, 10,
               130).label.configure(wraplength=wrap_length)

        s_resolution = str(structure.header["resolution"])
        SLabel(window, "分辨率:\n" + s_resolution + "埃", 10,
               190).label.configure(wraplength=wrap_length)

        s_refe = structure.header["journal_reference"]
        reference = SLabel(window, "参考文献:\n" + s_refe, 10, 250).label
        reference.configure(wraplength=wrap_length)
        doi_url = "http://www.doi.org/" + s_refe.strip().split(" ")[-1]
        open_url_button = SButton(window, "打开文献网页", 75, 245)
        open_url_button.button.configure(
            command=lambda: webbrowser.open(doi_url))
        create_tooltip(open_url_button.button, "使用默认浏览器打开文献链接")
Beispiel #25
0
    def _start_join(self):
        y = 250
        join_button = SButton(root=self.root, text="结合", x=10, y=y)
        create_tooltip(join_button.button, "将配体和受体结合成一个文件")
        join_button.button.bind("<Button-1>", self._join)

        self.progress = Progressbar(self.root, mode="determinate")
        self.progress.place(x=100, y=y + 2, width=400)
        create_tooltip(self.progress, "结合进度")

        self.progress_label = SLabel(self.root, text="没有任务", x=510, y=y)

        text_y = 286
        current_ligand_frame = Frame(self.root, width=400, height=40)
        current_ligand_frame.place(x=10, y=text_y)
        self.current_ligand = SLabel(root=current_ligand_frame, text="", x=0, y=0)

        # 是否保留提取配体
        self.remain_ligand = SCheckbutton(self.root
                                          , text="保留提取构象", variable=StringVar(),
                                          value=Configer.get_para("remain_ligand"),
                                          x=10, y=text_y + 20)
        create_tooltip(self.remain_ligand.checkbutton, "保留提取或者转换的构象。")
Beispiel #26
0
    def _choose_protein_frame(self):
        choose_protein_labelframe = LabelFrame(self.root, text="选择受体")
        choose_protein_labelframe.place(x=10, y=70, width=570, height=50)

        choose_proteins = SButton(root=choose_protein_labelframe,
                                  text="选择受体文件夹",
                                  x=10,
                                  y=0)
        create_tooltip(
            choose_proteins.button, "选择受体文件夹。受体必须命名为preped.pdbqt\n"
            "单个受体请选择包含这个受体的文件夹\n"
            "多个受体请选择包含多个受体文件夹的文件夹\n"
            "详情见帮助及教程")
        self.choose_proteins_entry = SEntry(
            root=choose_protein_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("choose_docking_proteins"),
            x=110,
            y=4,
            width=450)
        create_tooltip(self.choose_proteins_entry.entry, "包含受体的文件夹")
        choose_proteins.bind_open_dir(
            entry_text=self.choose_proteins_entry.textvariable,
            title="选择包含pdbqt受体的文件夹")
Beispiel #27
0
    def create_prepared_receptor(self):
        # 总框架
        prepared_receptor_labelframe = LabelFrame(self.root, text="准备受体")
        prepared_receptor_labelframe.place(x=LEFT_X,
                                           y=130,
                                           width=FULL_NOTEBOOK_WIDTH,
                                           height=170)

        # 第一排,选择受体
        choose_raw_receptor_button = SButton(prepared_receptor_labelframe,
                                             text="选择单个受体",
                                             x=LEFT_X,
                                             y=0)
        create_tooltip(choose_raw_receptor_button.button, "选择要进行准备的单个pdb受体")

        choose_raw_receptors_button = SButton(prepared_receptor_labelframe,
                                              text="选择多个受体",
                                              x=LEFT_X + 90,
                                              y=0)
        create_tooltip(choose_raw_receptors_button.button,
                       "选择要进行准备的包含多个pdb受体的文件夹")

        self.choose_raw_receptor_entry = SEntry(
            prepared_receptor_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("raw_receptor_path"),
            x=190,
            y=3,
            width=270)
        create_tooltip(self.choose_raw_receptor_entry.entry, "选择的受体")

        # 绑定打开事件
        choose_raw_receptor_button.bind_open_file(
            entry_text=self.choose_raw_receptor_entry.textvariable,
            title="选择受体pdb文件",
            file_type="pdb")
        choose_raw_receptors_button.bind_open_dir(
            entry_text=self.choose_raw_receptor_entry.textvariable,
            title="选择包含pdb受体文件的文件夹")

        get_info_button = SButton(prepared_receptor_labelframe,
                                  text="受体信息",
                                  x=470,
                                  y=0)
        get_info_button.button.bind("<Button-1>", self.getinfo)
        create_tooltip(get_info_button.button, "查看受体信息")

        # 第二排,提取配体保存的路径
        ligand_save_path_button = SButton(prepared_receptor_labelframe,
                                          text="配体输出路径",
                                          x=10,
                                          y=30)
        create_tooltip(ligand_save_path_button.button, "选择提取的配体要保存的位置")
        self.ligand_save_path_entry = SEntry(
            prepared_receptor_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("extract_ligand_path"),
            x=100,
            y=33,
            width=360)
        create_tooltip(self.ligand_save_path_entry.entry,
                       "提取的配体保存的目录,不存在将创建文件夹")
        ligand_save_path_button.bind_open_dir(
            entry_text=self.ligand_save_path_entry.textvariable,
            title="选择要保存的路径")

        save_ligand_button = SButton(prepared_receptor_labelframe,
                                     text="提取配体",
                                     x=470,
                                     y=30)
        save_ligand_button.button.bind("<Button-1>", self.extract_ligand)
        create_tooltip(save_ligand_button.button, "提取受体中的配体")

        # 第三排,准备受体
        save_prepared_receptor_button = SButton(prepared_receptor_labelframe,
                                                text="受体输出路径",
                                                x=LEFT_X,
                                                y=60)
        create_tooltip(save_prepared_receptor_button.button, "选择准备后的受体保存路径")
        self.choose_prepare_output_path = SEntry(
            prepared_receptor_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("preped_path"),
            x=100,
            y=63,
            width=360)
        create_tooltip(self.choose_prepare_output_path.entry, "准备后的受体输出目录")
        save_prepared_receptor_button.bind_open_dir(
            self.choose_prepare_output_path.textvariable, title="选择输出目录")

        prepare_receptor_button = SButton(prepared_receptor_labelframe,
                                          text="准备受体",
                                          x=470,
                                          y=60)
        prepare_receptor_button.button.bind("<Button-1>",
                                            self.prepared_receptor)
        create_tooltip(prepare_receptor_button.button, "开始准备受体")

        # 第四排,准备选项
        fourth_y = 90
        SLabel(prepared_receptor_labelframe,
               text="ADT参数",
               x=LEFT_X,
               y=fourth_y)
        SLabel(prepared_receptor_labelframe, text="修复", x=100, y=fourth_y)
        fix_text = ("bonds_hydrogens", "bonds", "hydrogens", "checkhydrogens",
                    "None")
        self.fix_method = SCombbox(
            root=prepared_receptor_labelframe,
            textvariable=StringVar(),
            values=fix_text,
            default_value=Configer.get_para("fix_method"),
            x=135,
            y=fourth_y,
            width=140)
        create_tooltip(
            self.fix_method.combobox, "使用ADT方法修复受体\n"
            "bonds_hydrogens:修复键级和加氢\n"
            "bonds:修复键级\n"
            "hydrogens:加氢\n"
            "checkhydrogens:没有氢的地方加氢\n"
            "None:不进行修复")
        self.preserve_charges = SCheckbutton(
            prepared_receptor_labelframe,
            text="保留电荷",
            variable=StringVar(),
            value=Configer.get_para("preserve_charges"),
            x=290,
            y=fourth_y)
        create_tooltip(self.preserve_charges.checkbutton,
                       "勾选则保留输入电荷,不勾选添加gasteiger电荷")
        SLabel(prepared_receptor_labelframe, text="|", x=380, y=fourth_y - 2)
        self.is_fix_receptor = SCheckbutton(
            prepared_receptor_labelframe,
            text="Biopython功能",
            variable=StringVar(),
            value=Configer.get_para("fix_receptor"),
            x=400,
            y=fourth_y)
        create_tooltip(
            self.is_fix_receptor.checkbutton, "只针对单个受体。可以用来检测同源链,提取特定链,"
            "修复受体(修复断链等)。"
            "具体修复方法参见biopython官方文档")

        # 第五排,清理格式
        fifth_y = 120
        SLabel(prepared_receptor_labelframe, text="受体处理", x=LEFT_X, y=fifth_y)
        self.nphs = SCheckbutton(prepared_receptor_labelframe,
                                 text="nphs",
                                 variable=StringVar(),
                                 value=Configer.get_para("nphs"),
                                 x=LEFT_X + 90,
                                 y=fifth_y)
        create_tooltip(self.nphs.checkbutton, "合并非极性氢")
        self.lps = SCheckbutton(prepared_receptor_labelframe,
                                text="lps",
                                variable=StringVar(),
                                value=Configer.get_para("lps"),
                                x=LEFT_X + 150,
                                y=fifth_y)
        create_tooltip(self.lps.checkbutton, "合并电荷,去除孤对电子")
        self.waters = self.waters = SCheckbutton(
            prepared_receptor_labelframe,
            text="waters",
            variable=StringVar(),
            value=Configer.get_para("waters"),
            x=LEFT_X + 200,
            y=fifth_y)
        create_tooltip(self.waters.checkbutton, "去除水")
        self.nonstdres = self.nonstdres = SCheckbutton(
            prepared_receptor_labelframe,
            text="nonstdres",
            variable=StringVar(),
            value=Configer.get_para("nonstdres"),
            x=LEFT_X + 270,
            y=fifth_y)
        create_tooltip(self.nonstdres.checkbutton, "去除非标准氨基酸链(核酸等)")
Beispiel #28
0
    def prepared_receptor(self, event):
        input_file = self.choose_raw_receptor_entry.textvariable.get()
        output_path = self.choose_prepare_output_path.textvariable.get()

        fix_receptor = int(self.is_fix_receptor.variable.get())
        fix_method = self.fix_method.textvariable.get()
        preserve_charges = int(self.preserve_charges.variable.get())
        nphs = int(self.nphs.variable.get())
        lps = int(self.lps.variable.get())
        waters = int(self.waters.variable.get())
        nonstdres = int(self.nonstdres.variable.get())

        if not Check.check_python():
            return

        if Check.check_path(input_file) or Check.check_path(output_path):
            messagebox.showinfo("错误!", "输入输出文件不能包含空格")
            return

        if not os.path.exists(input_file):
            messagebox.showerror("错误", "所选文件或者文件夹不存在!")
            return

        if os.path.isdir(input_file):
            # 选择的是文件夹,批量准备受体
            receptors = get_receptors(input_file)
            input_dir = input_file
            for receptor in receptors:
                input_file = input_dir + os.sep + receptor
                output_file = output_path + os.sep + receptor + "qt"
                # 准备失败则继续
                if not prepare_receptor(input_file, output_file, fix_method,
                                        preserve_charges, nphs, lps, waters,
                                        nonstdres):
                    continue
            messagebox.showinfo("成功", "成功准备受体!\n注意:自动准备会删除DNA等非标准残基,结果仅供参考。")
        elif input_file.endswith(".pdb"):
            # 如果勾选biopython功能
            if fix_receptor:
                message = ChainExtractor.judge_homo(input_file)
                # 包含同源链。选择同源链,保存到chains列表中。
                if message:
                    warning = ""
                    for content in message:
                        warning += content + "\n"
                    if messagebox.askyesno("检测到同源链",
                                           "是否保留只保留特定链?(可多选)\n" + warning):
                        structure = ReceptorProcessor.get_structure(input_file)
                        chains_ids = ReceptorProcessor.get_chain_ids(
                            structure[0])

                        top = STopLevel(self.root, 275, 205,
                                        "选择要保存的链").toplevel

                        chains_list = Listbox(top,
                                              width=30,
                                              height=10,
                                              selectmode=EXTENDED)
                        chains_list.place(x=10, y=10, width=255, height=150)
                        self.refresh_listbox(chains_ids, chains_list)
                        scroll = Scrollbar(chains_list)
                        scroll.pack(side=RIGHT, fill=Y)
                        chains_list.configure(yscrollcommand=scroll.set)
                        scroll.config(command=chains_list.yview)

                        def extract_chains():
                            Tab1.chains = []
                            selections = chains_list.curselection()
                            for select in selections:
                                Tab1.chains.append(chains_list.get(select))
                            top.destroy()

                        save_button = SButton(top, "提取链", 10, 170)
                        save_button.button.configure(command=extract_chains)

                        def cancel():
                            Tab1.chains = None
                            top.destroy()

                        cancel_button = SButton(top, "取消", 165, 170)
                        cancel_button.button.configure(command=cancel)

                        top.protocol("WM_DELETE_WINDOW", cancel)

                        self.root.wait_window(top)
                    else:
                        Tab1.chains = []
                else:
                    messagebox.showinfo("没有检测到同源链", "尝试使用biopython进行修复……")
                    Tab1.chains = []

                if Tab1.chains is None:
                    return

                structure = ReceptorProcessor.get_structure(input_file)
                output_file = output_path + os.sep + "bio_fix_" + os.path.split(
                    input_file)[-1]
                ChainExtractor.extract_chain(structure, Tab1.chains,
                                             output_file)
                messagebox.showinfo("成功!", "成功保存到%s" % output_file)
            else:
                # 没有勾选,直接转换单个文件为pdbqt文件
                output_file = output_path + os.sep + "preped.pdbqt"
                if prepare_receptor(input_file, output_file, fix_method,
                                    preserve_charges, nphs, lps, waters,
                                    nonstdres):
                    messagebox.showinfo(
                        "成功", "成功准备受体!\n注意:自动准备会删除DNA等非标准残基,结果仅供参考。")
                else:
                    messagebox.showerror("准备失败", "无法准备受体,请根据命令行查看原因。")
                    return
        else:
            messagebox.showinfo("错误!", "不支持输入内容,请确定是文件夹或者pdb文件")
            return
Beispiel #29
0
    def _create_output_ligand_frame(self):
        choose_output_ligand_labelframe = LabelFrame(self.root, text="输出选项")
        choose_output_ligand_labelframe.place(x=10,
                                              y=100,
                                              width=570,
                                              height=115)

        # 第一排
        first_y = 0
        SLabel(root=choose_output_ligand_labelframe,
               text="输出格式:",
               x=10,
               y=first_y)
        output_format_text = ("pdbqt", "pdb", "sdf", "xyz")
        self.output_format = SCombbox(
            root=choose_output_ligand_labelframe,
            textvariable=StringVar(),
            values=output_format_text,
            default_value=Configer.get_para("output_format"),
            x=80,
            y=0,
            width=60)
        create_tooltip(self.output_format.combobox, "导出配体的格式")

        # 第二排
        second_y = 30
        # 生成3d
        SLabel(root=choose_output_ligand_labelframe,
               text="选      项:",
               x=10,
               y=second_y)
        self.gen3d = SCheckbutton(root=choose_output_ligand_labelframe,
                                  text="3d",
                                  variable=StringVar(),
                                  value=Configer.get_para("gen3d"),
                                  x=150,
                                  y=second_y)
        create_tooltip(self.gen3d.checkbutton, "是否生成三维坐标。\n"
                       "输入配体是平面结构时,请勾选。\n"
                       "输入配体时立体结构时,不建议勾选。")

        # pH
        SLabel(root=choose_output_ligand_labelframe,
               text="pH",
               x=80,
               y=second_y)
        self.ph = SEntry(root=choose_output_ligand_labelframe,
                         textvariable=StringVar(),
                         text=Configer.get_para("pH"),
                         x=110,
                         y=second_y + 2,
                         width=30)
        create_tooltip(
            self.ph.entry, "按照一定的规则在指定pH生成质子化状态。为obabel内置"
            "方法,对某些氨基酸可能会发生变化,结果不一定可靠。")

        # 能量最小化
        self.is_minimize = SCheckbutton(choose_output_ligand_labelframe,
                                        text="能量最小化",
                                        variable=StringVar(),
                                        value=Configer.get_para("is_minimize"),
                                        x=200,
                                        y=second_y)
        create_tooltip(self.is_minimize.checkbutton, "是否对分子进行能量最小化")
        self.is_minimize.checkbutton.bind("<Button-1>", self._disable_minimize)
        SLabel(root=choose_output_ligand_labelframe,
               text="力场",
               x=290,
               y=second_y)
        minimize_value = ("MMFF94", "MMFF94s", "GAFF", "Chemical", "UFF")
        self.minimize = SCombbox(root=choose_output_ligand_labelframe,
                                 textvariable=StringVar(),
                                 values=minimize_value,
                                 default_value=Configer.get_para("minimize"),
                                 x=325,
                                 y=second_y,
                                 width=100)
        create_tooltip(self.minimize.combobox, "能量最小化使用的力场,推荐MMFF94")

        # 默认
        default_button = SButton(root=choose_output_ligand_labelframe,
                                 text="默认",
                                 x=450,
                                 y=second_y - 2)
        default_button.button.bind("<Button-1>", self._default)
        create_tooltip(default_button.button, "恢复默认值")

        # 初始化状态
        if self.is_minimize.variable.get(
        ) == "0" or self.is_minimize.variable.get() == "":
            self.minimize.combobox.configure(state="disable")

        # 第三排
        third_y = 60
        choose_output_dir_button = SButton(choose_output_ligand_labelframe,
                                           text="选择输出文件夹",
                                           x=10,
                                           y=third_y)
        create_tooltip(choose_output_dir_button.button, "选择配体输出的文件夹")
        self.choose_output_dir_entry = SEntry(
            root=choose_output_ligand_labelframe,
            textvariable=StringVar(),
            text=Configer.get_para("ligand_output_dir"),
            x=110,
            y=third_y + 4,
            width=450)
        create_tooltip(self.choose_output_dir_entry.entry, "所选的输出目录")
        choose_output_dir_button.bind_open_dir(
            entry_text=self.choose_output_dir_entry.textvariable,
            title="选择要输出配体的文件夹")
Beispiel #30
0
    def cal_rmsd(self, event):
        self.windows = STopLevel(self.root,
                                 win_x=570,
                                 win_y=130,
                                 title="计算RMSD").toplevel

        # 参考配体
        single_ligand_button = SButton(self.windows, text="选择参考配体", x=10, y=10)
        create_tooltip(single_ligand_button.button, "选择一个参考配体,只支持xyz格式")
        self.single_ligand_entry = SEntry(
            self.windows,
            textvariable=StringVar(),
            text=Configer.get_para("single_ligand")
            if self.single_ligand == "" else self.single_ligand,
            x=100,
            y=13,
            width=450)
        create_tooltip(self.single_ligand_entry.entry, "选择的参考配体")
        single_ligand_button.bind_open_file(
            entry_text=self.single_ligand_entry.textvariable,
            title="选择参考配体",
            file_type="xyz",
            parent=self.windows)

        # 比较配体
        sec_ligand_button = SButton(self.windows, text="选择第二个配体", x=10, y=50)
        create_tooltip(sec_ligand_button.button, "选择需要比较的单个配体")
        sec_ligands_button = SButton(self.windows, text="选择文件夹", x=110, y=50)
        create_tooltip(sec_ligands_button.button, "选择第二个配体所在的文件夹")

        self.sec_ligands_entry = SEntry(
            self.windows,
            textvariable=StringVar(),
            text=Configer.get_para("sec_ligands")
            if self.sec_ligands == "" else self.sec_ligands,
            x=200,
            y=53,
            width=350)
        create_tooltip(self.sec_ligands_entry.entry, "选择需要比较的配体")
        sec_ligand_button.bind_open_file(
            entry_text=self.sec_ligands_entry.textvariable,
            title="选择需要比较的配体",
            file_type="xyz",
            parent=self.windows)
        sec_ligands_button.bind_open_dir(
            entry_text=self.sec_ligands_entry.textvariable,
            title="选择需要比较的配体所在的文件夹",
            parent=self.windows)

        SLabel(root=self.windows, text="旋转方法", x=10, y=90)
        rotate_method_text = ("none", "kabsch", "quaternion")
        self.rotate_method_box = SCombbox(
            root=self.windows,
            textvariable=StringVar(),
            values=rotate_method_text,
            default_value=Configer.get_para("rotate_method")
            if self.rotate_method == "" else self.rotate_method,
            x=70,
            y=90,
            width=85)
        create_tooltip(self.rotate_method_box.combobox, "是否旋转原子和旋转方法")

        SLabel(root=self.windows, text="原子对齐方法", x=170, y=90)
        reorder_method_text = ("hungarian", "distance")
        self.reorder_method_box = SCombbox(
            root=self.windows,
            textvariable=StringVar(),
            values=reorder_method_text,
            default_value=Configer.get_para("reorder_method")
            if self.reorder_method == "" else self.reorder_method,
            x=260,
            y=90,
            width=85)
        create_tooltip(self.rotate_method_box.combobox, "是否旋转原子和旋转方法")

        rmsd_button = SButton(self.windows, "计算RMSD", x=465, y=90)
        create_tooltip(rmsd_button.button, "计算RMSD")
        rmsd_button.button.bind("<Button-1>", self._cal_rmsd)

        # 关闭窗口保存参数
        self.windows.protocol(
            "WM_DELETE_WINDOW", lambda: self.save_rmsd(
                self.windows, self.single_ligand_entry.textvariable.get(),
                self.sec_ligands_entry.textvariable.get(),
                self.rotate_method_box.textvariable.get(),
                self.reorder_method_box.textvariable.get()))