Re: [Rdkit-discuss] How to convert numpy array to rdkit fingerprint object?

2018-01-11 Thread Maciek Wójcikowski
Hi, In DataStrucs there are CreateFrom* functions which do what you want, although you'd have to pass numpy array to a string of ints. ''.join(array) would probably be enough. See http://www.rdkit.org/Python_Docs/rdkit.DataStructs.cDataStructs-module.html#CreateFromBitString Pozdrawiam, |

Re: [Rdkit-discuss] How to convert numpy array to rdkit fingerprint object?

2018-01-11 Thread Jason Biggs
There may be a better way (my python is rudimentary), explicitList = numpy.array([0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 0]) onbits = numpy.where(explicitList==1)[0].tolist() bv1 = DataStructs.SparseBitVect(20) bv1.SetBitsFromList(onbits) bv1 for i in range(20):

[Rdkit-discuss] How to convert numpy array to rdkit fingerprint object?

2018-01-11 Thread Michał Nowotka
Hi, Imagine I have two numpy arrays containing zeros and ones (or bools) effectively being fingerprints: np_1, np_2 = some_fingerprints_as_np_arrays() I want to convert them both to rdkit fingerprint objects so I can use DiceSimilarity: from rdkit import DataStructs # this won't work becuse