def showProteinParametersAndSequenceEditor(self, win): """ Show/ Hide protein parameters and sequence editor based """ part = win.assy.part from simulation.ROSETTA.rosetta_commandruns import checkIfProteinChunkInPart proteinExists, proteinChunk = checkIfProteinChunkInPart(part) if proteinExists: self._proteinChunkName = proteinChunk.protein.get_pdb_id() + proteinChunk.protein.get_chain_id() self._numberOfAA = len(proteinChunk.protein.get_sequence_string()) else: self._proteinChunkName = '' self._numberOfAA = 0 self.nameLineEdit.setText(self._proteinChunkName) self.numberOfAASpinBox.setValue(self._numberOfAA) if proteinExists: self.nameLineEdit.setEnabled(True) else: self.nameLineEdit.setEnabled(False) self.sequenceEditor = win.createProteinSequenceEditorIfNeeded() #get the sequence for this protein chunk if proteinExists: sequence = proteinChunk.protein.get_sequence_string() self.sequenceEditor.setSequence(sequence) secStructure = proteinChunk.protein.get_secondary_structure_string() self.sequenceEditor.setSecondaryStructure(secStructure) self.sequenceEditor.setRuler(len(secStructure)) self.sequenceEditor.show() else: self.sequenceEditor.hide()
def cursorPosChanged( self ): """ Slot called when the cursor position of the strand textEdit changes. When this happens, this method also changes the cursor position of the 'Mate' text edit. Because of this, both the text edit widgets in the Sequence Editor scroll 'in sync'. """ strandSequence = self.sequenceTextEdit.toPlainText() cursor = self.sequenceTextEdit.textCursor() cursor_mate = self.secStrucTextEdit.textCursor() cursor_mate2 = self.aaRulerTextEdit.textCursor() if cursor.position() == len(self.sequenceTextEdit.toPlainText()): curPos = 0 else: curPos = cursor.position() if cursor_mate.position() != cursor.position(): cursor_mate.setPosition( curPos, QTextCursor.MoveAnchor ) cursor_mate2.setPosition( curPos, QTextCursor.MoveAnchor ) #After setting position, it is important to do setTextCursor #otherwise no effect will be observed. self.secStrucTextEdit.setTextCursor(cursor_mate) self.aaRulerTextEdit.setTextCursor(cursor_mate2) #provide amino acid info as cursor position changes part = self.win.assy.part from simulation.ROSETTA.rosetta_commandruns import checkIfProteinChunkInPart proteinExists, proteinChunk = checkIfProteinChunkInPart(part) position = cursor.position() toolTipText = proteinChunk.protein.get_amino_acid_id(position - 1) self.sequenceTextEdit.setToolTip(str(toolTipText)) env.history.statusbar_msg(toolTipText)
def cursorPosChanged(self): """ Slot called when the cursor position of the strand textEdit changes. When this happens, this method also changes the cursor position of the 'Mate' text edit. Because of this, both the text edit widgets in the Sequence Editor scroll 'in sync'. """ strandSequence = self.sequenceTextEdit.toPlainText() cursor = self.sequenceTextEdit.textCursor() cursor_mate = self.secStrucTextEdit.textCursor() cursor_mate2 = self.aaRulerTextEdit.textCursor() if cursor.position() == len(self.sequenceTextEdit.toPlainText()): curPos = 0 else: curPos = cursor.position() if cursor_mate.position() != cursor.position(): cursor_mate.setPosition(curPos, QTextCursor.MoveAnchor) cursor_mate2.setPosition(curPos, QTextCursor.MoveAnchor) #After setting position, it is important to do setTextCursor #otherwise no effect will be observed. self.secStrucTextEdit.setTextCursor(cursor_mate) self.aaRulerTextEdit.setTextCursor(cursor_mate2) #provide amino acid info as cursor position changes part = self.win.assy.part from simulation.ROSETTA.rosetta_commandruns import checkIfProteinChunkInPart proteinExists, proteinChunk = checkIfProteinChunkInPart(part) position = cursor.position() toolTipText = proteinChunk.protein.get_amino_acid_id(position - 1) self.sequenceTextEdit.setToolTip(str(toolTipText)) env.history.statusbar_msg(toolTipText)
def showProteinParametersAndSequenceEditor(self, win): """ Show/ Hide protein parameters and sequence editor based """ part = win.assy.part from simulation.ROSETTA.rosetta_commandruns import checkIfProteinChunkInPart proteinExists, proteinChunk = checkIfProteinChunkInPart(part) if proteinExists: self._proteinChunkName = proteinChunk.protein.get_pdb_id( ) + proteinChunk.protein.get_chain_id() self._numberOfAA = len(proteinChunk.protein.get_sequence_string()) else: self._proteinChunkName = '' self._numberOfAA = 0 self.nameLineEdit.setText(self._proteinChunkName) self.numberOfAASpinBox.setValue(self._numberOfAA) if proteinExists: self.nameLineEdit.setEnabled(True) else: self.nameLineEdit.setEnabled(False) self.sequenceEditor = win.createProteinSequenceEditorIfNeeded() #get the sequence for this protein chunk if proteinExists: sequence = proteinChunk.protein.get_sequence_string() self.sequenceEditor.setSequence(sequence) secStructure = proteinChunk.protein.get_secondary_structure_string( ) self.sequenceEditor.setSecondaryStructure(secStructure) self.sequenceEditor.setRuler(len(secStructure)) self.sequenceEditor.show() else: self.sequenceEditor.hide()
def _showProteinParametersAndSequenceEditor(self): """ Show/ Hide protein parameters and sequence editor based on if there's any protein in NE-1 part. """ part = self.win.assy.part proteinExists, proteinChunk = checkIfProteinChunkInPart(part) if proteinExists: #check to see if current_protein is still in part, otherwise set # this to first available protein try: index = self.structureComboBox.findText(self.current_protein) index1 = self.protein_name_list.index(self.current_protein) except ValueError: index = 0 index1 = 0 self.set_current_protein_chunk_name( self.protein_name_list[index1]) self.structureComboBox.setCurrentIndex(index) proteinChunk = self.protein_chunk_list[index1] self._numberOfAA = len(proteinChunk.protein.get_sequence_string()) else: #remove all items from the combo box count = self.structureComboBox.count() for i in range(count): self.structureComboBox.removeItem(0) self._numberOfAA = 0 self.set_current_protein_chunk_name("") self.numberOfAASpinBox.setValue(self._numberOfAA) #get the sequence for this protein chunk if proteinExists: sequence = proteinChunk.protein.get_sequence_string() self.sequenceEditor.setSequence(sequence) secStructure = proteinChunk.protein.get_secondary_structure_string( ) self.sequenceEditor.setSecondaryStructure(secStructure) self.sequenceEditor.setRuler(len(secStructure)) self.editPropertiesPushButton.setEnabled(True) else: self.editPropertiesPushButton.setEnabled(False) self.sequenceEditor.hide() return
def _showProteinParametersAndSequenceEditor(self): """ Show/ Hide protein parameters and sequence editor based on if there's any protein in NE-1 part. """ part = self.win.assy.part proteinExists, proteinChunk = checkIfProteinChunkInPart(part) if proteinExists: #check to see if current_protein is still in part, otherwise set # this to first available protein try: index = self.structureComboBox.findText(self.current_protein) index1 = self.protein_name_list.index(self.current_protein) except ValueError: index = 0 index1 = 0 self.set_current_protein_chunk_name(self.protein_name_list[index1]) self.structureComboBox.setCurrentIndex(index) proteinChunk = self.protein_chunk_list[index1] self._numberOfAA = len(proteinChunk.protein.get_sequence_string()) else: #remove all items from the combo box count = self.structureComboBox.count() for i in range(count): self.structureComboBox.removeItem(0) self._numberOfAA = 0 self.set_current_protein_chunk_name("") self.numberOfAASpinBox.setValue(self._numberOfAA) #get the sequence for this protein chunk if proteinExists: sequence = proteinChunk.protein.get_sequence_string() self.sequenceEditor.setSequence(sequence) secStructure = proteinChunk.protein.get_secondary_structure_string() self.sequenceEditor.setSecondaryStructure(secStructure) self.sequenceEditor.setRuler(len(secStructure)) self.editPropertiesPushButton.setEnabled(True) else: self.editPropertiesPushButton.setEnabled(False) self.sequenceEditor.hide() return