Пример #1
0
 def setupUi(self, Dialog):
     # Based on auto-generated code from ui file
     from pymol.Qt import QtCore, QtWidgets
     Dialog.resize(400, 50)
     self.gridLayout = QtWidgets.QGridLayout(Dialog)
     label = QtWidgets.QLabel("Select loaded object:", Dialog)
     self.gridLayout.addWidget(label, 0, 0, 1, 1)
     self.select_object_combo_box = QtWidgets.QComboBox(Dialog)
     sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Fixed)
     self.select_object_combo_box.setSizePolicy(sizePolicy)
     self.select_object_combo_box.setEditable(True)
     self.gridLayout.addWidget(self.select_object_combo_box, 0, 1, 1, 1)
     label = QtWidgets.QLabel("Select loaded object:", Dialog)
     self.gridLayout.addWidget(label, 1, 0, 1, 1)
     self.select_object_combo_box2 = QtWidgets.QComboBox(Dialog)
     self.select_object_combo_box2.setSizePolicy(sizePolicy)
     self.select_object_combo_box2.setEditable(True)
     self.gridLayout.addWidget(self.select_object_combo_box2, 1, 1, 1, 1)
     self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
     self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
     self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel
                                       | QtWidgets.QDialogButtonBox.Ok)
     self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
     self.buttonBox.accepted.connect(Dialog.accept)
     self.buttonBox.rejected.connect(Dialog.reject)
Пример #2
0
    def create_combobox_row(self):
        """
        Builds a row with two comboboxes an "Add" button for defining a loop.
        """

        # First residue combobox.
        self.res1_combobox = QtWidgets.QComboBox(
        )  # Select the starting residue:
        for item in self.scrollable_res_list:
            self.res1_combobox.addItem(item)
        self.res1_combobox.setEditable(False)
        self.res1_combobox.setStyleSheet(small_font_style)
        self.res1_combobox.setFixedWidth(
            self.res1_combobox.sizeHint().width() + self.combobox_padding)

        # Second residue combobox.
        self.res2_combobox = QtWidgets.QComboBox(
        )  # Select the ending residue:
        for item in self.scrollable_res_list:
            self.res2_combobox.addItem(item)
        self.res2_combobox.setEditable(False)
        self.res2_combobox.setStyleSheet(small_font_style)
        self.res2_combobox.setFixedWidth(
            self.res2_combobox.sizeHint().width() + self.combobox_padding)

        # "Add" button.
        self.new_loop_button = QtWidgets.QPushButton("Add")
        self.new_loop_button.setStyleSheet(small_font_style)
        self.new_loop_button.clicked.connect(self.press_add_button)
        self.new_loop_button.setFixedWidth(
            self.new_loop_button.sizeHint().width() + self.button_padding)

        self.parent.loop_selector_frame_layout.addWidget(
            self.res1_combobox, self.row, 0)
        self.parent.loop_selector_frame_layout.addWidget(
            self.res2_combobox, self.row, 1)
        self.parent.loop_selector_frame_layout.addWidget(
            self.new_loop_button, self.row, 2)

        User_loop_combo_qt.id_counter += 1
Пример #3
0
    def __init__(self, label_text="Input", items=[]):
        PyMod_form_item.__init__(self)

        # Label.
        self.label = QtWidgets.QLabel(label_text)

        # Combobox.
        self.combobox = QtWidgets.QComboBox()

        if not items:
            raise ValueError("Please provide a list of items for the combobox")
        self.items = items

        for item in self.items:
            self.combobox.addItem(item)
        self.combobox.setEditable(False)
        self.input = self.combobox
