From ab70bae7983b9b9eb3af31502681862f1ac0381b Mon Sep 17 00:00:00 2001 From: Tobias Krojer Date: Wed, 4 Sep 2019 15:51:56 +0100 Subject: [PATCH] v1.3.8.11 (04/09/2019) - added few changes to enable parsing of DLS visit directories transfered to other file system (#255) --- gui_scripts/settings_preferences.py | 2 +- lib/XChemLog.py | 2 +- lib/XChemMain.py | 7 ++++++- lib/XChemThread.py | 14 +++++++++++++- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gui_scripts/settings_preferences.py b/gui_scripts/settings_preferences.py index 68c03be2..1214964a 100755 --- a/gui_scripts/settings_preferences.py +++ b/gui_scripts/settings_preferences.py @@ -30,7 +30,7 @@ def set_xce_logfile(self, xce_object): def settings(self, xce_object): # set XCE version - xce_object.xce_version = 'v1.3.8.10' + xce_object.xce_version = 'v1.3.8.11' # general settings xce_object.allowed_unitcell_difference_percent = 12 diff --git a/lib/XChemLog.py b/lib/XChemLog.py index 79043f1c..b6c636a6 100755 --- a/lib/XChemLog.py +++ b/lib/XChemLog.py @@ -26,7 +26,7 @@ def create_logfile(self,version): ' # #\n' ' # Version: %s #\n' %pasteVersion+ ' # #\n' - ' # Date: 14/08/2019 #\n' + ' # Date: 04/09/2019 #\n' ' # #\n' ' # Authors: Tobias Krojer, Structural Genomics Consortium, Oxford, UK #\n' ' # tobias.krojer@sgc.ox.ac.uk #\n' diff --git a/lib/XChemMain.py b/lib/XChemMain.py index 114e5638..d6d9c3ee 100755 --- a/lib/XChemMain.py +++ b/lib/XChemMain.py @@ -536,7 +536,12 @@ def getVisitAndBeamline(visitDirectory): except IndexError: pass if not visitDirectory.startswith('/dls'): - visit = 'unknown' + # this is all a bit of a fudge in case someone transfers a DLS visit directory back home + # does most certainly not catch all possible scenarios + if visitDirectory.split('/')[len(visitDirectory.split('/')) - 2] == 'processed': + visit = visitDirectory.split('/')[len(visitDirectory.split('/')) - 3] + else: + visit = visitDirectory.split('/')[len(visitDirectory.split('/'))-1] beamline = 'unknown' return visit,beamline diff --git a/lib/XChemThread.py b/lib/XChemThread.py index 57da015a..ed1086e3 100755 --- a/lib/XChemThread.py +++ b/lib/XChemThread.py @@ -1991,6 +1991,7 @@ def __init__(self, self.allSamples.append(e) else: self.allSamples = self.db.collected_xtals_during_visit_for_scoring(visit) + print 'here', self.allSamples # self.allSamples = self.db.collected_xtals_during_visit_for_scoring(visit,rescore) @@ -2178,6 +2179,7 @@ def __init__(self, # self.target = target self.processedDir = processedDir self.visit,self.beamline = XChemMain.getVisitAndBeamline(self.processedDir) + print 'visit' self.projectDir = projectDir self.Logfile = XChemLog.updateLog(xce_logfile) self.target = target @@ -2285,9 +2287,18 @@ def makeJPGdir(self,xtal,run): def copyJPGs(self,xtal,run): # for img in glob.glob(os.path.join(self.processedDir.replace('processed','jpegs'),xtal,run+'*t.png')): # for img in glob.glob(os.path.join(self.processedDir.replace('processed', 'jpegs'), run + '*t.png')): + self.Logfile.insert('%s: trying to copy crystal snapshots...' %xtal) + found = False for img in glob.glob(os.path.join(self.processedDir.replace('processed', 'jpegs'), run + '*.0.png')): + found = True if not os.path.isfile(os.path.join(self.projectDir,xtal,'jpg', self.visit +'-'+ run,img[img.rfind('/')+1:])): + self.Logfile.insert('%s: copying %s' % (xtal, img)) os.system('/bin/cp %s %s' %(img,os.path.join(self.projectDir,xtal,'jpg', self.visit + '-' + run))) + if not found: + for img in glob.glob(os.path.join(self.processedDir.replace('processed', 'jpegs'), xtal, run + '*.0.png')): + if not os.path.isfile(os.path.join(self.projectDir, xtal, 'jpg', self.visit + '-' + run, img[img.rfind('/') + 1:])): + self.Logfile.insert('%s: copying %s' % (xtal, img)) + os.system('/bin/cp %s %s' % (img, os.path.join(self.projectDir, xtal, 'jpg', self.visit + '-' + run))) def findJPGs(self,xtal,run): jpgDict={} @@ -2371,7 +2382,8 @@ def parse_file_system(self): runList = [] for collected_xtals in sorted(glob.glob(os.path.join(self.processedDir,'*'))): - self.visit = collected_xtals.split('/')[5] + # why is this here? self.visit is derived in init function through XChemMain.getVisitAndBeamline +# self.visit = collected_xtals.split('/')[5] if 'tmp' in collected_xtals or 'results' in collected_xtals or 'scre' in collected_xtals: continue if not os.path.isdir(collected_xtals):