Dear Evgueni,

On Tue, Apr 7, 2009 at 10:37 AM, Evgueni Kolossov <[email protected]> wrote:
>
> looking like ToString() method producing some strange result or I am doing
> something wrong.
> This is the code:
> strSM   is equal to "CNC(=NC#N)NCCSCc1nc[nH]c1C"
> RWMol *mol = SmilesToMol(strSM) //not null, contained atoms, bonds, so
> looking like OK
> ExplicitBitVect *fpSSS = RDKit::RDKFingerprintMol(*mol); //looking like OK -
> see details in enclosed file
> std::string strSSS = fpSSS->ToString(); //result is very strange: "àÿÿÿ"
>
> Can you help, please?

It's hard to be sure. The output from fpSSS->ToString() is a binary
string that is really only useful as an input to one of the
constructors of ExplicitBitVect (or SparseBitVect). It's not intended
to be printed, so it's not particularly readable.

If you want a string of zeroes and ones (probably less efficient for
your database, but more human readable), you can get one using
BitVectToText():
http://www.rdkit.org/C++_Docs/BitOps_8h.html#36835d36d5bd537c22d48f61c15bb9d7
And convert that back into a BitVector using FromBitString():
http://www.rdkit.org/C++_Docs/BitVectUtils_8h.html#2a9c53ad7c640781d6547cc6b47e75f9
(These should really be declared in the same header file; that's
something for the next release)

here's some untested sample code:
    std::string bits = BitVectToText(fp1);
    ExplicitBitVect fp2(bits.length());
    FromBitString(fp2,bits);

Best Regards,
-greg

Reply via email to