def load_aln_dialog(parent, filename, format):
    _self = parent.cmd

    import numpy
    import difflib
    import pymol.seqalign as seqalign

    try:
        # for fasta format, this only succeeds if all sequences have the
        # same length, raises ValueError otherwise
        alignment = seqalign.aln_magic_read(filename)

        # a single sequence is not an aligment
        if format == "fasta" and len(alignment) < 2:
            raise ValueError
    except ValueError:
        # fasta files which don't contain alignments will be loaded as
        # extended structures (fab command) instead
        _self.load(filename)
        return

    # alignment record ids and PyMOL model names
    ids = [rec.id for rec in alignment]
    ids_remain = list(ids)
    models = _self.get_object_list()
    models_remain = list(models)
    mapping = {}

    N = len(ids)
    M = len(models)

    # ids -> models similarity matrix
    similarity = numpy.zeros((N, M))
    for i in range(N):
        for j in range(M):
            similarity[i, j] = difflib.SequenceMatcher(None, ids[i], models[j],
                                                       False).ratio()

    # guess mapping
    for _ in range(min(N, M)):
        i, j = numpy.unravel_index(similarity.argmax(), similarity.shape)
        mapping[ids_remain.pop(i)] = models_remain.pop(j)
        similarity = numpy.delete(similarity, i, axis=0)
        similarity = numpy.delete(similarity, j, axis=1)

    form = parent.load_form('load_aln')
    comboboxes = {}

    # mapping GUI
    for row, rec_id in enumerate(ids, 1):
        label = QtWidgets.QLabel(rec_id, form._dialog)
        combobox = QtWidgets.QComboBox(form._dialog)
        combobox.addItem("")
        combobox.addItems(models)
        combobox.setCurrentText(mapping.get(rec_id, ""))
        form.layout_mapping.addWidget(label, row, 0)
        form.layout_mapping.addWidget(combobox, row, 1)
        comboboxes[rec_id] = combobox

    def run():
        mapping = dict((rec_id, combobox.currentText())
                       for (rec_id, combobox) in comboboxes.items())
        seqalign.load_aln_multi(filename, mapping=mapping, _self=_self)
        form._dialog.close()

    def cancel():
        form._dialog.close()
        if format == 'fasta' and QtWidgets.QMessageBox.question(
                parent, "Load as structures?",
                "Load sequences as extended structures instead?"
        ) == QtWidgets.QMessageBox.Yes:
            _self.load(filename)

    # hook up events
    form.button_ok.clicked.connect(run)
    form.button_cancel.clicked.connect(cancel)

    form._dialog.setModal(True)
    form._dialog.show()
Пример #5
0
def load_aln_dialog(parent, filename):
    _self = parent.cmd

    import numpy
    import difflib
    import pymol.seqalign as seqalign

    try:
        alignment = seqalign.aln_magic_read(filename)
    except ValueError:
        # fails for fasta files which don't contain alignments
        _self.load(filename)
        return

    # alignment record ids and PyMOL model names
    ids = [rec.id for rec in alignment]
    ids_remain = list(ids)
    models = _self.get_object_list()
    models_remain = list(models)
    mapping = {}

    N = len(ids)
    M = len(models)

    # ids -> models similarity matrix
    similarity = numpy.zeros((N, M))
    for i in range(N):
        for j in range(M):
            similarity[i, j] = difflib.SequenceMatcher(None, ids[i], models[j],
                                                       False).ratio()

    # guess mapping
    for _ in range(min(N, M)):
        i, j = numpy.unravel_index(similarity.argmax(), similarity.shape)
        mapping[ids_remain.pop(i)] = models_remain.pop(j)
        similarity = numpy.delete(similarity, i, axis=0)
        similarity = numpy.delete(similarity, j, axis=1)

    form = parent.load_form('load_aln')
    comboboxes = {}

    # mapping GUI
    for row, rec_id in enumerate(ids, 1):
        label = QtWidgets.QLabel(rec_id, form._dialog)
        combobox = QtWidgets.QComboBox(form._dialog)
        combobox.addItem("")
        combobox.addItems(models)
        combobox.setCurrentText(mapping.get(rec_id, ""))
        form.layout_mapping.addWidget(label, row, 0)
        form.layout_mapping.addWidget(combobox, row, 1)
        comboboxes[rec_id] = combobox

    def run():
        mapping = dict((rec_id, combobox.currentText())
                       for (rec_id, combobox) in comboboxes.items())
        seqalign.load_aln_multi(filename, mapping=mapping, _self=_self)
        form._dialog.close()

    # hook up events
    form.button_ok.clicked.connect(run)
    form.button_cancel.clicked.connect(form._dialog.close)

    form._dialog.setModal(True)
    form._dialog.show()
