@@ -259,21 +259,14 @@ def add_databases(self):
259
259
keys = inp .readline ().strip ().split ("\t " )
260
260
for line in inp :
261
261
line = line .split ("\t " )
262
- if os .path .isfile (os .path .join (path , line [keys .index ("filename_sqlite" )])):
263
- list_databases [line [keys .index ("filename_sqlite" )]] = line [keys .index ("description" )]
264
- conn = sqlite3 .connect (os .path .join (path , list_databases .keys ()[0 ]))
265
- cursor = conn .cursor ()
266
- cursor .execute ("""SELECT name FROM sqlite_master where type='table'""" )
267
- db_names = [str (name [0 ]) for name in cursor .fetchall ()]
268
- for i , db in enumerate (list_databases .keys ()[1 :]):
269
- cursor .execute ("ATTACH DATABASE ? AS db?" , (os .path .join (path , dbs [i + 1 ]), i , ))
270
- cursor .execute ("""SELECT name FROM db?.sqlite_master where type='table'""" , (i , ))
271
- db_names .extend ([str (name [0 ]) for name in cursor .fetchall ()])
262
+ if os .path .isfile (os .path .join (path , line [keys .index ("database_name" )] + ".sql.gz" )):
263
+ list_databases [line [keys .index ("database_name" )]] = line [keys .index ("description" )]
264
+
272
265
self .listWidget_databases .setSelectionMode (QtWidgets .QListWidget .MultiSelection )
273
266
for description in list_databases .values ():
274
267
item = QtWidgets .QListWidgetItem (description )
275
268
self .listWidget_databases .addItem (item )
276
- return dict ((v , k ) for k , v in list_databases .iteritems ())
269
+ return dict ((v , k ) for k , v in list_databases .items ())
277
270
278
271
def run (self ):
279
272
@@ -342,7 +335,7 @@ def run(self):
342
335
else :
343
336
QtWidgets .QMessageBox .critical (None , "Select file" , "Provide a valid filename for adducts or 'Use default'" , QtWidgets .QMessageBox .Ok )
344
337
345
- annotation .annotate_adducts (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_ppm_error .value (), lib = lib )
338
+ annotation .annotate_adducts (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_pp_ppm_error .value (), lib = lib )
346
339
print ("Done" )
347
340
348
341
if self .checkBox_isotopes .isChecked ():
@@ -356,7 +349,7 @@ def run(self):
356
349
lib = in_out .read_isotopes (self .lineEdit_isotopes .text (), lib_ion_mode [self .comboBox_ion_mode .currentText ()])
357
350
else :
358
351
QtWidgets .QMessageBox .critical (None , "Select file" , "Provide a valid filename for isotopes or 'Use default'" , QtWidgets .QMessageBox .Ok )
359
- annotation .annotate_isotopes (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_ppm_error .value (), lib = lib )
352
+ annotation .annotate_isotopes (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_pp_ppm_error .value (), lib = lib )
360
353
print ("Done" )
361
354
362
355
if self .checkBox_multiple_charged .isChecked ():
@@ -369,7 +362,7 @@ def run(self):
369
362
lib = in_out .read_multiple_charged_ions (self .lineEdit_multiple_charged .text (), lib_ion_mode [self .comboBox_ion_mode .currentText ()])
370
363
else :
371
364
QtWidgets .QMessageBox .critical (None , "Select file" , "Provide a valid filename for multiple charged ions or 'Use default'" , QtWidgets .QMessageBox .Ok )
372
- annotation .annotate_multiple_charged_ions (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_ppm_error .value (), lib = lib )
365
+ annotation .annotate_multiple_charged_ions (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_pp_ppm_error .value (), lib = lib )
373
366
print ("Done" )
374
367
375
368
if self .checkBox_oligomers .isChecked ():
@@ -388,7 +381,7 @@ def run(self):
388
381
else :
389
382
QtWidgets .QMessageBox .critical (None , "Select file" , "Provide a valid filename for adducts" , QtWidgets .QMessageBox .Ok )
390
383
inp = in_out .combine_peaklist_matrix (self .lineEdit_peaklist .text (), self .lineEdit_intensity_matrix .text ())
391
- annotation .annotate_oligomers (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_ppm_error .value (), lib = lib , maximum = self .spinBox_max_monomer_units .value ())
384
+ annotation .annotate_oligomers (inp , db_out = self .lineEdit_sql_database .text (), ppm = self .doubleSpinBox_pp_ppm_error .value (), lib = lib , maximum = self .spinBox_max_monomer_units .value ())
392
385
print ("Done" )
393
386
print
394
387
@@ -420,7 +413,7 @@ def run(self):
420
413
421
414
annotation .annotate_molecular_formulae (df ,
422
415
lib_adducts = lib ,
423
- ppm = self .doubleSpinBox_ppm_error .value (),
416
+ ppm = self .doubleSpinBox_mf_ppm_error .value (),
424
417
db_out = self .lineEdit_sql_database .text (),
425
418
db_in = db_in ,
426
419
rules = rules ,
@@ -446,12 +439,12 @@ def run(self):
446
439
QtWidgets .QMessageBox .critical (None , "Select file" , "Provide a valid filename for adducts" , QtWidgets .QMessageBox .Ok )
447
440
448
441
if self .checkBox_filename_reference .isChecked ():
449
- annotation .annotate_compounds (df , lib_adducts = lib , ppm = self .doubleSpinBox_ppm_error .value (),
442
+ annotation .annotate_compounds (df , lib_adducts = lib , ppm = self .doubleSpinBox_cpds_ppm_error .value (),
450
443
db_out = self .lineEdit_sql_database .text (), db_name = None , db_in = self .lineEdit_filename_reference .text ())
451
444
else :
452
445
for db_name in self .listWidget_databases .selectedItems ():
453
- annotation .annotate_compounds (df , lib_adducts = lib , ppm = self .doubleSpinBox_ppm_error .value (),
454
- db_out = self .lineEdit_sql_database .text (), db_name = self .db_names [db_name .text ()]. strip ( ".sqlite" ) )
446
+ annotation .annotate_compounds (df , lib_adducts = lib , ppm = self .doubleSpinBox_cpds_ppm_error .value (),
447
+ db_out = self .lineEdit_sql_database .text (), db_name = self .db_names [db_name .text ()])
455
448
print ("Done" )
456
449
print
457
450
0 commit comments