Hi,
I am trying to add ErG fingerprints to PostgreSQL using the following post as a
guide:
https://github.com/greglandrum/rdkit_blog/blob/master/notebooks/Custom%20fingerprint%20in%20PostgreSQL.ipynb
<https://github.com/greglandrum/rdkit_blog/blob/master/notebooks/Custom%20fingerprint%20in%20PostgreSQL.ipynb>
My installation is as follows:
Debian 3.16.43-2
rdkit 2016.03.4 np111py27_1 rdkit
rdkit-postgresql 2016.03.4 py27_1 rdkit
In the example linked above, I had to replace the following line with the next
line (presumably because I am running python 2.7 instead of 3.x):
m = Chem.Mol(pkl.tobytes())
m = Chem.Mol(str(pkl))
I then run into the following two problems:
First problem: Null characters. When I run the example script (using the
Sheridan bit vector fingerprints), I generate the following error message:
curs.executemany('insert into fps values
(%s,bfp_from_binary_text(%s))',[(x,DataStructs.BitVectToBinaryText(y)) for x,y
in fps])
ValueError: A string literal cannot contain NUL (0x00) characters.
I am not sure what I should do here. I could strip the null characters from
the binary text, but are the null characters supposed to be there? Should I use
the bytea data type on PostgreSQL side?
Second problem: convert numpy array into bit vector
The linked example creates a fingerprint as a bit vector:
fp =
Sheridan.GetBTFingerprint(m,fpfn=rdMolDescriptors.GetHashedTopologicalTorsionFingerprintAsBitVect)
whereas rdReducedGraphs.GetErGFingerprint method produces a numpy array:
fp = rdReducedGraphs.GetErGFingerprint(m)
Is there anyway of converting this numpy array into a bit vector?
Any suggestions would be greatly appreciated. Thanks,
Konrad
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss