Skip to content

Commit

Permalink
Merge pull request #13 from t3ddezz/dropdown_test
Browse files Browse the repository at this point in the history
Dropdown test
  • Loading branch information
DataSpott committed Aug 25, 2023
2 parents 01e35cc + 96024ca commit ba4d4fe
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 59 deletions.
11 changes: 11 additions & 0 deletions data/flowcell_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FLO-FLG001
FLO-FLG111
FLO-FLGOP1
FLO-MIN106
FLO-MIN107
FLO-MIN110
FLO-MIN111
FLO-PRO001
FLO-PRO002
FLO-PRO111
FLO-PROOP2
50 changes: 50 additions & 0 deletions data/sequencing_kit_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
OND-SQK-LP0096M
OND-SQK-LP0096S
SQK-16S024
SQK-CAS109
SQK-CS9109
SQK-DCS108
SQK-DCS109
SQK-LRK001
SQK-LSK108
SQK-LSK109
SQK-LSK109-XL
SQK-LSK110
SQK-LSK110-XL
SQK-LSK308
SQK-LSK309
SQK-LSK319
SQK-LWB001
SQK-LWP001
SQK-NBD110-24
SQK-NBD110-96
SQK-PBK004
SQK-PCB109
SQK-PCB110
SQK-PCS108
SQK-PCS109
SQK-PCS110
SQK-PRC109
SQK-PSK004
SQK-RAB201
SQK-RAB204
SQK-RAD002
SQK-RAD003
SQK-RAD004
SQK-RAS201
SQK-RBK001
SQK-RBK004
SQK-RBK096
SQK-RLB001
SQK-RLI001
SQK-RNA001
SQK-RNA002
SQK-RPB004
SQK-ULK001
VSK-VBK001
VSK-VMK001
VSK-VMK002
VSK-VMK003
VSK-VSK001
VSK-VSK002
VSK-VSK003
113 changes: 54 additions & 59 deletions norse/norse_module/MainWindow_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def iniUI(self):
[exec(f'self.{input_name}.setHidden(True)', globs,locs) for input_name in self.input_name_list_main[(1-1):24]]
self.lineedit1.setHidden(False)


self.lineedit_dir_name = QtWidgets.QLineEdit(self)
self.lineedit_dir_name.setPlaceholderText('your directory name(optional)')
self.lineedit_dir_name.move(5, 10)
Expand Down Expand Up @@ -122,22 +121,23 @@ def iniUI(self):
self.kitinfos_label.move(10, 50)
self.kitinfos_label.setText('Ligation kit:')

self.sequencing_edit = QtWidgets.QLineEdit(self)
self.sequencing_edit.setPlaceholderText('e.g SQK-LSK109')
self.sequencing_edit.setMaxLength(13)
self.sequencing_edit.adjustSize()
self.sequencing_edit.move(10, 75)
with open('/norse/data/sequencing_kit_data.txt') as file:
sequencing_kit_list = [line.rstrip() for line in file]
self.sequencing_kit_edit = QtWidgets.QComboBox(self)
self.sequencing_kit_edit.setEditable(True)
self.sequencing_kit_edit.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.sequencing_kit_edit.addItems(sequencing_kit_list)
self.sequencing_kit_edit.setMinimumWidth(150)
self.sequencing_kit_edit.move(10, 75)
self.validator = Validator(self)
self.sequencing_edit.setValidator(self.validator)
#self.sequencing_edit.textChanged[str].connect(self.sequencing_changed)
self.sequencing_edit.editingFinished.connect(self.sequencing_changed)
self.sequencing_kit_edit.setValidator(self.validator)
self.sequencing_kit_edit.lineEdit().editingFinished.connect(self.sequencing_kit_changed)

self.barcode_label = QtWidgets.QLabel(self)
self.barcode_label.move(10, 102)
self.barcode_label.setText('Barcode kit (optional):')
self.barcode_label.adjustSize()


self.barcode_edit = QtWidgets.QLineEdit(self)
self.barcode_edit.setPlaceholderText('e.g EXP-PBC096')
self.barcode_edit.adjustSize()
Expand All @@ -149,18 +149,22 @@ def iniUI(self):
self.flowcell_label.move(10, 140)
self.flowcell_label.setText('Flowcell:')

self.flowcell_edit = QtWidgets.QLineEdit(self)
self.flowcell_edit.setPlaceholderText('e.g FLO-MIN106')
self.flowcell_edit.adjustSize()
with open('/norse/data/flowcell_data.txt') as file:
flowcell_type_list = [line.rstrip() for line in file]
self.flowcell_edit = QtWidgets.QComboBox(self)
self.flowcell_edit.setEditable(True)
self.flowcell_edit.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.flowcell_edit.addItems(flowcell_type_list)
self.flowcell_edit.setMinimumWidth(150)
self.flowcell_edit.move(10, 165)
self.flowcell_edit.setValidator(self.validator)
self.flowcell_edit.editingFinished.connect(self.flowcell_changed)
self.flowcell_edit.lineEdit().editingFinished.connect(self.flowcell_changed)


