def ssm_fit(aRefMol, aRefSel, aMovMol, aMovSel): mgr = cuemol.getService("MolAnlManager"); refMol = cuemol.obj(aRefMol) refSel = cuemol.sel(aRefSel, refMol.getScene()) movMol = cuemol.obj(aMovMol) movSel = cuemol.sel(aMovSel, movMol.getScene()) mgr.superposeSSM1(refMol, refSel, movMol, movSel, False);
def merge(aToMol, aFromMol, aFromSel, aCopy=False): mgr = cuemol.getService("MolAnlManager"); toMol = cuemol.obj(aToMol) fromMol = cuemol.obj(aFromMol) fromSel = cuemol.sel(aFromSel, fromMol.getScene()) mgr.copyAtoms(toMol, fromMol, fromSel); if not aCopy: mgr.deleteAtoms(fromMol, fromSel);
def calc_rmsd(aRefMol, aRefSel, aMovMol, aMovSel): mgr = cuemol.getService("MolAnlManager") refMol = cuemol.obj(aRefMol) refSel = cuemol.sel(aRefSel, refMol.getScene()) movMol = cuemol.obj(aMovMol) movSel = cuemol.sel(aMovSel, movMol.getScene()) rmsd = mgr.calcRMSD(refMol, refSel, movMol, movSel, "") return rmsd
def delete(aObj, aType=None): tgt = None if cuemol.iswrapper(aObj): tgt = aObj else: # try renderer name/uid try: tgt = cuemol.rend(aObj) except: pass # try object name/uid if tgt == None: try: tgt = cuemol.obj(aObj) except: return False if cuemol.isobj(tgt): sc = tgt.getScene() sc.destroyObject(tgt.uid) return True elif cuemol.isrend(tgt): obj = tgt.getClientObj() obj.destroyRenderer(tgt.uid) return True return False
def delete(aObj, aType=None): tgt = None if cuemol.iswrapper(aObj): tgt = aObj else: # try renderer name/uid try: tgt = cuemol.rend(aObj) except: pass # try object name/uid if tgt==None: try: tgt = cuemol.obj(aObj) except: return False if cuemol.isobj(tgt): sc = tgt.getScene() sc.destroyObject(tgt.uid) return True elif cuemol.isrend(tgt): obj = tgt.getClientObj() obj.destroyRenderer(tgt.uid) return True return False
def __init__(self, aMol, aSel): molObj = cuemol.obj(aMol) selObj = cuemol.sel(aSel, molObj.scene_uid) self.mIter = cuemol.createObj("ResidIterator"); self.mIter.target = molObj; self.mIter.sel = selObj; self.mIter.first()
def saveObject(aObj, aFileName, aFmtName, aOpts=None): obj = cuemol.obj(aObj) strMgr = cuemol.svc("StreamManager") writer = strMgr.createHandler(aFmtName, 1) writer.setPath(aFileName) writer.attach(obj) writer.write() writer.detach()
def __init__(self, aMol, aSel="*"): molObj = cuemol.obj(aMol) #uid = molObj.uid selObj = cuemol.sel(aSel, molObj.scene_uid) self.mIter = cuemol.createObj("AtomIterator") self.mIter.target = molObj self.mIter.sel = selObj self.mIter.first()
def saveObject(aObj, aFileName, aFmtName, aOpts=None): obj = cuemol.obj(aObj) strMgr = cuemol.svc("StreamManager") writer = strMgr.createHandler(aFmtName, 1) if aOpts is not None: for k, v in aOpts.items(): print("writer set prop: k=", k, "v=", v) ci.setProp(writer, k, v) writer.setPath(aFileName) writer.attach(obj) writer.write() writer.detach()
def saveObject(aObj, aFileName, aFmtName, aOpts=None): obj = cm.obj(aObj) strMgr = cm.strMgr() writer = strMgr.createHandler(aFmtName, 1) if aOpts is not None: for k,v in aOpts.items(): print("writer set prop: k=",k,"v=",v) ci.setProp(writer._wrapped, k, v) writer.setPath(aFileName) writer.attach(obj) writer.write(); writer.detach();
def forEachResid(aMol, aSel, aFn): molObj = cuemol.obj(aMol) selObj = cuemol.sel(aSel, molObj.scene_uid) iter = cuemol.createObj("ResidIterator"); iter.target = molObj; iter.sel = selObj; iter.first() while True: if not iter.hasMore(): break resid = iter.get() if aFn(resid): break iter.next()
def chg_chain(aFromMol, aFromSel, aNewChName): mgr = cuemol.getService("MolAnlManager"); fromMol = cuemol.obj(aFromMol) fromSel = cuemol.sel(aFromSel, fromMol.getScene()) mgr.changeChainName(fromMol, fromSel, aNewChName);
def del_atoms(aMol, aSel): mgr = cuemol.getService("MolAnlManager"); mol = cuemol.obj(aMol) sel = cuemol.sel(aSel, mol.getScene()) mgr.deleteAtoms(mol, sel);