Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
76 views
in Technique[技术] by (71.8m points)

python 3.x - SetOwningMol RDKIT in python3

I have a couple of function definitions in a wider class that I'm writing in python. For one function I embed the molecules with n number of conformers, I then want to make sure that these conformers remain with the parsed molecule after the function call. I thought this was done by reference under the hood so I wouldn't have to specifically set the conformers (see code snippet 1. below). However, this doesn't see to be the case. I tried to parse back the conformers and then do a setOwningMol but I get an error saying that the conformer class has no attribute setOwningMol or SetOwningMol (see snippet 2.) Any ideas on how to proceed would be great.

snippet 1:

gen_conformers(rdkitmol,n)
rdkmol.GetNumConformers() #### returns 0 here, I thought this would be done by reference?

def gen_conformers(rdkitmol,n):
    cids = AllChem.EmbedMultipleConfs(rdkmol,numConfs=n)
    rdkmol.GetNumConformers() #### returns n here

snippet 2:

confs = gen_conformers(rdkitmol,n)
for conf in confs:
    conf.SetOwningMol(rdkitmol)  #### 'Conformer' object has no attribute 'SetOwningMol' I tried with setOwningMol also

def gen_conformers(rdkitmol,n):
    cids = AllChem.EmbedMultipleConfs(rdkmol,numConfs=n)
    return rdkmol.GetConformers() 
question from:https://stackoverflow.com/questions/65923796/setowningmol-rdkit-in-python3

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...