Пример #6
0
    def build_strategy_specific_modes_frames(self):
        """
        Build components of the GUI to show the alignment options.
        """

        #------------------------------------------
        # Perform a profile to profile alignment. -
        #------------------------------------------

        if self.protocol.can_perform_ptp_alignment:
            # profile_profile_rb_text = "Profile to profile: perform a profile to profile alignment."
            profile_profile_rb_text = "Profile to profile"

            self.profile_to_profile_radiobutton = QtWidgets.QRadioButton(profile_profile_rb_text)
            self.profile_to_profile_radiobutton.clicked.connect(self.click_on_profile_to_profile_radio)
            self.profile_to_profile_radiobutton._value = "profile-to-profile"
            self.profile_to_profile_radiobutton.setChecked(True)
            self.alignment_mode_vbox.addWidget(self.profile_to_profile_radiobutton)
            self.alignment_mode_button_group.addButton(self.profile_to_profile_radiobutton)


        #-----------------------------------------
        # Perform sequence to profile alignment. -
        #-----------------------------------------

        sequence_profile_rb_text = None
        build_target_profile_frame = False
        # Shows a different label for the checkbutton if there is one or more clusters involved.
        if len(self.protocol.selected_clusters_list) > 1:
            # sequence_profile_rb_text = "Sequence to profile: align to a target profile the rest of the selected sequences."
            sequence_profile_rb_text = "Sequence to profile"
            build_target_profile_frame = True
        elif len(self.protocol.selected_clusters_list) == 1:
            profile_cluster_name = self.protocol.involved_clusters_list[0].my_header
            # sequence_profile_rb_text = "Sequence to profile: align the selected sequence to the target profile '%s'." % (profile_cluster_name)
            sequence_profile_rb_text = "Sequence to profile"


        # Radiobutton.
        self.sequence_to_profile_radiobutton = QtWidgets.QRadioButton(sequence_profile_rb_text)
        self.sequence_to_profile_radiobutton.clicked.connect(self.click_on_sequence_to_profile_radio)
        self.sequence_to_profile_radiobutton._value = "sequence-to-profile"
        if not self.protocol.can_perform_ptp_alignment:
            self.sequence_to_profile_radiobutton.setChecked(True)
        self.alignment_mode_vbox.addWidget(self.sequence_to_profile_radiobutton)
        self.alignment_mode_button_group.addButton(self.sequence_to_profile_radiobutton)

        # If there is more than one selected cluster, then build a frame to let the user choose
        # which is going to be the target profile.
        if build_target_profile_frame:

            # Frame with the options to choose which is going to be the target profile.
            self.target_profile_frame = QtWidgets.QFormLayout()
            self.alignment_mode_vbox.addLayout(self.target_profile_frame)

            # Label.
            self.target_alignment_label = QtWidgets.QLabel("Target profile:")
            self.target_alignment_label.setStyleSheet("margin-left: 35px")

            # Combobox.
            self.target_alignment_combobox = QtWidgets.QComboBox()
            for cluster in self.protocol.involved_clusters_list:
                self.target_alignment_combobox.addItem(cluster.my_header)
            self.target_alignment_combobox.setEditable(False)

            self.target_profile_frame.addRow(self.target_alignment_label, self.target_alignment_combobox)
            self.target_alignment_combobox.setFixedWidth(self.target_alignment_combobox.sizeHint().width())
