Hi Takayuki,
I was able to run your code snippet without any errors (with different example
molecules of course). Could possible explain in more detail what is not working
for you? What version of RDKit are you using (from rdkit import rdBase;print
rdBase.rdkitVersion) ?
Niko
On Jan 17, 2013, at 11:08 AM, Taka Seri <serit...@gmail.com> wrote:
> Dear All.
>
> I want to do PCA with molecular fingerprint .
> So, I wrote following code.
> But, this code did not work .
> Does anyone have a suggestion?
> Thanks.
>
> Takayuki
>
>
> 1 from rdkit import Chem
> 2 from rdkit.Chem import AllChem
> 3 from rdkit.ML.Data import Stats
> 4 import numpy
> 5 import sys
> 6
> 7
> 8 mols = [mol for mol in Chem.SDMolSupplier(sys.argv[1])]
> 9 fps = [AllChem.GetMorganFingerprintAsBitVect(mol,2) for mol in mols]
> 10
> 11 mat = []
> 12 for fp in fps:
> 13 bits = fp.ToBitString()
> 14 bitsvec = [int(bit) for bit in bits]
> 15 mat.append(bitsvec)
> 16
> 17 mat=numpy.array(mat)
> 18 res = Stats.PrincpalComponents(mat)
> 19 print res[1]
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712_______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss