Exemple #1
0
    def initUI(self):

        self.setWindowTitle('Import PDB Options')

        vertical_layout = QtWidgets.QVBoxLayout()

        # Installation options label.
        info_text = "Please select the 3D structure import mode:"
        self.fetch_info_label = QtWidgets.QLabel(info_text, self)
        # self.fetch_info_label.setStyleSheet(label_style_1)
        vertical_layout.addWidget(self.fetch_info_label)

        vertical_layout.addStretch(1)

        # Import options radiobuttons.
        horizontal_layout = QtWidgets.QHBoxLayout()

        self.import_all_radiobutton = QtWidgets.QRadioButton(
            "Import in PyMod the structure of every chain of the PDB files.")
        # self.import_all_radiobutton.setChecked(True)
        # self.import_all_radiobutton.setStyleSheet(label_font_1)
        vertical_layout.addWidget(self.import_all_radiobutton)
        self.import_fragment_radiobutton = QtWidgets.QRadioButton(
            "Import in PyMod only the structure of the hit sequences fragments."
        )
        # label_font_1
        self.import_fragment_radiobutton.setStyleSheet("margin-bottom: 10px")
        vertical_layout.addWidget(self.import_fragment_radiobutton)

        # Import fragments button.
        self.import_button = QtWidgets.QPushButton("Import 3D Structures",
                                                   self)
        # self.import_button.setStyleSheet(label_style_2)
        self.import_button.clicked.connect(self.on_import_button_click)
        horizontal_layout.addWidget(self.import_button)

        horizontal_layout.addStretch(1)

        # Cancel button.
        self.cancel_button = QtWidgets.QPushButton('Cancel', self)
        # self.cancel_button.setStyleSheet(label_style_2)
        self.cancel_button.clicked.connect(self.on_cancel_button_click)
        horizontal_layout.addWidget(self.cancel_button)

        vertical_layout.addLayout(horizontal_layout)
        self.setLayout(vertical_layout)
Exemple #2
0
    def build_protocol_middle_frame(self):

        #------------------
        # Simple options. -
        #------------------

        # Let users decide how to import new sequences when the query is a child element (that
        # is, it is already present in a cluster).
        if self.protocol.blast_query_element.is_child():

            self.import_mode_vbox = QtWidgets.QVBoxLayout()
            self.import_mode_label = QtWidgets.QLabel("Hit Import Mode")
            self.import_mode_vbox.addWidget(self.import_mode_label)

            self.import_mode_button_group = QtWidgets.QButtonGroup()
            self.middle_formlayout.addRow(self.import_mode_vbox)

            # Build new alignment.
            new_alignment_radiobutton = QtWidgets.QRadioButton("Build a new alignment with the query and the new hit sequences")
            new_alignment_radiobutton._value = "build-new"
            new_alignment_radiobutton.setChecked(True)
            self.import_mode_vbox.addWidget(new_alignment_radiobutton)
            self.import_mode_button_group.addButton(new_alignment_radiobutton)

            # Expand alignment.
            expand_alignment_radiobutton = QtWidgets.QRadioButton("Expand the existing alignment by appending the new hit sequences")
            # "Expand the already existing cluster by appending to it the new hit sequences"
            expand_alignment_radiobutton._value = "expand"
            self.import_mode_vbox.addWidget(expand_alignment_radiobutton)
            self.import_mode_button_group.addButton(expand_alignment_radiobutton)


        # Each algorithm will have its own standard widgets.
        self.build_algorithm_standard_options_widgets()


        # E-value selection.
        if self.protocol.protocol_name in hmmer_protocols_names:
            e_value_threshold_enf_text = "c-Evalue Threshold"
        else:
            e_value_threshold_enf_text = "E-value Threshold"

        self.e_value_threshold_enf = PyMod_entryfield_qt(label_text=e_value_threshold_enf_text,
                                                         value=str(self.protocol.e_value_threshold_default),
                                                         validate={'validator': 'real',
                                                                   'min': 0.0, 'max': 1000.0})
        self.middle_formlayout.add_widget_to_align(self.e_value_threshold_enf, validate=True)


        # Max hit number selection.
        self.max_hits_enf = PyMod_entryfield_qt(label_text="Max Number of Hits",
                                                value=str(self.protocol.default_max_number_of_hits),
                                                validate={'validator': 'integer',
                                                          'min': 1, 'max': 5000})
        self.middle_formlayout.add_widget_to_align(self.max_hits_enf, validate=True)


        # -------------------
        # Advanced options. -
        # -------------------

        self.show_advanced_button()

        # Minimum id% on with query.
        self.min_id_enf = PyMod_entryfield_qt(label_text="Min Id% Threshold",
                                              value="0",
                                              validate={'validator': 'integer',
                                                        'min': 0, 'max': 100})
        self.middle_formlayout.add_widget_to_align(self.min_id_enf, advanced_option=True, validate=True)


        # Maximum id% on with query.
        self.max_id_enf = PyMod_entryfield_qt(label_text="Max Id% Threshold",
                                              value="100",
                                              validate={'validator': 'integer',
                                                        'min': 0, 'max': 100})
        self.middle_formlayout.add_widget_to_align(self.max_id_enf, advanced_option=True, validate=True)


        # Minimum coverage on the query.
        self.min_coverage_enf = PyMod_entryfield_qt(label_text="Min Coverage% Threshold",
                                                    value="0",
                                                    validate={'validator': 'integer',
                                                              'min': 0, 'max': 100})
        self.middle_formlayout.add_widget_to_align(self.min_coverage_enf, advanced_option=True, validate=True)


        # Advanced options for a specific algorithm.
        self.build_algorithm_advanced_options_widgets()


        self.middle_formlayout.set_input_widgets_width("auto")