Пример #7
0
    def __init__(self, parent=None, app=None):
        super(_BuilderPanel, self).__init__(parent)

        self.setWindowTitle("Builder")
        self.setObjectName("builder")
        self.cmd = app.pymol.cmd

        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)
        self.buttons_layout = QtWidgets.QVBoxLayout()

        self.tabs = QtWidgets.QTabWidget(self)
        self.layout.setContentsMargins(5, 5, 5, 5);
        self.layout.setSpacing(5);
        self.layout.addWidget(self.tabs)
        self.layout.addLayout(self.buttons_layout)
        self.layout.addStretch()

        self.fragments_layout = QtWidgets.QGridLayout()
        self.fragments_layout.setContentsMargins(5, 5, 5, 5);
        self.fragments_layout.setSpacing(5);
        self.fragments_tab = QtWidgets.QWidget()
        self.fragments_tab.setLayout(self.fragments_layout)
        self.protein_layout = QtWidgets.QGridLayout()
        self.protein_layout.setContentsMargins(5, 5, 5, 5);
        self.protein_layout.setSpacing(5);
        self.protein_tab = QtWidgets.QWidget()
        self.protein_tab.setLayout(self.protein_layout)

        self.tabs.addTab(self.fragments_tab, "Chemical")
        self.tabs.addTab(self.protein_tab, "Protein")

        self.getIcons()

        buttons = [
            [ ("H", "Hydrogen", lambda: self.replace("H", 1, 1, "Hydrogen")),
              ("C", "Carbon", lambda: self.replace("C", 4, 4, "Carbon")),
              ("N", "Nitrogen", lambda: self.replace("N", 4, 3, "Nitrogen")),
              ("O", "Oxygen", lambda: self.replace("O", 4, 2, "Oxygen")),
              ("P", "Phosphorus", lambda: self.replace("P",4,3, "Phosphorous")),
              ("S", "Sulfur", lambda: self.replace("S",2,2, "Sulfur")),
              ("F", "Fluorine", lambda: self.replace("F",1,1, "Fluorine")),
              ("Cl", "Chlorrine", lambda: self.replace("Cl",1,1, "Chlorine")),
              ("Br", "Bromine", lambda: self.replace("Br",1,1, "Bromine")),
              ("I", "Iodine", lambda: self.replace("I",1,1, "Iodine")),
              ("-CF3", "Trifluoromethane", lambda: self.replace("trifluoromethane",4,0, "trifluoro")),
              ("-OMe", "Methanol", lambda: self.replace("methanol",5,0, "methoxy")),
            ],
            [ ("CH4", "Methyl", lambda: self.grow("methane",1,0,"methyl")),
              ("C=C", "Ethylene", lambda: self.grow("ethylene",4,0,"vinyl")),
              ("C#C", "Acetylene", lambda: self.grow("acetylene",2,0,"alkynl")),
              ("C#N", "Cyanide", lambda: self.grow("cyanide",2,0,"cyano")),
              ("C=O", "Aldehyde", lambda: self.grow("formaldehyde",2,0,"carbonyl",)),
              ("C=OO", "Formic Acid", lambda: self.grow("formic",4,0,"carboxyl")),
              ("C=ON", "C->N amide", lambda: self.grow("formamide",5,0,"C->N amide")),
              ("NC=O", "N->C amide", lambda: self.grow("formamide",3,1,"N->C amide")),
              ("S=O2", "Sulfone", lambda: self.grow("sulfone",3,1,"sulfonyl")),
              ("P=O3", "Phosphite", lambda: self.grow("phosphite",4,0,"phosphoryl")),
              ("N=O2", "Nitro", lambda: self.grow("nitro",3,0,"nitro")),
            ],
            [
              ("#cyc3", "Cyclopropane", lambda: self.grow("cyclopropane",4,0,"cyclopropyl")),
              ("#cyc4", "Cyclobutane", lambda: self.grow("cyclobutane",4,0,"cyclobutyl")),
              ("#cyc5", "Cyclopentane", lambda: self.grow("cyclopentane",5,0,"cyclopentyl")),
              ("#cyc6", "Cyclohexane", lambda: self.grow("cyclohexane",7,0,"cyclohexyl")),
              ("#cyc7", "Cycloheptane", lambda: self.grow("cycloheptane",8,0,"cycloheptyl")),
              ("#aro5", "Cyclopentadiene", lambda: self.grow("cyclopentadiene",5,0,"cyclopentadienyl")),
              ("#aro6", "Benzene", lambda: self.grow("benzene",6,0,"phenyl")),
              ("#aro65", "Indane", lambda: self.grow("indane",12,0,"indanyl")),
              ("#aro66", "Napthylene", lambda: self.grow("napthylene",13,0,"napthyl")),
              ("#aro67", "Benzocycloheptane", lambda: self.grow("benzocycloheptane",13,0, "benzocycloheptyl")),
            ]
        ]

        self.btn_icons = {}

        requestsize = QtCore.QSize(48, 48)
        for row, btn_row in enumerate(buttons):
            for col, bb in enumerate(btn_row):
                btn_label, btn_tooltip, btn_command = bb
                btn = makeFragmentButton()
                if btn_label.startswith('#'):
                    icons = self.icons[btn_label[1:]]
                    btn.setIcon(icons[0])
                    btn.setIconSize(icons[1].actualSize(requestsize))
                    self.btn_icons[btn] = icons
                else:
                    btn.setText(btn_label)
                btn.setToolTip(btn_tooltip)
                btn.clicked.connect(btn_command)
                self.fragments_layout.addWidget(btn, row, col)

        buttons = [
            [ 'Ace', 'Ala', 'Arg', 'Asn', 'Asp', 'Cys', 'Gln', 'Glu', 'Gly', 'His', 'Ile', 'Leu' ],
            [ 'Lys', 'Met', 'Phe', 'Pro', 'Ser', 'Thr', 'Trp', 'Tyr', 'Val', 'NMe', 'NHH' ]
        ]
        for row, btn_row in enumerate(buttons):
            for col, btn_label in enumerate(btn_row):
                btn = makeFragmentButton()
                btn.setText(btn_label)
                btn.setToolTip("Build %s residue" % btn_label)
                res = btn_label.lower()
                slot = lambda val=None, s=self,r=res: s.attach(r)
                btn.clicked.connect(slot)
                self.protein_layout.addWidget(btn, row, col)

        lab = QtWidgets.QLabel('Secondary Structure:')
        lab_cols = 3
        self.ss_cbox = QtWidgets.QComboBox()
        self.ss_cbox.addItem("Alpha Helix")
        self.ss_cbox.addItem("Beta Sheet (Anti-Parallel)")
        self.ss_cbox.addItem("Beta Sheet (Parallel)")
        self.protein_layout.addWidget(lab, 2, 0, 1, lab_cols)
        self.protein_layout.addWidget(self.ss_cbox, 2, lab_cols, 1, 4)
        self.ss_cbox.currentIndexChanged[int].connect(self.ssIndexChanged)

        buttons = [
            [
              ( "@Atoms:", None, None),
              ( "Fix H", "Fix hydrogens on picked atoms", self.fixH),
              ( "Add H", "Add hydrogens to entire molecule", self.addH),
              ( "Invert", "Invert stereochemistry around pk1 (pk2 and pk3 will remain fixed)", self.invert),
              ( "Delete", "Remove atoms", self.removeAtom),
              ( "Clear", "Delete everything", self.clear),
              ( "@   Charge:", None, None),
              ( " +1 ", "Positive Charge", lambda: self.setCharge(1,"+1")),
              ( "  0 ", "Neutral Charge", lambda: self.setCharge(0,"neutral")),
              ( " -1 ", "Negative Charge", lambda: self.setCharge(-1,"-1")),
            ],
            [
              ( "@Bonds:", None, None),
              ( "Create", "Create bond between pk1 and pk2", self.createBond),
              ( "Delete", "Delete bond between pk1 and pk2", self.deleteBond),
              ( "Cycle", "Cycle bond valence", self.cycleBond),
              ( "  |  ", "Create single bond", lambda: self.setOrder("1", "single")),
              ( " || ", "Create double bond", lambda: self.setOrder("2", "double")),
              ( " ||| ", "Create triple bond", lambda: self.setOrder("3", "triple")),
              ( "Arom", "Create aromatic bond", lambda: self.setOrder("4", "aromatic")),
              ( "@   Model:", None, None),
              ( "Clean", "Cleanup structure", self.clean),
              ( "Sculpt", "Molecular sculpting", self.sculpt),
              ( "Fix", "Fix atom positions", self.fix),
              ( "Rest", "Restrain atom positions", self.rest),
            ],
            [
              ( "$El-stat", "Electrostatics term for 'Clean' action", "clean_electro_mode"),
              ( "@   ", None, None),
              ( "$Bumps", "Show VDW contacts during sculpting", "sculpt_vdw_vis_mode"),
              ( "@   ", None, None),
              ( "#Undo Enabled", "", "suspend_undo"),
              ( "Undo", "Undo last change", self.undo),
              ( "Redo", "Redo last change", self.redo),
            ]
        ]

        for row, btn_row in enumerate(buttons):
            btn_row_layout = QtWidgets.QHBoxLayout()
            self.buttons_layout.addLayout(btn_row_layout)
            for col, bb in enumerate(btn_row):
                btn_label, btn_tooltip, btn_command = bb
                if btn_label[0] == '@':
                    btn = QtWidgets.QLabel(btn_label[1:])
                elif btn_label[0] in ('#', '$'):
                    btn = QtWidgets.QCheckBox(btn_label[1:])
                    setting = btn_command
                    value = self.cmd.get_setting_int(setting)
                    if btn_label[0] == '$':
                        btn.setChecked(bool(value))
                        @btn.toggled.connect
                        def _(checked, n=setting):
                            self.cmd.set(n, checked, quiet=0)
                    else:
                        btn.setChecked(not value)
                        @btn.toggled.connect
                        def _(checked, n=setting):
                            self.cmd.set(n, not checked, quiet=0)
                else:
                    btn = makeFragmentButton()
                    btn.setText(btn_label)
                    btn.clicked.connect(btn_command)
                if btn_tooltip:
                    btn.setToolTip(btn_tooltip)
                btn_row_layout.addWidget(btn)
            btn_row_layout.addStretch()
