def merge(self, anomFlag, thr):
FlatC = hierarchy.fcluster(self.Tree, thr, criterion='distance')
Log = open(self.CurrentDir+'/.cc_cluster.log', 'a')
counter=collections.Counter(FlatC)
Best = max(counter.iteritems(), key=operator.itemgetter(1))[0]
Process = True
#change checkboxes to standard variables
if Process:
ToProcess = [Best]
else:
ToProcess = set(Clusters)
for key in ToProcess:
if counter[key]==1:
ToProcess = [x for x in ToProcess if x != key]
#Processing pipeline,
#Does all the XSCALE run
for x in ToProcess:
if [thr,x, anomFlag] not in self.alreadyDone:
os.mkdir(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s'%(float(thr),x, anomFlag))
Xscale=open(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/XSCALE.INP'%(float(thr),x, anomFlag), 'a')
Pointless=open(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/launch_pointless.sh'%(float(thr),x,anomFlag ), 'a')
print('OUTPUT_FILE=scaled.hkl',file=Xscale)
print('MERGE= TRUE', file=Xscale)
print('pointless hklout clustered.mtz << eof', file=Pointless)
if anomFlag=='ano':
print('FRIEDEL\'S_LAW= FALSE', file=Xscale)
elif anomFlag=='no_ano':
print('FRIEDEL\'S_LAW= TRUE', file=Xscale)
Xscale.close()
Pointless.close()
for cluster, filename in zip(FlatC,self.labelList):
if cluster in ToProcess:
OUT = open(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/XSCALE.INP'%(float(thr),cluster,anomFlag), 'a')
Pointless=open(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/launch_pointless.sh'%(float(thr),cluster,anomFlag), 'a')
print ('INPUT_FILE= ../%s'%(filename), file=OUT)
#print ('INCLUDE_RESOLUTION_RANGE=20, 1.8', file=OUT)
print ('MINIMUM_I/SIGMA= 0', file=OUT)
print ('XDSIN ../%s'%(filename), file= Pointless)
OUT.close()
Pointless.close()
#optional run of XSCALE
newProcesses=[]
for x in ToProcess:
if [thr,x, anomFlag] not in self.alreadyDone:
plt.savefig(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/Dendrogram.png'%(float(thr),x,anomFlag))
P= subprocess.Popen('/opt/pxsoft/xds/vdefault/linux-x86_64/xscale_par',cwd=self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/'%(float(thr), x, anomFlag))
P.wait()
print('Cluster, %s , %s , %s'%(float(thr),x, anomFlag), file=Log)
Pointless=open(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/launch_pointless.sh'%(float(thr),x,anomFlag), 'a')
print('COPY \n bg\n TOLERANCE 4 \n eof', file= Pointless)
Pointless.close()
os.chmod(self.CurrentDir+'/cc_Cluster_%.2f_%s_%s/launch_pointless.sh'%(self.threshold,x,self.anomFlag ), st.st_mode | 0o111)
newProcesses.append([thr,x, anomFlag])
评论列表
文章目录