Hi Paolo, works like a charm. I did not know you can pass the CID directly, so had a workaround via molblocks, which did not work. Thanks again.
Now I stumble over another challenge. If I interpret it correctly then I should be able to SMARTS match atoms, even if they are different elements, as long as the SMARTS matching and the weight vectors are the same. The returned SMARTS matches are integer tuples, the RDKit test cases use constraintMap=[[query3dd_contraint_idx, references3dd_contraint_idx]], but use often only single integers. It seems the syntax is wrong? I seem to define the contraint map wrong, any hints? Ever seen this or worked with contraint maps? query3dd_contraint_idx = query3d.GetSubstructMatch(smartsQuery) references3dd_contraint_idx = references3d.GetSubstructMatch(smartsQuery) rdMolAlign.GetO3A(query3d, references3d, query3d_props, references3d_props, constraintMap=[[query3dd_contraint_idx, references3dd_contraint_idx]], constraintWeights=contraint_weights, prbCid=cid) Cheers /.Joerg On Sun, Jun 16, 2019 at 8:51 PM Paolo Tosco <[email protected]> wrote: > Dear Jörg, > > I have just tried this and it seems to work for me. > > I have created a gist here which shows an example usage on multiple > conformations: > > https://gist.github.com/ptosco/b9b7341251457fe26441dc17609ae34a > > As the notebook contains 3Dmol.js renderings that won't show up in the > gist, I have also created an HTML version which may be more convenient for > you to browse here: > > > http://htmlpreview.github.io/?https://gist.githubusercontent.com/ptosco/2bc42766a1672f61135d7d7dcce72223/raw/302e459d98c9f4e2fd0f1f2b23221d54c7bd2d8a/o3a.html > > I think the problem in your case might originate from the fact that when > you call pyO3A.Align() the transformation is directly applied to the query > molecule, and the RMSD is returned. > > If you call pyO3A.Trans() after calling pyO3A.Align() the transformation > will actually be an identity transformation, as the query has already been > aligned when Align() was called, so no further transformation is required. > So if you try to apply the transformation to the original coordinates > instead, that will result in no change to the coordinates, being an > identity. > > If you only need the transformation to apply it at a later stage, you > should not call Align first. > > I hope the above is clear; feel free to contact me if not (also off-list). > > Cheers, > Paolo > On 16/06/2019 17:56, Jörg Kurt Wegner wrote: > > It seems the shape alignment is in a wrong 3D reference frame - how to fix > this? > Here a code snippet looping over all conformations, then finding the one > with the lowest score. > I was under the assumption "query3d" should be at the end in the same > reference frame as "references3d", but it is not? Has anyone a working 3D > shape alignment, ensuring things are truly aligned in the same reference > frame? Thanks /.Joerg > > pyO3A=rdMolAlign.GetO3A(query3d_conf, references3d) > rmsd=pyO3A.Align() > score = pyO3A.Score() > rmsd, trans_matrix = pyO3A.Trans() > > if highestConfId!=-1: > rdkit.Chem.AllChem.TransformMol(query3d, trans_matrix, > confId=highestConfId, keepConfs=True) > > -- > LinkedIn <http://linkedin.com/in/joergkurtwegner>, Twitter > <http://twitter.com/joergkurtwegner>, FaceBook > <http://www.facebook.com/joergkurtwegner> > > > _______________________________________________ > Rdkit-discuss mailing > [email protected]https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > > -- LinkedIn <http://linkedin.com/in/joergkurtwegner>, Twitter <http://twitter.com/joergkurtwegner>, FaceBook <http://www.facebook.com/joergkurtwegner>
_______________________________________________ Rdkit-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

