示例#1
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()))
示例#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配体的文件夹")
示例#3
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)
示例#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)
示例#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, "提取配体")
示例#6
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="选择复合物输出的文件夹")
示例#7
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)
示例#8
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)
示例#9
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="选择包含配体文件的文件夹")
示例#10
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()))
示例#11
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)
示例#12
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)
示例#13
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受体的文件夹")
示例#14
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="选择要输出配体的文件夹")
示例#15
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, "去除非标准氨基酸链(核酸等)")
示例#16
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()))