[Rdkit-discuss] 答复: 转发: Reading the fingerprint
Hi Greg, Thank you so much for the help! Pure RDKit functionality really helpful! Thanks, Xuan 发件人: Greg Landrum 发送时间: 2019年1月4日 0:08 收件人: Cao Xuan 抄送: rdkit-discuss@lists.sourceforge.net 主题: Re: [Rdkit-discuss] 转发: Reading the fingerprint Hi Xuan, The easiest way to do this, and the one I'd recommend using most of the time, is using Python's builtin pickle mechanism: In [5]: fp = Chem.RDKFingerprint(m) In [6]: import pickle In [7]: fp2 = pickle.loads(pickle.dumps(fp)) In [8]: fp == fp2 Out[8]: True But you can also use pure RDKit functionality if you want. This method uses an RDKit-internal format (the same used by pickling): In [9]: fp2 = DataStructs.ExplicitBitVect(fp.ToBinary()) In [10]: fp == fp2 Out[10]: True This method uses a binary string directly encoding the contents of the fingerprint: In [12]: fp2 = DataStructs.CreateFromBinaryText( DataStructs.BitVectToBinaryText(fp) ) In [13]: fp == fp2 Out[13]: True And, finally, the least efficient approach (using a string of 0s and 1s): In [14]: fp2 = DataStructs.CreateFromBitString(fp.ToBitString()) In [15]: fp == fp2 Out[15]: True I hope this helps, -greg On Thu, Jan 3, 2019 at 4:36 PM Cao Xuan mailto:danis@hotmail.com>> wrote: 发件人: Cao Xuan 发送时间: 2019年1月3日 0:25 收件人: rdkit-discuss@lists.sourceforge.net<mailto:rdkit-discuss@lists.sourceforge.net> 主题: Reading the fingerprint Hi All, Is that possible to store the fingerprint on disk in string or byte format, and then read the fingerprint by initialize an empty DataStructs.cDataStructs.ExplicitBitVect() (I tried to call SetBit() and SetBitFromList() but no success). I also found the post https://sourceforge.net/p/rdkit/mailman/message/28969251/ but it is using C++, while I am using the python. # bit_binary_text = DataStructs.cDataStructs.BitVectToBinaryText(fps) temp_bitvect= DataStructs.cDataStructs.ExplicitBitVect(bit_binary_text) ValueError: bad version in BitVect pickle The reason that I want to read fingerprint from disk is because I want to do similarity check with rdkit.DataStructs.FingerprintSimilarity(fp1, fp2, metric=). Thank you for help! Xuan ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net<mailto:Rdkit-discuss@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] 转发: Reading the fingerprint
发件人: Cao Xuan 发送时间: 2019年1月3日 0:25 收件人: rdkit-discuss@lists.sourceforge.net 主题: Reading the fingerprint Hi All, Is that possible to store the fingerprint on disk in string or byte format, and then read the fingerprint by initialize an empty DataStructs.cDataStructs.ExplicitBitVect() (I tried to call SetBit() and SetBitFromList() but no success). I also found the post https://sourceforge.net/p/rdkit/mailman/message/28969251/ but it is using C++, while I am using the python. # bit_binary_text = DataStructs.cDataStructs.BitVectToBinaryText(fps) temp_bitvect= DataStructs.cDataStructs.ExplicitBitVect(bit_binary_text) ValueError: bad version in BitVect pickle The reason that I want to read fingerprint from disk is because I want to do similarity check with rdkit.DataStructs.FingerprintSimilarity(fp1, fp2, metric=). Thank you for help! Xuan ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Method about calculating Pi electro negativity in rdkit
Hi, Is there a method that can calculates the pi electronegativity of a given atom in rdkit package? Thanks! Xuan ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
[Rdkit-discuss] Is that possible to get features/descriptors for single atoms in a molecule
Hi, I am just wondering does rdkit support the functionality of get descriptors value for single atoms of a molecules. For example, in cdk, they have following function: // mol is molecule object; atoms.get(i) returns a single atoms // descriptor.calculate will calculate the descriptor value for the atoms.get(i) in mol IDescriptorResult res = descriptor.calculate(atoms.get(i), mol).getValue(); For example, I want to calculate the RDF of the molecules (rdkit.Chem.rdMolDescriptors.CalcRDF), After I called Chem.rdMolDescriptors.CalcRDF(mol), I got a large list with RDF values; then I tried the following >>> Chem.rdMolDescriptors.CalcRDF(mol,2) Traceback (most recent call last): File "", line 1, in ValueError: Bad Conformer Id So I assume that the Conformer Id correspond to each individual atoms? Thank you so much! Xuan ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss