Exemple #1
0
 def clickNext0(self):
     if self.lineEdit0.text()=='':
         QtGui.QMessageBox.warning(self,'Warning', 'Write a project Name')
     elif self.selectDir0.lineEdit0.text()=='':
         QtGui.QMessageBox.warning(self,'Warning', 'Select Project Directory')  
     else: 
         self.dProject['name']=str(self.lineEdit0.text())
         self.dProject['dir']=str(self.selectDir0.lineEdit0.text())
         self.dProject['fName']=self.dProject['dir']+'/'+self.dProject['name']+'.qushape'
         
         if self.radioButton1.isChecked():
             self.dProject['isSeq2']=True
             self.dProject['chKeyRS']=['RX', 'BG', 'RXS1', 'BGS1','RXS2','BGS2']
             self.dProject['chKeyCC']=['RX', 'RXS1','RXS2','BG', 'BGS1','BGS2']
             self.dProject['chKeyRX']=['RX', 'RXS1','RXS2']
             self.dProject['chKeyBG']=['BG', 'BGS1','BGS2']
         else:
             self.dProject['isSeq2']=False
             self.dProject['chKeyRS']=['RX', 'BG', 'RXS1', 'BGS1']
             self.dProject['chKeyCC']=['RX', 'RXS1','BG', 'BGS1']
             self.dProject['chKeyRX']=['RX', 'RXS1']
             self.dProject['chKeyBG']=['BG', 'BGS1']
         
         if QtCore.QFile(self.dProject['fName']).exists():
             reply=QtGui.QMessageBox.question(self,"QuShape",
                                              "Saving the file will overwrite the original file on the disk.\n"
                                             "Do you really want to save?",
                                        QtGui.QMessageBox.Yes| QtGui.QMessageBox.Cancel)
             if reply==QtGui.QMessageBox.Cancel:
                 return False
             elif reply==QtGui.QMessageBox.Yes:
                 QtCore.QFile(self.dProject['fName']).remove()
         self.isApplied=True