Exemple #3
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())
Exemple #4
0
    def build_strategy_specific_modes_frames(self):

        #----------------------------
        # Rebuild an old alignment. -
        #----------------------------

        if self.protocol.rebuild_single_alignment_choice:
            new_alignment_rb_text = "Rebuild alignment"
            new_alignment_rb_help = "Rebuild the alignment with all its sequences."
            self.new_alignment_radiobutton = QtWidgets.QRadioButton(new_alignment_rb_text)
            self.new_alignment_radiobutton.clicked.connect(self.click_on_build_new_alignment_radio)
            self.new_alignment_radiobutton._value = "rebuild-old-alignment"
            self.new_alignment_radiobutton.setChecked(True)
            self.alignment_mode_vbox.addWidget(self.new_alignment_radiobutton)
            self.alignment_mode_button_group.addButton(self.new_alignment_radiobutton)
            return None

        #------------------------------------------------------
        # Build a new alignment using the selected sequences. -
        #------------------------------------------------------

        new_alignment_rb_text = "Build a new alignment"
        new_alignment_rb_help = "Build a new alignment from scratch using the selected sequences."
        self.new_alignment_radiobutton = QtWidgets.QRadioButton(new_alignment_rb_text)
        self.new_alignment_radiobutton.clicked.connect(self.click_on_build_new_alignment_radio)
        self.new_alignment_radiobutton._value = "build-new-alignment"
        self.new_alignment_radiobutton.setChecked(True)
        self.alignment_mode_vbox.addWidget(self.new_alignment_radiobutton)
        self.alignment_mode_button_group.addButton(self.new_alignment_radiobutton)

        #--------------------
        # Alignment joiner. -
        #--------------------

        # This can be performed only if there is one selected child per cluster.
        if len(self.protocol.involved_clusters_list) > 1 and self.protocol.check_alignment_joining_selection():
            # alignment_joiner_rb_text = "Join the alignments using the selected sequences as bridges (see 'Alignment Joining')."
            self.join_alignments_radiobutton = QtWidgets.QRadioButton("Join Alignments")
            self.join_alignments_radiobutton.clicked.connect(self.click_on_alignment_joiner_radio)
            self.join_alignments_radiobutton._value = "alignment-joining"
            self.alignment_mode_vbox.addWidget(self.join_alignments_radiobutton)
            self.alignment_mode_button_group.addButton(self.join_alignments_radiobutton)


        #---------------------------
        # Keep previous alignment. -
        #---------------------------

        # Right now it can be used only when the user has selected one sequence in a cluster
        # and one sequence outside a cluster.
        if (# Only one selected cluster.
            len(self.protocol.involved_clusters_list) == 1 and
            # Only one selected sequence in the selected cluster.
            self.protocol.pymod.check_only_one_selected_child_per_cluster(self.protocol.involved_clusters_list[0]) and
            # Only one selected sequence outside any cluster.
            len(self.protocol.selected_root_sequences_list) == 1):

            self.keep_previous_alignment_radiobutton = QtWidgets.QRadioButton("Keep previous alignment")
            self.keep_previous_alignment_radiobutton.clicked.connect(self.click_on_keep_previous_alignment_radio)
            self.keep_previous_alignment_radiobutton._value = "keep-previous-alignment"
            self.alignment_mode_vbox.addWidget(self.keep_previous_alignment_radiobutton)
            self.alignment_mode_button_group.addButton(self.keep_previous_alignment_radiobutton)
Exemple #5
0
        def __init__(self):
            QtWidgets.QWidget.__init__(self, parent, Qt.Window)
            self.setMinimumSize(400, 500)
            self.setWindowTitle('Register File Extensions')

            self.model = QtGui.QStandardItemModel(self)

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

            label = QtWidgets.QLabel(
                "Select file types to register them with PyMOL", self)
            layout.addWidget(label)

            alluserslayout = QtWidgets.QHBoxLayout()
            alluserslayout.setObjectName("alluserslayout")
            layout.addLayout(alluserslayout)

            buttonlayout = QtWidgets.QHBoxLayout()
            buttonlayout.setObjectName("buttonlayout")
            layout.addLayout(buttonlayout)

            self.table = QtWidgets.QTableView(self)
            self.table.setModel(self.model)
            layout.addWidget(self.table)

            button = QtWidgets.QPushButton("Register Recommended (*)", self)
            buttonlayout.addWidget(button)
            button.pressed.connect(self.setRecommended)

            button = QtWidgets.QPushButton("Register All", self)
            buttonlayout.addWidget(button)
            button.pressed.connect(self.setAll)

            button = QtWidgets.QPushButton("Clear", self)
            button.setToolTip("Clean up Registry")
            buttonlayout.addWidget(button)
            button.pressed.connect(self.clear)

            if isAdmin():
                r0 = QtWidgets.QRadioButton("Only for me")
                r0.setToolTip("HKEY_CURRENT_USER registry branch")
                r0.setChecked(True)
                r1 = QtWidgets.QRadioButton("For all users")
                r1.setToolTip("HKEY_LOCAL_MACHINE registry branch")
                allusersgroup = QtWidgets.QButtonGroup(self)
                allusersgroup.addButton(r0)
                allusersgroup.addButton(r1)
                allusersgroup.buttonClicked.connect(self.populateData)
                alluserslayout.addWidget(r0)
                alluserslayout.addWidget(r1)
                alluserslayout.addStretch()
                self.allusersbutton = r1
            else:
                self.allusersbutton = None

            self.finalize_timer = QtCore.QTimer()
            self.finalize_timer.setSingleShot(True)
            self.finalize_timer.setInterval(500)
            self.finalize_timer.timeout.connect(finalize)

            self.populateData()

            # keep reference to window, otherwise Qt will auto-close it
            self._self_ref = self