if i == 10: break i = i + 1 print "!!! !!!" sph = Sphere(m_ch, t_ch) pr = sph.processResRadius(rand_res, 300.0) print "Before swap: rmsd:{}|frac:{}".format(pr[0], pr[1]) sph.swapAmbiguousAtomLabels() pr = sph.processResRadius(rand_res, 300.0) print "After swap: rmsd:{}|frac:{}".format(pr[0], pr[1]) # # SphereGrinder engine sph = Sphere(m_ch, t_ch) sph.swapAmbiguousAtomLabels() data = sph.process(radii, caOnly) # # output results to file outdir = os.path.dirname(outf) if not os.path.exists(outdir): os.makedirs(outdir) if not os.path.isdir(outdir): raise OSError("Can't make dir {}".format(outdir)) try: outh = open(outf, "w+") outh.write(sph.toString(data)) outh.write("\n\nGlobal score: {:.5f}".format(sph.calcGlobalScore(data))) outh.close() except OSError: raise OSError("Failed to write to file {}".format(outf))