Exemple #2
0
    def __init__(self,
                 label,
                 fileType,
                 path=QtCore.QDir.homePath(),
                 parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.label = label
        self.fileType = fileType
        self.path = path
        self.label0 = QtGui.QLabel(label)
        self.label0.setFixedWidth(80)
        self.lineEdit0 = QtGui.QLineEdit()
        self.lineEdit0.setReadOnly(True)
        self.pushButton0 = QtGui.QPushButton('Browse')

        self.layout0 = QtGui.QHBoxLayout()
        self.layout0.addWidget(self.label0)
        self.layout0.addWidget(self.lineEdit0)
        self.layout0.addWidget(self.pushButton0)
        self.layout0.setContentsMargins(0, 0, 0, 0)
        self.layout0.setSpacing(1)

        self.setLayout(self.layout0)
        self.connect(self.pushButton0, QtCore.SIGNAL("clicked()"),
                     self.fileBrowse)
Exemple #3
0
    def __init__(self, dProject, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.title = QtGui.QLabel(self.tr("<center><b>SCALE</b></center>"))
        self.name = "Scale"
        self.toolID = 1

        self.dProject = dProject
        self.dOutput = dProject['dData'].copy()

        self.label0 = {}
        self.doubleSpinBox0 = {}
        for key in self.dProject['chKeyRS']:
            self.label0[key] = QtGui.QLabel(key)
            self.doubleSpinBox0[key] = QtGui.QDoubleSpinBox()
            self.doubleSpinBox0[key].setRange(0.01, 100.00)
            self.doubleSpinBox0[key].setValue(1.00)
            self.doubleSpinBox0[key].setSingleStep(0.01)

        self.groupBox1 = QtGui.QGroupBox(self.tr('Enter Scale Factor'))

        vbox = QtGui.QGridLayout()
        vbox.addWidget(self.label0['RX'], 0, 0)
        vbox.addWidget(self.doubleSpinBox0['RX'], 0, 1)
        vbox.addWidget(self.label0['BG'], 1, 0)
        vbox.addWidget(self.doubleSpinBox0['BG'], 1, 1)
        vbox.addWidget(self.label0['RXS1'], 2, 0)
        vbox.addWidget(self.doubleSpinBox0['RXS1'], 2, 1)
        vbox.addWidget(self.label0['BGS1'], 3, 0)
        vbox.addWidget(self.doubleSpinBox0['BGS1'], 3, 1)
        if self.dProject['isSeq2']:
            vbox.addWidget(self.label0['RXS2'], 4, 0)
            vbox.addWidget(self.doubleSpinBox0['RXS2'], 4, 1)
            vbox.addWidget(self.label0['BGS2'], 5, 0)
            vbox.addWidget(self.doubleSpinBox0['BGS2'], 5, 1)

        vbox.setContentsMargins(0, 0, 0, 0)
        self.groupBox1.setLayout(vbox)

        self.pushButton0 = QtGui.QPushButton('Scale All to BG')
        self.connect(self.pushButton0, QtCore.SIGNAL("clicked()"),
                     self.autoScale)

        ### Button Box
        self.buttonBox = ToolButton()
        ## Main Layout
        self.groupBoxROI = GroupBoxROI(self.dProject)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.title)
        mainLayout.addWidget(self.groupBox1)
        mainLayout.addWidget(self.pushButton0)
        mainLayout.addWidget(self.groupBoxROI.groupBox)
        mainLayout.addStretch()
        mainLayout.addWidget(self.buttonBox)

        self.setLayout(mainLayout)
        self.isToolApplied = False
Exemple #4
0
 def __init__(self, dProject,parent=None):
     QtGui.QDialog.__init__(self, parent)
     self.name='New Project'
     self.title = QtGui.QLabel(self.tr("<center><b>CREATE NEW PROJECT - STEP 2 OF 3</b></center>"))
    
     self.dProject=dProject
     self.isApplied=False
   
     self.fileRead0=DlgSelectFile('(+) Reaction',"ABIF or Text File (*.ab1 *.fsa *.txt)",self.dProject['dir'])
     self.fileRead1=DlgSelectFile('(-) Reaction',"ABIF or Text File (*.ab1 *.fsa *.txt)",self.dProject['dir'])
     self.fileRead2=DlgSelectFile('Sequence',"Base Files (*.txt *.fasta *.gbk *.seq )",self.dProject['dir'])
     self.fileRead3=DlgSelectFile('Ref. Proj.',"Reference Project (*.pyshape *.qushape)",self.dProject['dir'])
     
     self.fileRead0.lineEdit0.setText(self.dProject['fNameRX'])
     self.fileRead1.lineEdit0.setText(self.dProject['fNameBG'])
     self.fileRead2.lineEdit0.setText(self.dProject['fNameSeq'])
     self.fileRead3.lineEdit0.setText(self.dProject['fNameRef'])
     
     text="HINT: Select either Sequence or Reference Project"
     self.hint = hintLabel(text)
     
     layout0 = QtGui.QVBoxLayout()
     layout0.addWidget(self.fileRead0)
     layout0.addWidget(self.fileRead1)
     layout0.addWidget(self.fileRead2)
     layout0.addWidget(self.fileRead3)
     layout0.addWidget(self.hint)
     
     self.buttonBox=ButtonWizard() 
     self.buttonBox.doneButton.setEnabled(False)
     self.buttonBox.nextButton.setDefault(True)
    
     self.connect(self.buttonBox.backButton,QtCore.SIGNAL("clicked()"),self.clickBack1)
     self.connect(self.buttonBox.nextButton,QtCore.SIGNAL("clicked()"),self.clickNext1)
     
     mainLayout=QtGui.QVBoxLayout()
     mainLayout.addWidget(self.title)
     mainLayout.addLayout(layout0)
     mainLayout.addStretch()
     mainLayout.addWidget(self.buttonBox)
     self.setLayout(mainLayout)
Exemple #5
0
    def __init__(self, dProject, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.labelTitle = QtGui.QLabel(
            self.tr("<center><b>REPORT</b></center>"))
        self.name = "Report"
        self.toolID = 1

        self.dProject = dProject
        self.dReport = createDReport(dProject)

        for key in self.dReport.keys():
            self.dReport[key] = self.dReport[key][::-1]

        self.saveTextButton = QtGui.QPushButton("Save as Text")

        self.connect(self.saveTextButton, QtCore.SIGNAL('clicked()'),
                     self.saveTextReport)

        self.layout0 = QtGui.QHBoxLayout()
        self.layout0.addWidget(self.saveTextButton)
        self.layout0.addStretch()

        N = len(self.dReport['seqNum'])
        self.table = QtGui.QTableWidget()
        self.table.setRowCount(N)
        self.table.setColumnCount(len(reportKeys))
        self.table.setHorizontalHeaderLabels(reportKeys)
        self.table.setSelectionBehavior(QtGui.QTableWidget.SelectRows)
        self.table.setSelectionMode(QtGui.QTableWidget.SingleSelection)
        self.font = QtGui.QFont()
        self.font.setPointSize(9)
        self.table.setFont(self.font)

        for i in range(N):
            for key in reportKeys:
                if key == 'seqRNA':
                    item = QtGui.QTableWidgetItem(self.dReport[key][i])
                elif key in ['seqNum', 'posSeq', 'posRX', 'posBG']:
                    item = QtGui.QTableWidgetItem("%d" % self.dReport[key][i])
                else:
                    item = QtGui.QTableWidgetItem("%.2f" %
                                                  self.dReport[key][i])
                col = reportKeys.index(key)
                self.table.setItem(int(i), int(col), item)
        self.table.resizeColumnsToContents()
        self.table.resizeRowsToContents()

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.labelTitle)
        mainLayout.addWidget(self.table)
        mainLayout.addLayout(self.layout0)
        self.setLayout(mainLayout)
Exemple #6
0
 def __init__(self, dProject,parent=None):
     QtGui.QDialog.__init__(self, parent)
     
     self.dProject=dProject
     self.isApplied=False
     self.title = QtGui.QLabel(self.tr("<center><b>CREATE NEW PROJECT - STEP 1 OF 3</b></center>"))
     self.name='New Project'
 
     label0=QtGui.QLabel('Project Name')
     self.lineEdit0=QtGui.QLineEdit()
     self.lineEdit0.setText(self.dProject['name'])
     
     self.selectDir0=DlgSelectDir('Directory')
     self.selectDir0.lineEdit0.setText(self.dProject['dir'])
     
     self.radioButton0=QtGui.QRadioButton('One Sequencing Channel')
     self.radioButton1=QtGui.QRadioButton('Two Sequencing Channels ')
     
     if self.dProject['isSeq2']:
         self.radioButton1.setChecked(True)
     else:
         self.radioButton0.setChecked(True)    
     
     self.groupBox = QtGui.QGroupBox(self.tr("Choose the Project Type"))
     layout0=QtGui.QVBoxLayout()
     layout0.addWidget(self.radioButton0)
     layout0.addWidget(self.radioButton1)
     self.groupBox.setLayout(layout0)
 
     layout0=QtGui.QGridLayout() 
     layout0.addWidget(label0,1,0)
     layout0.addWidget(self.lineEdit0,1,1)
     layout0.addWidget(self.selectDir0,2,0,1,2)
     layout0.addWidget(self.groupBox,3,0,1,2)
     
     self.buttonBox=ButtonWizard() 
     self.buttonBox.backButton.setEnabled(False)
     self.buttonBox.doneButton.setEnabled(False)
     self.buttonBox.nextButton.setDefault(True)
    
     self.connect(self.buttonBox.nextButton,QtCore.SIGNAL("clicked()"),self.clickNext0)
    
     mainLayout=QtGui.QVBoxLayout()
     mainLayout.addWidget(self.title)
     mainLayout.addLayout(layout0)
     mainLayout.addStretch()
     mainLayout.addWidget(self.buttonBox)
     self.setLayout(mainLayout)
Exemple #7
0
    def __init__(self, label, parent=None):
        QtGui.QWidget.__init__(self, parent)

        type = 'file'  # dir, save,

        label0 = QtGui.QLabel(label)
        self.lineEdit0 = QtGui.QLineEdit()
        self.lineEdit0.setReadOnly(True)
        self.pushButton0 = QtGui.QPushButton('Browse')

        self.connect(self.pushButton0, QtCore.SIGNAL("clicked()"),
                     self.dirBrowse0)

        layout0 = myGridLayout()
        layout0.addWidget(label0, 1, 0)
        layout0.addWidget(self.lineEdit0, 1, 1)
        layout0.addWidget(self.pushButton0, 1, 2)

        self.setLayout(layout0)
Exemple #8
0
    def __init__(self, dVar, chKeyRS, parent=None):
        super(DlgLineProps, self).__init__(parent)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setModal(False)

        self.labelTitle = QtGui.QLabel(
            self.tr("<center><b>CHANNEL ATTRIBUTES</b></center>"))
        self.name = "Channel Attributes"
        self.toolID = 3

        self.dVar = dVar.copy()
        self.chKeyRS = chKeyRS

        labels = ["Channel", "Color", "Line", "Marker", "Width"]
        self.label = {}
        self.checkBox0 = {}
        self.pushButton0 = {}
        self.comboBoxLineStyle = {}
        lineStyles = ["solid", "dashed", "dash_dot", "dotted"]
        self.lineStyles = ['-', '--', '-.', ':']
        self.comboBoxMarkerStyle = {}
        markerStyles = [
            "none", "point", "circle", "star", "square", "plus", "X", "diamond"
        ]
        self.markerStyles1 = ['', '.', 'o', '*', 's', '+', 'x', 'D']
        self.doubleSpinBoxLW = {}
        for key in chKeyRS:
            self.checkBox0[key] = QtGui.QCheckBox(key)
            self.checkBox0[key].setChecked(self.dVar['lineVisible'][key])
            self.pushButton0[key] = QtGui.QPushButton()
            self.pushButton0[key].setStyleSheet(
                "QWidget { background-color: %s }" %
                self.dVar['lineColor'][key])
            self.comboBoxLineStyle[key] = QtGui.QComboBox()
            self.comboBoxLineStyle[key].addItems(lineStyles)
            self.comboBoxMarkerStyle[key] = QtGui.QComboBox()
            self.comboBoxMarkerStyle[key].addItems(markerStyles)
            self.doubleSpinBoxLW[key] = QtGui.QDoubleSpinBox()
            self.doubleSpinBoxLW[key].setValue(1.0)
            self.doubleSpinBoxLW[key].setSingleStep(0.1)

        layout0 = myGridLayout()
        for i in range(len(labels)):
            self.label[i] = QtGui.QLabel(labels[i])
            layout0.addWidget(self.label[i], 0, i)

        for key in chKeyRS:  #self.dChKeys['RS']:
            index = chKeyRS.index(key) + 1
            layout0.addWidget(self.checkBox0[key], index, 0)
            layout0.addWidget(self.pushButton0[key], index, 1)
            layout0.addWidget(self.comboBoxLineStyle[key], index, 2)
            layout0.addWidget(self.comboBoxMarkerStyle[key], index, 3)
            layout0.addWidget(self.doubleSpinBoxLW[key], index, 4)

        self.buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Apply
                                                | QtGui.QDialogButtonBox.Close)

        self.connect(self.pushButton0['RX'], QtCore.SIGNAL("clicked()"),
                     self.changeColorRX)
        self.connect(self.pushButton0['RXS1'], QtCore.SIGNAL("clicked()"),
                     self.changeColorRXS1)
        self.connect(self.pushButton0['BG'], QtCore.SIGNAL("clicked()"),
                     self.changeColorBG)
        self.connect(self.pushButton0['BGS1'], QtCore.SIGNAL("clicked()"),
                     self.changeColorBGS1)
        if 'RXS2' in chKeyRS:
            self.connect(self.pushButton0['RXS2'], QtCore.SIGNAL("clicked()"),
                         self.changeColorRXS2)
        if 'BGS2' in chKeyRS:
            self.connect(self.pushButton0['BGS2'], QtCore.SIGNAL("clicked()"),
                         self.changeColorBGS2)

        self.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Apply),
                     QtCore.SIGNAL("clicked()"), self.apply)
        self.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), self.reject)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(layout0)
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)

        self.title = "Channel Attributes"
        self.setWindowTitle(self.title)
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.setFixedSize(350, 450)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.label = QtWidgets.QLabel(self.centralwidget)
        self.label.setGeometry(QtCore.QRect(0, 0, 350, 41))
        font = QtGui.QFont()
        font.setPointSize(20)
        font.setBold(True)
        font.setUnderline(False)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setScaledContents(False)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.label_2 = QtWidgets.QLabel(self.centralwidget)
        self.label_2.setEnabled(True)
        self.label_2.setGeometry(QtCore.QRect(25, 330, 300, 61))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(12)
        sizePolicy.setVerticalStretch(12)
        sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
        self.label_2.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setStrikeOut(False)
        font.setKerning(True)
        self.label_2.setFont(font)
        self.label_2.setAutoFillBackground(False)
        self.label_2.setStyleSheet("color: rgb(130, 142, 155);")
        self.label_2.setLocale(QtCore.QLocale(QtCore.QLocale.Ukrainian, QtCore.QLocale.Ukraine))
        self.label_2.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.label_2.setFrameShadow(QtWidgets.QFrame.Plain)
        self.label_2.setLineWidth(0)
        self.label_2.setMidLineWidth(0)
        self.label_2.setScaledContents(True)
        self.label_2.setAlignment(QtCore.Qt.AlignHCenter|QtCore.Qt.AlignTop)
        self.label_2.setWordWrap(True)
        self.label_2.setIndent(-1)
        self.label_2.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
        self.label_2.setObjectName("label_2")
        self.pushButton = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(115, 290, 120, 32))
        self.pushButton.setObjectName("pushButton")
        self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget)
        self.pushButton_2.setGeometry(QtCore.QRect(115, 400, 120, 32))
        self.pushButton_2.setObjectName("pushButton_2")
        self.frame = QtWidgets.QFrame(self.centralwidget)
        self.frame.setGeometry(QtCore.QRect(0, 42, 351, 241))
        self.frame.setAcceptDrops(False)
        self.frame.setStyleSheet("image: url(:/logo/color.png);")
        self.frame.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.frame.setObjectName("frame")
        MainWindow.setCentralWidget(self.centralwidget)

        self.pushButton_2.hide()

        self.retranslateUi(MainWindow)
        self.app_functions(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)
