def parse_pdb(inital_model_directory, xtal, db_dict): if os.path.isfile(os.path.join(inital_model_directory, xtal, 'refine.pdb')): db_dict['RefinementPDB_latest'] = os.path.realpath( os.path.join(inital_model_directory, xtal, 'refine.pdb')) pdb = parse().PDBheader( os.path.join(inital_model_directory, xtal, 'refine.pdb')) db_dict['RefinementRcryst'] = pdb['Rcryst'] db_dict['RefinementRcrystTraficLight'] = pdb['RcrystTL'] db_dict['RefinementRfree'] = pdb['Rfree'] db_dict['RefinementRfreeTraficLight'] = pdb['RfreeTL'] db_dict['RefinementRmsdBonds'] = pdb['rmsdBonds'] db_dict['RefinementRmsdBondsTL'] = pdb['rmsdBondsTL'] db_dict['RefinementRmsdAngles'] = pdb['rmsdAngles'] db_dict['RefinementRmsdAnglesTL'] = pdb['rmsdAnglesTL'] db_dict['RefinementSpaceGroup'] = pdb['SpaceGroup'] db_dict['RefinementResolution'] = pdb['ResolutionHigh'] db_dict['RefinementResolutionTL'] = pdb['ResolutionColor'] db_dict['RefinementStatus'] = 'finished' else: db_dict['RefinementStatus'] = 'failed' if os.path.isfile( os.path.join(inital_model_directory, xtal, 'refine.bound.pdb')): db_dict['RefinementBoundConformation'] = os.path.realpath( os.path.join(inital_model_directory, xtal, 'refine.bound.pdb')) elif os.path.isfile( os.path.join(inital_model_directory, xtal, 'refine.split.bound-state.pdb')): db_dict['RefinementBoundConformation'] = os.path.realpath( os.path.join(inital_model_directory, xtal, 'refine.split.bound-state.pdb')) return db_dict
def select_dataset_with_lowest_Rfree(panddaDir,datasetListwithoutEvent): datasetList=[] lowestRfree='' for dataset in datasetListwithoutEvent: if os.path.isfile(os.path.join(panddaDir,'processed_datasets',dataset,dataset+'-pandda-input.pdb')): stats=parse().PDBheader(os.path.join(panddaDir,'processed_datasets',dataset,dataset+'-pandda-input.pdb')) Rfree=stats['Rfree'] try: print dataset,Rfree,stats['ResolutionHigh'] datasetList.append([dataset,float(Rfree)]) except ValueError: pass if datasetList: lowestRfree=min(datasetList,key=lambda x: x[1])[0] return lowestRfree
def parse_pdb(inital_model_directory,xtal,db_dict): if os.path.isfile(os.path.join(inital_model_directory,xtal,'refine.pdb')): db_dict['RefinementPDB_latest']=os.path.realpath(os.path.join(inital_model_directory,xtal,'refine.pdb')) pdb=parse().PDBheader(os.path.join(inital_model_directory,xtal,'refine.pdb')) db_dict['RefinementRcryst'] = pdb['Rcryst'] db_dict['RefinementRcrystTraficLight'] = pdb['RcrystTL'] db_dict['RefinementRfree']= pdb['Rfree'] db_dict['RefinementRfreeTraficLight'] = pdb['RfreeTL'] db_dict['RefinementRmsdBonds'] = pdb['rmsdBonds'] db_dict['RefinementRmsdBondsTL'] = pdb['rmsdBondsTL'] db_dict['RefinementRmsdAngles'] = pdb['rmsdAngles'] db_dict['RefinementRmsdAnglesTL'] = pdb['rmsdAnglesTL'] db_dict['RefinementSpaceGroup'] = pdb['SpaceGroup'] db_dict['RefinementResolution'] = pdb['ResolutionHigh'] db_dict['RefinementResolutionTL'] = pdb['ResolutionColor'] db_dict['RefinementStatus'] = 'finished' else: db_dict['RefinementStatus'] = 'failed' if os.path.isfile(os.path.join(inital_model_directory,xtal,'refine.bound.pdb')): db_dict['RefinementBoundConformation']=os.path.realpath(os.path.join(inital_model_directory,xtal,'refine.bound.pdb')) return db_dict
'dimple.pdb')): db_dict = {} 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') dimple_ran_successfully = True db_dict['DataProcessingDimpleSuccessful'] = 'True' db_dict['DimpleStatus'] = 'finished' if not dimple_ran_successfully: db_dict['DataProcessingDimpleSuccessful'] = 'False' db_dict['DimpleStatus'] = 'failed' pdb = parse().PDBheader( os.path.join(inital_model_directory, xtal, 'dimple.pdb')) db_dict['DimpleRcryst'] = pdb['Rcryst'] db_dict['DimpleRfree'] = pdb['Rfree'] db_dict['RefinementOutcome'] = '1 - Analysis Pending' db_dict['RefinementSpaceGroup'] = pdb['SpaceGroup'] # if not os.path.isfile(xtal+'.free.mtz'): # os.chdir(os.path.join(inital_model_directory,xtal)) # os.system('/bin/rm '+xtal+'.free.mtz') # if os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple','dimple_rerun_on_selected_file','dimple','prepared2.mtz')): # os.symlink(os.path.join('dimple','dimple_rerun_on_selected_file','dimple','prepared2.mtz'),xtal+'.free.mtz') # db_dict['RefinementMTZfree']=xtal+'.free.mtz' # elif os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple','dimple_rerun_on_selected_file','dimple','prepared.mtz')): # os.symlink(os.path.join('dimple','dimple_rerun_on_selected_file','dimple','prepared.mtz'),xtal+'.free.mtz') # db_dict['RefinementMTZfree']=xtal+'.free.mtz' # setting free.mtz file
inital_model_directory=sys.argv[3] 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') 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') dimple_ran_successfully=True db_dict['DataProcessingDimpleSuccessful']='True' db_dict['DimpleStatus'] = 'finished' if not dimple_ran_successfully: db_dict['DataProcessingDimpleSuccessful']='False' db_dict['DimpleStatus'] = 'failed' pdb=parse().PDBheader(os.path.join(inital_model_directory,xtal,'dimple.pdb')) db_dict['DimpleRcryst']=pdb['Rcryst'] db_dict['DimpleRfree']=pdb['Rfree'] db_dict['RefinementOutcome']='1 - Analysis Pending' db_dict['RefinementSpaceGroup']=pdb['SpaceGroup'] if not os.path.isfile(xtal+'.free.mtz'): os.chdir(os.path.join(inital_model_directory,xtal)) os.system('/bin/rm '+xtal+'.free.mtz') if os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple','dimple_rerun_on_selected_file','dimple','prepared2.mtz')): os.symlink(os.path.join('dimple','dimple_rerun_on_selected_file','dimple','prepared2.mtz'),xtal+'.free.mtz') db_dict['RefinementMTZfree']=xtal+'.free.mtz' elif os.path.isfile(os.path.join(inital_model_directory,xtal,'dimple','dimple_rerun_on_selected_file','dimple','prepared.mtz')): os.symlink(os.path.join('dimple','dimple_rerun_on_selected_file','dimple','prepared.mtz'),xtal+'.free.mtz') db_dict['RefinementMTZfree']=xtal+'.free.mtz' # if no refinement was carried out yet, then we also want to link the dimple files to refine.pdb/refine.log