Skip to content

Commit

Permalink
some reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
reskyner committed Nov 7, 2018
1 parent 8a89bcf commit 67e473d
Show file tree
Hide file tree
Showing 20 changed files with 788 additions and 784 deletions.
29 changes: 13 additions & 16 deletions XChemExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,9 @@ def select_ground_state_mtz(self):
self.ground_state_mtz_button_label.setText(mtz)

def add_ground_state_db(self):
db_dict = {}
db_dict['DimplePANDDApath'] = self.panddas_directory
db_dict['PDB_file'] = str(self.ground_state_pdb_button_label.text())
db_dict['MTZ_file'] = str(self.ground_state_mtz_button_label.text())
db_dict = {'DimplePANDDApath': self.panddas_directory,
'PDB_file': str(self.ground_state_pdb_button_label.text()),
'MTZ_file': str(self.ground_state_mtz_button_label.text())}
self.db.create_or_remove_missing_records_in_depositTable(self.xce_logfile, 'ground_state', 'ground_state',
db_dict)

Expand Down Expand Up @@ -2278,7 +2277,7 @@ def rerun_dimple_on_all_autoprocessing_files(self):
job_list = self.get_job_list_for_dimple_rerun(xtal, job_list, db_dict, entry)
except KeyError:
continue
if job_list != []:
if job_list:
self.update_log.insert('trying to run DIMPLE on ALL auto-processing files')
self.check_before_running_dimple(job_list)

Expand Down Expand Up @@ -2352,7 +2351,7 @@ def run_dimple_on_selected_autoprocessing_file(self):
print(' ' + str(os.path.join(db_dict['DataProcessingPathToMTZfile']) + ' is missing'))


if job_list != []:
if job_list:
self.update_log.insert('trying to run DIMPLE on SELECTED auto-processing files')
self.check_before_running_dimple(job_list)

Expand All @@ -2362,7 +2361,7 @@ def remove_selected_dimple_files(self):
if self.initial_model_dimple_dict[xtal][0].isChecked():
job_list.append(xtal)

if job_list != []:
if job_list:
msgBox = QtGui.QMessageBox()
msgBox.setText("Do you really want to delete {0!s} Dimple files?".format(len(job_list)))
msgBox.addButton(QtGui.QPushButton('Go'), QtGui.QMessageBox.YesRole)
Expand Down Expand Up @@ -2480,7 +2479,7 @@ def get_job_list_for_dimple_rerun(self, xtal, job_list, db_dict, entry):
suitable_reference.append([reference[0], difference])
except ValueError:
continue
if suitable_reference != []:
if suitable_reference:
reference_file = min(suitable_reference, key=lambda x: x[1])[0]
visit = entry[1]
run = entry[2]
Expand Down Expand Up @@ -2690,7 +2689,7 @@ def change_filename_root(self, text):
self.settings['filename_root'] = self.filename_root

def button_clicked(self):
if self.data_source_set == False:
if not self.data_source_set:
print('sender text bit')
if self.sender().text() == "Create New Data\nSource (SQLite)":
file_name = str(QtGui.QFileDialog.getSaveFileName(self.window, 'Save file', self.database_directory))
Expand Down Expand Up @@ -2899,7 +2898,7 @@ def check_status_create_png_of_soaked_compound(self):
for cif_file in glob.glob(os.path.join(folder, '*.cif')):
if os.path.isfile(cif_file):
cif_file_generated += 1
if timestamp_list != []:
if timestamp_list:
last_timestamp = max(timestamp_list)
else:
last_timestamp = 'n/a'
Expand Down Expand Up @@ -3167,7 +3166,7 @@ def create_cif_pdb_png_files(self, todo):
if self.initial_model_dimple_dict[str(item[0])][0].isChecked():
compound_list.append([str(item[0]), compoundID, str(item[2])])

if compound_list != []:
if compound_list:
self.update_log.insert(
'trying to create cif and pdb files for ' + str(len(compound_list)) + ' compounds using ACEDRG...')
if self.external_software['qsub']:
Expand Down Expand Up @@ -3554,8 +3553,7 @@ def preferences_restraints_generation_combobox_changed(self):
def refinement_outcome_combobox_changed(self):
for xtal in self.refinement_table_dict:
if self.sender() == self.refinement_table_dict[xtal]:
db_dict = {}
db_dict['RefinementOutcome'] = str(self.sender().currentText())
db_dict = {'RefinementOutcome': str(self.sender().currentText())}
self.db.create_or_remove_missing_records_in_depositTable(self.xce_logfile, xtal, 'ligand_bound',
db_dict)

Expand Down Expand Up @@ -3625,8 +3623,7 @@ def dataset_outcome_combobox_change_outcome(self, text):
# self.data_collection_dict[xtal].append(['user_changed_selection'])
# # finally need to update outcome field in data source accordingly
self.update_log.insert('updating dataset outcome in datasource for {0!s}'.format(xtal))
update_dict = {}
update_dict['DataCollectionOutcome'] = outcome
update_dict = {'DataCollectionOutcome': outcome}
self.db.update_insert_data_source(xtal, update_dict)