Exemple #10
0
    def __init__(self, dProject,parent=None):
        QtGui.QWidget.__init__(self, parent)
        
        self.title = QtGui.QLabel(self.tr("<center><b>SIGNAL ALIGNMENT</b></center>"))
        self.name="Signal Alignment"
        self.toolID=4
        
        self.dProject=dProject
        self.dOutput=dProject['dData'].copy()    
        self.dProjOut=deepcopy(dProject)
        self.linkXR,self.linkXS=np.array([]),np.array([])
        self.dataR,self.dataS=np.array([]),np.array([])
        self.isToolApplied=False
### Group of ComboBoxes
        label1=QtGui.QLabel("Seq. Channels")
        
        self.comboBox0=QtGui.QComboBox() 
        self.comboBox0.setCurrentIndex(0)
        if self.dProject['isSeq2']: 
            choices0= ['RXS1 - BGS1','RXS2 - BGS2']
        else:
            choices0= ['RXS1 - BGS1']
        self.comboBox0.addItems(choices0)
        
        gridLayout0 = QtGui.QGridLayout()
        gridLayout0.addWidget(label1, 0, 0)
        gridLayout0.addWidget(self.comboBox0, 0, 1)  
        
        groupBox1=QtGui.QGroupBox('Select Channels to be aligned')
        groupBox1.setLayout(gridLayout0)
      
        self.button0=peakMatchModifyButton()
        
        text=self.tr("HINT: When the matched peaks are modified; Key 'A'  to add a Peak. Key 'D'  to delete a Peak. Key 'Shift' to change position. ")                                     
        self.hint = hintLabel(text)
        