self.barcodes_label = QtWidgets.QLabel(self)
self.barcodes_label.setText('Barcodes?')
self.barcodes_label.move(10, 200)


self.radiobutton_no = QtWidgets.QRadioButton(self)# round button (grouped with radiobutton_yes)- only one can be selected
self.radiobutton_no.toggled.connect(self.radioclicked_no)
self.radiobutton_no.move(10, 225)
Expand Down Expand Up @@ -427,7 +431,7 @@ def upload(self, state):#function to upload files and create run_info.txt
#demo == run_info.txt
demo = open(completeName, "w")

kit = self.sequencing_edit.text()
kit = self.sequencing_kit_edit.text()
barcodekit = self.barcode_edit.text()
flowcell = self.flowcell_edit.text()

Expand Down Expand Up @@ -713,61 +717,52 @@ def upload(self, state):#function to upload files and create run_info.txt
print('connection error')


def sequencing_changed(self):
def sequencing_kit_changed(self):
with open('/norse/data/sequencing_kit_data.txt') as file:
sequencing_kit_list = [line.rstrip() for line in file]

url="https://raw.githubusercontent.com/t3ddezz/data/main/sequencing_data.txt"
re=requests.get(url).content
sequencing=pd.read_csv(io.StringIO(re.decode('utf-8')),sep='\t',index_col=False,header=None)

kit_input = self.sequencing_edit.text()
lange = len(sequencing)
zahler = 0
sequencing_kit_input = self.sequencing_kit_edit.currentText()
kit = 0

for i in range(lange):
if kit_input == sequencing.loc[zahler,0]:
kit = 1
break

else:
zahler = zahler + 1
if kit == 0:
msg = QMessageBox()
msg.setWindowTitle("sequencing input")
msg.setText("Something is wrong with your input!")
x = msg.exec_() # this will show our messagebox
msg.setIcon(QMessageBox.Critical)
self.sequencing_edit.clear()
if len(sequencing_kit_input) > 0:
for element in sequencing_kit_list:
if element == sequencing_kit_input:
kit = 1
break

if kit == 0:
msg = QMessageBox()
msg.setWindowTitle("Sequencing-Kit input")
msg.setText("Something is wrong with your input!")
x = msg.exec_() # this will show our messagebox
msg.setIcon(QMessageBox.Critical)
self.sequencing_kit_edit.setEditText("")


def barcode_changed(self):#if barcode list, could add barcode restriction
pass


def flowcell_changed(self):#flowcell check after flowcell input
url="https://raw.githubusercontent.com/t3ddezz/data/main/flowcell_data.txt"
re=requests.get(url).content
flowcell=pd.read_csv(io.StringIO(re.decode('utf-8')),sep='\t',index_col=False,header=None)
with open('/norse/data/flowcell_data.txt') as file:
flowcell_type_list = [line.rstrip() for line in file]

flow_input = self.flowcell_edit.text()
lange = len(flowcell)
zahler = 0
flowcell_input = self.flowcell_edit.currentText()
kit = 0

for i in range(lange):
if flow_input == flowcell.loc[zahler,0]:
kit = 1
break

else:
zahler = zahler + 1
if kit == 0:
msg = QMessageBox()
msg.setWindowTitle("flowcell input")
msg.setText("Something is wrong with your input!")
x = msg.exec_() # this will show our messagebox
msg.setIcon(QMessageBox.Critical)
self.flowcell_edit.clear()
if len(flowcell_input) > 0:
for element in flowcell_type_list:
if element == flowcell_input:
kit = 1
break

if kit == 0:
msg = QMessageBox()
msg.setWindowTitle("Flowcell input")
msg.setText("Something is wrong with your input!")
x = msg.exec_() # this will show our messagebox
msg.setIcon(QMessageBox.Critical)
self.flowcell_edit.setEditText("")


def test_upload(self):#test connection to server and add info to user_info.txt
Expand Down Expand Up @@ -936,7 +931,7 @@ def radiobutton_96(self):#button for 94-samples
def passinInformation(self):#all infos from mainwindow for window 2 to display there
self.button_upload.setEnabled(True)
self.window2.input_flowcell.setText(self.flowcell_edit.text())
self.window2.input_kit.setText(self.sequencing_edit.text())
self.window2.input_kit.setText(self.sequencing_kit_edit.text())
self.window2.input_barcode.setText(self.barcode_edit.text())
self.window2.input1.setText(self.lineedit1.text())
self.window2.input3.setText(self.lineedit3.text())
Expand Down

0 comments on commit ba4d4fe

Please sign in to comment.