def set_run_dimple_flag(self, state):
Expand Down Expand Up @@ -4104,7 +4101,7 @@ def user_update_selected_autoproc_datasets_summary_table(self):
for n, entry in enumerate(self.data_collection_dict[key]):
print('==>', n)
if entry[0] == 'logfile':
if entry[8] == True:
if entry[8]:
print('===> found:', n)
self.data_collection_column_three_dict[key][0].selectRow(n)
break
Expand Down
3 changes: 2 additions & 1 deletion compile_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os, sys

# set XCE environment variables
os.environ['XChemExplorer_DIR']=os.path.join(os.getcwd(), 'XChemExplorer/')
os.environ['XChemExplorer_DIR'] = os.path.join(os.getcwd(), 'XChemExplorer/')

print('XCE path = ' + os.environ['XChemExplorer_DIR'])

Expand All @@ -15,4 +15,5 @@

# try to import all of XCE stuff
from XChemExplorer import *

print('Successfully imported XCE... compile was succesful')
3 changes: 1 addition & 2 deletions helpers/phenix_find_TLS_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ def FindTLSgroups(pdbFile):
if found:
if line.startswith('}'):
break
temp = []
temp.append(line.split())
temp = [line.split()]
OutRefmac = OutRefmac + '\nTLS {0!s}\nRANGE '.format((GroupNames)[i]) + str(temp[0][3])[:-1] + ' ' + \
str(temp[0][6]) +'.\' ' + str(temp[0][3])[:-1] + ' ' + str(temp[0][8]) + '.\' ALL\n'
i += 1
Expand Down
2 changes: 1 addition & 1 deletion helpers/select_ground_state_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def select_dataset_with_lowest_Rfree(panddaDir,datasetListwithoutEvent):
datasetList.append([dataset,float(Rfree)])
except ValueError:
pass
if datasetList != []:
if datasetList:
lowestRfree=min(datasetList,key=lambda x: x[1])[0]
return lowestRfree

Expand Down
6 changes: 3 additions & 3 deletions helpers/update_data_source_after_refinement.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def parse_molprobity_output(inital_model_directory,xtal,db_dict):
db_dict['RefinementMolProbityScore'] = line.split()[3]
if float(line.split()[3]) < 2:
db_dict['RefinementMolProbityScoreTL'] = 'green'
if float(line.split()[3]) >= 2 and float(line.split()[3]) < 3:
if 2 <= float(line.split()[3]) < 3:
db_dict['RefinementMolProbityScoreTL'] = 'orange'
if float(line.split()[3]) >= 3:
db_dict['RefinementMolProbityScoreTL'] = 'red'
Expand All @@ -93,7 +93,7 @@ def parse_molprobity_output(inital_model_directory,xtal,db_dict):

if float(line.split()[3]) < 0.3:
db_dict['RefinementRamachandranOutliersTL'] = 'green'
if float(line.split()[3]) >= 0.3 and float(line.split()[3]) < 1:
if 0.3 <= float(line.split()[3]) < 1:
db_dict['RefinementRamachandranOutliersTL'] = 'orange'
if float(line.split()[3]) >= 1:
db_dict['RefinementRamachandranOutliersTL'] = 'red'
Expand All @@ -103,7 +103,7 @@ def parse_molprobity_output(inital_model_directory,xtal,db_dict):
db_dict['RefinementRamachandranFavored'] = line.split()[2]
if float(line.split()[2]) < 90:
db_dict['RefinementRamachandranFavoredTL'] = 'red'
if float(line.split()[2]) >= 90 and float(line.split()[2]) < 98:
if 90 <= float(line.split()[2]) < 98:
db_dict['RefinementRamachandranFavoredTL'] = 'orange'
if float(line.split()[2]) >= 98:
db_dict['RefinementRamachandranFavoredTL'] = 'green'
Expand Down
3 changes: 1 addition & 2 deletions helpers/update_data_source_for_new_dimple_pdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

db=XChemDB.data_source(db_file)
if os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple.pdb')):
db_dict={}
db_dict['DimplePathToPDB']=os.path.join(inital_model_directory,xtal,'dimple.pdb')
db_dict= {'DimplePathToPDB': os.path.join(inital_model_directory, xtal, 'dimple.pdb')}
dimple_ran_successfully=False
if os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple.mtz')):
db_dict['DimplePathToMTZ']=os.path.join(inital_model_directory,xtal,'dimple.mtz')
Expand Down
15 changes: 7 additions & 8 deletions helpers/update_status_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

def update_data_source(db_file,xtal,db_column,status):
db=XChemDB.data_source(db_file)
db_dict={}
db_dict[db_column] = status
db_dict= {db_column: status}
db.update_data_source(xtal,db_dict)

if __name__=='__main__':
db_file=sys.argv[1]
xtal=sys.argv[2]
db_column=sys.argv[3]
status=sys.argv[4]
if __name__ == '__main__':
db_file = sys.argv[1]
xtal = sys.argv[2]
db_column = sys.argv[3]
status = sys.argv[4]

update_data_source(db_file,xtal,db_column,status)
update_data_source(db_file, xtal, db_column, status)
Loading

0 comments on commit 67e473d

Please sign in to comment.