#        self.button0=QtGui.QPushButton('Modify Matched Peaks')
#        self.button0.setEnabled(False)
#        
#        self.hint = QtGui.QLabel(self.tr("HINT: When the matched peaks are modified,"
#                                         "Press Key 'A' button and click both plots to add a Peak. "
#                                         "Press Key 'D' button and click to delete a Peak. "
#                                         "Press Key 'Shift' button and select a peak in BGS to change position. "
#                                                                ))
        
#        self.font = QtGui.QFont() 
#        self.font.setPointSize(9)
#        self.hint.setFont(self.font)
#        self.hint.setWordWrap(True)
        
### Button Box
        self.buttonBox = ToolButton()
## Main Layout  
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget( self.title)
        mainLayout.addWidget(groupBox1)
        mainLayout.addWidget(self.button0)
        mainLayout.addWidget(self.hint)

        mainLayout.addStretch()  
        mainLayout.addWidget(self.buttonBox) 
        self.setLayout(mainLayout)
        
        self.isToolAppliedSigAlign=False
        self.connect(self.comboBox0,QtCore.SIGNAL('currentIndexChanged(int)'), self.comboChanged)
Exemple #11
0
    def __init__(self, dProject,dProjRef,parent=None):
        QtGui.QWidget.__init__(self, parent)
        
        self.labelTitle = QtGui.QLabel(self.tr("<center><b>REGION OF INTEREST</b></center>"))
        self.name="Region of Interest"
        self.toolID=1
        self.hint = QtGui.QLabel(self.tr("HINT: Press Key 'F' button and click the axes to set From. "
                                         "Press Key 'T' button and click the axes  to set To" 
                                                                    ))
        self.hint.setWordWrap(True)
        self.font = QtGui.QFont() 
        self.font.setPointSize(10)
        self.hint.setFont(self.font)
        self.dProject=dProject
        self.dProjRef=dProjRef 
        self.dProjOut=deepcopy(dProject) 
        self.isToolApplied=False
        
        self.roi={}
        for key in self.dProject['chKeyRS']:
            self.roi[key]=[0,len(self.dProject['dData'][key])]
         
        labelFrom = QtGui.QLabel("From ")
        labelTo = QtGui.QLabel("To   ")
        
        labelPlus=QtGui.QLabel('(+) Reaction')
        self.spinBoxPlusFrom=QtGui.QSpinBox()
        self.spinBoxPlusTo=QtGui.QSpinBox()
        self.spinBoxPlusFrom.setRange(0,len(self.dProject['dData']['RX']))
        self.spinBoxPlusTo.setRange(0,len(self.dProject['dData']['RX']))
        self.spinBoxPlusTo.setValue(len(self.dProject['dData']['RX']))
        
        labelMinus=QtGui.QLabel('(-) Reaction')
        self.spinBoxMinusFrom=QtGui.QSpinBox()
        self.spinBoxMinusTo=QtGui.QSpinBox()
        self.spinBoxMinusFrom.setRange(0,len(self.dProject['dData']['BG']))
        self.spinBoxMinusTo.setRange(0,len(self.dProject['dData']['BG']))
        self.spinBoxMinusTo.setValue(len(self.dProject['dData']['BG']))

        layout0=myGridLayout()
        layout0.addWidget(labelFrom,0,1)
        layout0.addWidget(labelTo,0,2)
        layout0.addWidget(labelPlus,1,0)
        layout0.addWidget( self.spinBoxPlusFrom,1,1)
        layout0.addWidget( self.spinBoxPlusTo,1,2)
        layout0.addWidget(labelMinus,2,0)
        layout0.addWidget( self.spinBoxMinusFrom,2,1)
        layout0.addWidget( self.spinBoxMinusTo,2,2)
        
        self.groupBox0=QtGui.QGroupBox()
        self.groupBox0.setLayout(layout0)
        
        self.buttunAuto=QtGui.QPushButton('Auto ROI by Reference')
        self.connect(self.buttunAuto,QtCore.SIGNAL("clicked()"),self.autoFindROI)
        
        if not self.dProject['isRef']:
            self.buttunAuto.setEnabled(False)
        self.buttonBox = ToolButton()
        
        mainLayout=QtGui.QVBoxLayout()
        mainLayout.addWidget(self.labelTitle)
        mainLayout.addWidget(self.groupBox0)
        mainLayout.addWidget(self.buttunAuto)
        
        mainLayout.addWidget(self.hint)
        mainLayout.addStretch()
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)
Exemple #12
0
    def __init__(self, dProject, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.title = QtGui.QLabel(
            self.tr("<center><b>SEQUENCE ALIGNMENT</b></center>"))
        self.name = "Sequence Alignment"
        self.toolID = 1

        self.dProject = dProject
        self.dProjOut = deepcopy(dProject)

        self.fileReadSeq = DlgSelectFile(
            'Seq. File', "Base Files (*.txt *.fasta *.gbk *.seq )",
            self.dProject['dir'])
        self.fileReadSeq.lineEdit0.setText(self.dProject['fNameSeq'])
        self.seqRNA3to5 = self.dProjOut['RNA'][::-1]
        self.seqRNA3to5N = changeNucToN(self.seqRNA3to5, self.dProjOut)
        self.NSeqRNA = len(self.dProjOut['RNA'])

        ###  SEQUENCE FIND
        label0 = QtGui.QLabel("Channel")
        label1 = QtGui.QLabel("ddNTP")
        label2 = QtGui.QLabel('Thres')

        self.comboBox0 = QtGui.QComboBox()
        self.comboBox1 = QtGui.QComboBox()
        self.comboBox2 = QtGui.QComboBox()
        self.comboBox3 = QtGui.QComboBox()

        self.spinBox0 = QtGui.QDoubleSpinBox()
        self.spinBox0.setRange(-3, 3)
        self.spinBox0.setValue(0.5)
        self.spinBox0.setSingleStep(0.1)

        choices0 = ['BGS1', 'RXS1']
        self.choicesNuc = ['ddC', 'ddG', 'ddA', 'ddT']
        self.nucNames = ['G', 'C', 'U', 'A']

        self.comboBox0.addItems(choices0)
        self.comboBox1.addItems(self.choicesNuc)
        self.comboBox1.setCurrentIndex(
            self.nucNames.index(self.dProject['nuc1']))

        self.radioSeqFind0 = QtGui.QRadioButton('Histogram')
        self.radioSeqFind1 = QtGui.QRadioButton('Background')

        layoutMethod = myHBoxLayout()
        layoutMethod.addWidget(self.radioSeqFind0)
        layoutMethod.addWidget(self.radioSeqFind1)

        gridLayout = myGridLayout()

        gridLayout.addWidget(label0, 0, 0)
        gridLayout.addWidget(label1, 0, 1)
        #      gridLayout.addWidget(label2, 0, 2)
        gridLayout.addWidget(self.comboBox0, 1, 0)
        gridLayout.addWidget(self.comboBox1, 1, 1)
        #     gridLayout.addWidget(self.spinBox0, 1, 2)

        if self.dProject[
                'isSeq2']:  #('RXS2' in self.dInput.keys()) and ('BGS2' in self.dInput.keys()):
            choices2 = ['BGS2', 'RXS2']
            self.comboBox2.addItems(choices2)
            self.comboBox3.addItems(self.choicesNuc)
            self.comboBox3.setCurrentIndex(
                self.nucNames.index(self.dProject['nuc2']))
            self.spinBox1 = QtGui.QDoubleSpinBox()
            self.spinBox1.setRange(-3, 3)
            self.spinBox1.setValue(0.5)
            self.spinBox1.setSingleStep(0.1)
            gridLayout.addWidget(self.comboBox2, 2, 0)
            gridLayout.addWidget(self.comboBox3, 2, 1)

    #    gridLayout.addWidget(self.spinBox1, 2, 2)

        self.checkBox0 = QtGui.QCheckBox('Check for high BG peaks')

        self.groupBoxBaseCall = QtGui.QGroupBox('Base Calling')
        self.groupBoxBaseCall.setLayout(gridLayout)
        self.groupBoxBaseCall.setCheckable(True)

        ##  LAYOUTS
        labelSetting2 = QtGui.QLabel("Seq Range: From")
        labelSetting3 = QtGui.QLabel("To:")
        labelSetting4 = QtGui.QLabel("Seq Start: ")

        self.spinBoxSeqRangeFrom = QtGui.QSpinBox()
        self.spinBoxSeqRangeTo = QtGui.QSpinBox()
        try:
            self.setSpinBoxSeq()
        except:
            pass
        self.spinBoxSeqOffset = QtGui.QSpinBox()
        self.spinBoxSeqOffset.setRange(0, len(self.dProject['RNA']))

        self.checkBoxLineDraw = QtGui.QCheckBox('Draw peak match lines')
        self.checkBoxLineDraw.setChecked(True)
        layoutSetting = myGridLayout()
        layoutSetting.addWidget(labelSetting2, 0, 0)
        layoutSetting.addWidget(self.spinBoxSeqRangeFrom, 0, 1)
        layoutSetting.addWidget(labelSetting3, 0, 2)
        layoutSetting.addWidget(self.spinBoxSeqRangeTo, 0, 3)
        #       layoutSetting.addWidget(self.checkBoxLineDraw,1,0,1,2)

        self.groupBoxSettings = QtGui.QGroupBox('Settings')
        self.groupBoxSettings.setLayout(layoutSetting)

        text = "HINT: Click a Nuc to change the type. \
                Press Key 'A' button and click to add a Nuc.\
                Press Key 'D' button and click to delete a Nuc. \
                Press Key 'Shift' button and select a peak to change position. "

        self.hint = hintLabel(text)

        self.connect(self.fileReadSeq.pushButton0, QtCore.SIGNAL("clicked()"),
                     self.changeSeqFile)

        self.buttonBox = ToolButton()

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.title)
        mainLayout.addWidget(self.fileReadSeq)
        mainLayout.addWidget(self.groupBoxBaseCall)
        mainLayout.addWidget(self.groupBoxSettings)
        mainLayout.addWidget(self.hint)
        mainLayout.addStretch()
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)
        self.isToolApplied = False
