B
    ž3RcE  ã            
   @   sü  d dl Z d dlZd dlZd dlmZ d dlmZ d dlmZ d dlm	Z	 d dlm
Z
 dd„ Ze	d	ƒZe d
¡ e d¡ e d¡ eddƒZg Zx€eD ]xZe ¡  d¡Zeed ƒ ¡ Ze ej¡ eeƒZe e¡ e deeee  ¡ ƒƒ¡Z!e "e!ed  ed ed f¡ q–W xäe j#D ]ÚZe de¡Z$e$d  Z%e$d Z&ee%ƒ ¡ ZeeƒZ'e' ej¡ eeƒZ(e( e¡ e deeee(  ¡ ƒƒ¡Z)xjeD ]bZ*e*d Z+e*d Z,e*d Z-e
 .d¡Z/e/ 0e*d  ¡ e/ 1e)¡Z2e2dkrŒe3de-e+e,e%e&e2f ƒ qŒW qW dS )é    N)Ú
MolHandler)ÚMolecule)ÚChemicalFingerprint)ÚCFParameters)ÚSimilarityCalculatorFactoryc             C   sR   | }|   d¡}d}| d¡}x0|D ](}t|ƒ ¡ } |  ¡ }||kr"|}| }q"W |S )NZsmilesr   Ú.)ZtoFormatÚsplitr   ÚgetMoleculeZgetAtomCount)ÚmolZparmolZsmiZparcountZmsmiÚcount© r   ú*share/RDKit/Contrib/fraggle/cxn_tversky.pyÚdesalt/   s    


r   a1  <?xml version="1.0" encoding="UTF-8"?><ChemicalFingerprintConfiguration Version ="0.3" schemaLocation="cfp.xsd">    <Parameters Length="1024" BondCount="7" BitCount="4"/>    <StandardizerConfiguration Version ="0.1"><Actions><Action ID="aromatize" Act="aromatize"/> </Actions> </StandardizerConfiguration><ScreeningConfiguration><ParametrizedMetrics><ParametrizedMetric Name="Tversky" ActiveFamily="Generic" Metric="Tversky" Threshold="0.5" TverskyAlpha="0.1" TverskyBeta="0.9"/></ParametrizedMetrics></ScreeningConfiguration></ChemicalFingerprintConfiguration>i   é   é   Zfrag_q_split_outÚrú,é   Úié   z\s|,é   zTversky;0.95;0.05gÍÌÌÌÌÌì?z%s,%s,%s,%s,%s,%s)4ÚsysÚreZarrayZchemaxon.utilr   Zchemaxon.strucr   Zchemaxon.descriptorsr   r   r   r   ZcfpZ	setLengthZsetBondCountZsetBitCountÚopenZq_split_inputZqueriesÚlineÚrstripr   Úinfor	   r
   Z	aromatizeZAROM_GENERALZqfpZgenerateÚlistÚmapÚintZtoFloatArrayZqintfpÚappendÚstdinZline_fieldsZdbsmiZdbidZmol_desaltedÚfpZintfpÚqZqsmiZqidZqsubZcreateZscZsetQueryFingerprintZgetSimilarityZtverskyÚprintr   r   r   r   Ú<module>$   sT   





"