Пример #8
0
    def __init__(self, parent=None):
        super(SurfStampFrame, self).__init__(parent)

        self.layout = QtWidgets.QVBoxLayout()
        self.setLayout(self.layout)

        glayout1 = QtWidgets.QGridLayout()
        self.label_message = QtWidgets.QLabel(self)
        self.label_message.setText("SurfStamp PyMOL plugin")
        self.layout.addWidget(self.label_message)

        self.combo_model = QtWidgets.QComboBox()
        self.combo_model.addItems([])
        self.layout.addWidget(self.combo_model)

        self.label_reso = QtWidgets.QLabel(self)
        self.label_reso.setText("Surface Resolution")
        glayout1.addWidget(self.label_reso, 1, 0)
        self.spin_reso = QtWidgets.QDoubleSpinBox(self)
        self.spin_reso.setRange(0.1, 1.0)
        self.spin_reso.setSingleStep(0.05)
        self.spin_reso.setValue(0.7)
        glayout1.addWidget(self.spin_reso, 1, 1)

        self.label_imagesize = QtWidgets.QLabel(self)
        self.label_imagesize.setText("Image Size")
        glayout1.addWidget(self.label_imagesize, 2, 0)
        self.spin_imagesize = QtWidgets.QSpinBox(self)
        self.spin_imagesize.setRange(1000, 10000)
        #PILLOW?は 13000 くらいが Max っぽい
        self.spin_imagesize.setSingleStep(100)
        self.spin_imagesize.setValue(4000)
        glayout1.addWidget(self.spin_imagesize, 2, 1)

        self.label_fontsize = QtWidgets.QLabel(self)
        self.label_fontsize.setText("Font Size")
        glayout1.addWidget(self.label_fontsize, 3, 0)
        self.spin_fontsize = QtWidgets.QSpinBox(self)
        self.spin_fontsize.setRange(3, 100)
        self.spin_fontsize.setSingleStep(1)
        self.spin_fontsize.setValue(20)
        glayout1.addWidget(self.spin_fontsize, 3, 1)

        glayout2 = QtWidgets.QGridLayout()
        self.check_outline = QtWidgets.QCheckBox('Outline')
        self.check_outline.setChecked(True)
        glayout2.addWidget(self.check_outline, 0, 0)

        self.check_nowater = QtWidgets.QCheckBox('Remove Waters')
        self.check_nowater.setChecked(True)
        glayout2.addWidget(self.check_nowater, 0, 1)

        self.check_colorall = QtWidgets.QCheckBox('Color All')
        self.check_colorall.setChecked(False)
        glayout2.addWidget(self.check_colorall, 1, 0)

        self.check_tile = QtWidgets.QCheckBox('Repeating Tile')

        self.check_tile.clicked.connect(self.checkTileOn)
        self.check_tile.setChecked(False)
        glayout2.addWidget(self.check_tile, 1, 1)

        self.check_oneletter = QtWidgets.QCheckBox('One Letter')
        glayout2.addWidget(self.check_oneletter, 2, 0)

        self.check_nochainname = QtWidgets.QCheckBox('No Chain Name')
        glayout2.addWidget(self.check_nochainname, 2, 1)

        self.check_ignore_occupancy = QtWidgets.QCheckBox('Ignore Occupancy')
        glayout2.addWidget(self.check_ignore_occupancy, 3, 0)
        self.check_cartoon = QtWidgets.QCheckBox('Cartoon')
        self.check_cartoon.clicked.connect(self.checkCartoonOn)
        glayout2.addWidget(self.check_cartoon, 3, 1)

        self.check_mmcif = QtWidgets.QCheckBox('Use MMCIF')
        glayout2.addWidget(self.check_mmcif, 4, 0)

        self.check_builtin = QtWidgets.QCheckBox('Built-in Surface Generator')
        glayout2.addWidget(self.check_builtin, 4, 1)
        self.check_builtin.clicked.connect(self.checkBuiltinOn)

        #MMCIF は AUTH が不完全だ!
        #self.check_label = QtWidgets.QCheckBox('ID Label');
        #self.layout.addWidget(self.check_label);

        # Text field for output file
        glayout4 = QtWidgets.QVBoxLayout()

        self.label_outprefix = QtWidgets.QLabel(
            'Output Prefix (Prefix+<something> will be overwritten.)')
        glayout4.addWidget(self.label_outprefix)

        glayout4b = QtWidgets.QGridLayout()
        self.text_outprefix = QtWidgets.QLineEdit(self)
        self.text_outprefix.setReadOnly(True)
        glayout4b.addWidget(self.text_outprefix, 0, 0)

        self.button_outprefix = QtWidgets.QPushButton(self)
        self.button_outprefix.setText("Save As")

        self.button_outprefix.clicked.connect(self.getFile)
        self.text_outprefix.setStyleSheet("background-color: lightgray;")

        glayout4b.addWidget(self.button_outprefix, 0, 1)
        glayout4.addLayout(glayout4b)

        glayout3 = QtWidgets.QGridLayout()
        self.button_ok = QtWidgets.QPushButton('Create')
        self.button_ok.clicked.connect(self.runSurfStamp)
        glayout3.addWidget(self.button_ok, 0, 0)

        self.button_close = QtWidgets.QPushButton('Close')
        self.button_close.clicked.connect(self.hide)
        glayout3.addWidget(self.button_close, 0, 1)

        self.layout.addLayout(glayout1)
        self.layout.addLayout(glayout2)
        self.layout.addLayout(glayout4)
        self.layout.addLayout(glayout3)

        screengeom = QtWidgets.qApp.desktop().screenGeometry()

        wwidth = 300
        hheight = 200
        self.setGeometry(screengeom.width() / 2 - wwidth / 2,
                         screengeom.height() / 2 - hheight / 2, wwidth,
                         hheight)
        self.setWindowTitle('SurfStamp')
        self.checkTileOn()
        self.checkBuiltinOn()
        self.checkCartoonOn()
        self.show()