Exemple #13
0
    def __init__(self, dProject, dProjRef, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.title = QtGui.QLabel(
            self.tr("<center><b>SEQUENCE ALIGNMENT BY REFERENCE</b></center>"))
        self.name = "Sequence Alignment by Reference"
        self.toolID = 1

        self.dProject = dProject
        self.dProjRef = dProjRef
        self.linkXR, self.linkXS = np.array([]), np.array([])
        self.linkYR, self.linkYS = np.array([]), np.array([])
        self.dataR, self.dataS = np.array([]), np.array([])

        #### BY REFERENCE
        self.fileReadRef = DlgSelectFile(
            'Ref. Proj.', "Reference Project (*.pyShape *.qushape)",
            self.dProject['dir'])
        if 'fNameRef' in self.dProject.keys():
            self.fileReadRef.lineEdit0.setText(self.dProject['fNameRef'])
        self.connect(self.fileReadRef.pushButton0, QtCore.SIGNAL("clicked()"),
                     self.changeRefFile)

        label10 = QtGui.QLabel("Ref. Channel")
        self.comboBox10 = QtGui.QComboBox()
        self.comboBox10.addItems(chKeysRS)
        self.comboBox10.setCurrentIndex(3)

        label11 = QtGui.QLabel("Sample Channel")
        self.comboBox11 = QtGui.QComboBox()
        self.comboBox11.addItems(chKeysRS)
        self.comboBox11.setCurrentIndex(3)

        layout0 = myGridLayout()
        layout0.addWidget(self.fileReadRef, 0, 0, 1, 2)
        layout0.addWidget(label10, 1, 0)
        layout0.addWidget(self.comboBox10, 1, 1)
        layout0.addWidget(label11, 2, 0)
        layout0.addWidget(self.comboBox11, 2, 1)

        self.groupBox0 = QtGui.QGroupBox(self.tr('Signal Alignment'))
        self.groupBox0.setLayout(layout0)
        self.groupBox0.setCheckable(True)

        labelRX = QtGui.QLabel('Scale Factor for RX')
        labelBG = QtGui.QLabel('Scale Factor for BG')
        self.spinBoxRX = QtGui.QDoubleSpinBox()
        self.spinBoxRX.setRange(0.01, 100.00)
        self.spinBoxRX.setValue(1.00)
        self.spinBoxRX.setSingleStep(0.01)
        self.spinBoxBG = QtGui.QDoubleSpinBox()
        self.spinBoxBG.setRange(0.01, 100.00)
        self.spinBoxBG.setValue(1.00)
        self.spinBoxBG.setSingleStep(0.01)

        self.checkBoxScale0 = QtGui.QCheckBox('Scale by windowing')

        layout1 = myGridLayout()
        layout1.addWidget(labelRX, 0, 0)
        layout1.addWidget(self.spinBoxRX, 0, 1)
        layout1.addWidget(labelBG, 1, 0)
        layout1.addWidget(self.spinBoxBG, 1, 1)
        layout1.addWidget(self.checkBoxScale0, 2, 0, 1, 2)

        self.groupBox1 = QtGui.QGroupBox(self.tr('Scale RX and BG'))
        self.groupBox1.setLayout(layout1)
        # self.groupBox1.setCheckable(True)

        #  self.button0=QtGui.QPushButton('Modify Matched Peaks')
        #  self.button0.setEnabled(False)

        self.button0 = peakMatchModifyButton()

        self.button1 = QtGui.QPushButton('Modify Peak Link by Reference')
        self.button1.setEnabled(False)
        self.button1.setWhatsThis(
            self.
            tr(" Check the accuracy of linked peaks"
               " by C\changing the peak position in the sample RX and BG peaks."
               " Press Key 'Shift' button and select a sample peak to change position. "
               ))
        text = self.tr(
            "HINT: When the matched peaks are modified; Key 'A'  to add a Peak. Key 'D'  to delete a Peak. Key 'Shift' to change position. "
        )
        self.hint = hintLabel(text)

        ### BUTTON BOX
        self.buttonBox = ToolButton()

        ## MAIN LAYOUT
        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.title)
        mainLayout.addWidget(self.groupBox0)
        mainLayout.addWidget(self.button0)
        mainLayout.addWidget(self.button1)
        mainLayout.addWidget(self.hint)
        mainLayout.addStretch()
        mainLayout.addWidget(self.buttonBox)
        self.setLayout(mainLayout)
        self.isClickedModifyMatchedPeaks = True
        self.isToolApplied = False
        self.isMatchedPeaksChanged = True
Exemple #14
0
 def __init__(self, dProject,parent=None):
     QtGui.QDialog.__init__(self, parent)
     self.name='New Project'
     self.title = QtGui.QLabel(self.tr("<center><b>CREATE NEW PROJECT - STEP 3 OF 3</b></center>"))
     self.dProject=dProject
     self.isApplied=False 
         
     self.label0={}
     self.comboBox0={}
     choices0=['Channel 1','Channel 2', 'Channel 3','Channel 4']
     for key in self.dProject['chKeyRS']:
         self.label0[key]=QtGui.QLabel(key)
         self.comboBox0[key]=QtGui.QComboBox()
         self.comboBox0[key].addItems(choices0)
         self.comboBox0[key].setCurrentIndex(self.dProject['chIndex'][key])
         
     choices2=['ddC','ddG', 'ddA', 'ddT']
     self.comboBox1={}
     self.comboBox1['RXS1']=QtGui.QComboBox()
     self.comboBox1['RXS1'].addItems(choices2)
     self.comboBox1['BGS1']=QtGui.QComboBox()
     self.comboBox1['BGS1'].addItems(choices2)
     
     if self.dProject['isSeq2']:
         self.comboBox1['RXS2']=QtGui.QComboBox()
         self.comboBox1['RXS2'].addItems(choices2) 
         self.comboBox1['BGS2']=QtGui.QComboBox()
         self.comboBox1['BGS2'].addItems(choices2) 
         self.comboBox1['RXS2'].setCurrentIndex(1)
         self.comboBox1['BGS2'].setCurrentIndex(1)
     
     layout1 = QtGui.QGridLayout()
     layout1.addWidget(self.label0['RX'], 0, 0)
     layout1.addWidget(self.comboBox0['RX'], 0, 1)
     layout1.addWidget(self.label0['RXS1'], 1, 0)
     layout1.addWidget(self.comboBox0['RXS1'], 1, 1)
     layout1.addWidget(self.comboBox1['RXS1'], 1, 2)
     if self.dProject['isSeq2']:
         layout1.addWidget(self.label0['RXS2'], 2, 0)
         layout1.addWidget(self.comboBox0['RXS2'], 2, 1)
         layout1.addWidget(self.comboBox1['RXS2'], 2, 2)
     
     groupBox1=QtGui.QGroupBox('Select (+) Reaction Channels')
     groupBox1.setLayout(layout1)
     
     layout2 = QtGui.QGridLayout()
     layout2.addWidget(self.label0['BG'], 0, 0)
     layout2.addWidget(self.comboBox0['BG'], 0, 1)
     layout2.addWidget(self.label0['BGS1'], 1, 0)
     layout2.addWidget(self.comboBox0['BGS1'], 1, 1)
     layout2.addWidget(self.comboBox1['BGS1'], 1, 2)
     if self.dProject['isSeq2']:
         layout2.addWidget(self.label0['BGS2'], 2, 0)
         layout2.addWidget(self.comboBox0['BGS2'], 2, 1)
         layout2.addWidget(self.comboBox1['BGS2'], 2, 2)
     
     groupBox2=QtGui.QGroupBox('Select (-) Reaction Channels')
     groupBox2.setLayout(layout2)
     
     self.buttonBox=ButtonWizard() 
     self.buttonBox.nextButton.setText('Apply')
     self.buttonBox.doneButton.setEnabled(False)
     self.buttonBox.nextButton.setDefault(True)
      
     self.connect(self.buttonBox.backButton,QtCore.SIGNAL("clicked()"),self.clickBack2)
     self.connect(self.buttonBox.nextButton,QtCore.SIGNAL("clicked()"),self.clickNext2)
     
     mainLayout=QtGui.QVBoxLayout()
     mainLayout.addWidget(self.title)
     mainLayout.addWidget(groupBox1)
     mainLayout.addWidget(groupBox2)
     mainLayout.addStretch()
     mainLayout.addWidget(self.buttonBox)
     
     self.setLayout(mainLayout)
     
     self.connect(self.comboBox0['RX'],QtCore.SIGNAL("currentIndexChanged(int)"),self.changeCombo00)
     self.connect(self.comboBox0['RXS1'],QtCore.SIGNAL("currentIndexChanged(int)"),self.changeCombo01)
     self.connect(self.comboBox1['RXS1'],QtCore.SIGNAL("currentIndexChanged(int)"),self.changeCombo10)
     if self.dProject['isSeq2']:
         self.connect(self.comboBox0['RXS2'],QtCore.SIGNAL("currentIndexChanged(int)"),self.changeCombo02)
         self.connect(self.comboBox1['RXS2'],QtCore.SIGNAL("currentIndexChanged(int)"),self.changeCombo11)