예제 #1
0
    def test_mol_samestruct(self):

        rs = engine.execute(
            select([func.mol('Cc1ccccc1') == func.mol('c1ccccc1C')]))
        self.assertTrue(rs.fetchall()[0][0])

        rs = engine.execute(
            select([func.mol('Cc1ccccc1') == func.mol('c1cnccc1C')]))
        self.assertFalse(rs.fetchall()[0][0])
예제 #2
0
파일: test_mol.py 프로젝트: rvianello/razi
    def test_mol_samestruct(self):

        rs = engine.execute(
            select([ func.mol('Cc1ccccc1') == func.mol('c1ccccc1C') ])
        )
        self.assertTrue(rs.fetchall()[0][0])

        rs = engine.execute(
            select([ func.mol('Cc1ccccc1') == func.mol('c1cnccc1C') ])
        )
        self.assertFalse(rs.fetchall()[0][0])
예제 #3
0
    def test_inchi_out(self):

        rs = engine.execute(select([ func.mol_inchi(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H')

        rs = engine.execute(select([ func.mol_inchikey(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'UHOVQNZJYSORNB-UHFFFAOYSA-N')

        rs = engine.execute(select([ func.mol_inchi(func.mol('Cc1cc(C)[n+]c(C)c1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'InChI=1S/C8H11N/c1-6-4-7(2)9-8(3)5-6/h4-5H,1-3H3/q+1')

        rs = engine.execute(select([ func.mol_inchikey(func.mol('Cc1cc(C)[n+]c(C)c1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'WDQXTFQYHUZLPX-UHFFFAOYSA-N')
예제 #4
0
    def test_inchi_out(self):

        rs = engine.execute(select([ func.mol_inchi(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H')

        rs = engine.execute(select([ func.mol_inchikey(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'UHOVQNZJYSORNB-UHFFFAOYSA-N')

        rs = engine.execute(select([ func.mol_inchi(func.mol('Cc1cc(C)[n+]c(C)c1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'InChI=1S/C8H11N/c1-6-4-7(2)9-8(3)5-6/h4-5H,1-3H3/q+1')

        rs = engine.execute(select([ func.mol_inchikey(func.mol('Cc1cc(C)[n+]c(C)c1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'WDQXTFQYHUZLPX-UHFFFAOYSA-N')
예제 #5
0
파일: test_mol.py 프로젝트: rvianello/razi
    def test_mol_to_ctab(self):

        rs = engine.execute(select([ func.mol_to_ctab(func.mol('CCC')) ]))
        self.assertEqual(rs.fetchall()[0][0], '''
     RDKit          2D

  3  2  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2990    0.7500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.5981   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
  2  3  1  0
M  END
''')
예제 #6
0
    def test_mol_to_ctab(self):

        rs = engine.execute(select([func.mol_to_ctab(func.mol('CCC'))]))
        self.assertEqual(
            rs.fetchall()[0][0], '''
     RDKit          2D

  3  2  0  0  0  0  0  0  0  0999 V2000
    0.0000    0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    1.2990    0.7500    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
    2.5981   -0.0000    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
  2  3  1  0
M  END
''')
예제 #7
0
    def test_props(self):

        rs = engine.execute(select([func.mol_amw(func.mol('c1ccccc1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 78.114)

        rs = engine.execute(select([func.mol_logp(func.mol('c1ccccc1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.6866)

        rs = engine.execute(select([func.mol_hba(func.mol('c1ccccc1'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([func.mol_hbd(func.mol('c1ccccc1'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([func.mol_chi0n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.8339648)

        rs = engine.execute(select([func.mol_chi1n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.1342905)

        rs = engine.execute(select([func.mol_chi2n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.3355491)

        rs = engine.execute(select([func.mol_chi3n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.7561936)

        rs = engine.execute(select([func.mol_chi4n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.4279941)

        rs = engine.execute(select([func.mol_chi0v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.8339648)

        rs = engine.execute(select([func.mol_chi1v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.1342905)

        rs = engine.execute(select([func.mol_chi2v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.3355491)

        rs = engine.execute(select([func.mol_chi3v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.7561936)

        rs = engine.execute(select([func.mol_chi4v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.4279941)

        rs = engine.execute(select([func.mol_kappa1(func.mol('C12CC2C3CC13'))
                                    ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.34375)

        rs = engine.execute(
            select([func.mol_kappa2(func.mol('CC(C)C1CCC(C)CCC1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 4.132653)

        rs = engine.execute(
            select([func.mol_kappa3(func.mol('CC(C)C1CCC(C)CCC1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.8444445)

        rs = engine.execute(
            select(
                [func.mol_numspiroatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(
            select([
                func.mol_numbridgeheadatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2'))
            ]))
        self.assertEqual(rs.fetchall()[0][0], 2)

        rs = engine.execute(
            select([func.mol_formula(func.mol('[2H]C([3H])O'))]))
        self.assertEqual(rs.fetchall()[0][0], 'CH4O')

        rs = engine.execute(
            select([func.mol_numrotatablebonds(func.mol('CCCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 1)

        rs = engine.execute(select([func.mol_numheavyatoms(func.mol('CCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 3)

        rs = engine.execute(select([func.mol_numatoms(func.mol('CCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 11)

        rs = engine.execute(select([func.mol_numheteroatoms(func.mol('CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 1)

        rs = engine.execute(select([func.mol_tpsa(func.mol('CCO'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 20.23)

        rs = engine.execute(select([func.mol_numrings(func.mol('CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(
            select([func.mol_murckoscaffold(func.mol('c1ccccc1CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 'c1ccccc1')

        rs = engine.execute(select([func.mol_to_svg(func.mol('CCO'))]))
        self.assertEqual(
            rs.fetchall()[0][0], '''<?xml version='1.0' encoding='iso-8859-1'?>
<svg version='1.1' baseProfile='full'
              xmlns='http://www.w3.org/2000/svg'
                      xmlns:rdkit='http://www.rdkit.org/xml'
                      xmlns:xlink='http://www.w3.org/1999/xlink'
                  xml:space='preserve'
width='250px' height='200px' viewBox='0 0 250 200'>
<!-- END OF HEADER -->
<rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='250' height='200' x='0' y='0'> </rect>
<path class='bond-0' d='M 11.3636,117.403 L 101.79,65.195' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<path class='bond-1' d='M 101.79,65.195 L 138.876,86.6068' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<path class='bond-1' d='M 138.876,86.6068 L 175.962,108.019' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<text dominant-baseline="central" text-anchor="start" x='179.443' y='122.623' style='font-size:34px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;fill:#FF0000' ><tspan>OH</tspan></text>
</svg>
''')
예제 #8
0
    def test_props(self):

        rs = engine.execute(select([ func.mol_amw(func.mol('c1ccccc1')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 78.114)

        rs = engine.execute(select([ func.mol_logp(func.mol('c1ccccc1')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.6866)

        rs = engine.execute(select([ func.mol_hba(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([ func.mol_hbd(func.mol('c1ccccc1')) ]))
        self.assertEqual(rs.fetchall()[0][0], 0)


        rs = engine.execute(select([ func.mol_chi0n(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.83396)

        rs = engine.execute(select([ func.mol_chi1n(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.13429)

        rs = engine.execute(select([ func.mol_chi2n(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.33555)

        rs = engine.execute(select([ func.mol_chi3n(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.756194)

        rs = engine.execute(select([ func.mol_chi4n(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.427994)


        rs = engine.execute(select([ func.mol_chi0v(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.83396)

        rs = engine.execute(select([ func.mol_chi1v(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.13429)

        rs = engine.execute(select([ func.mol_chi2v(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.33555)

        rs = engine.execute(select([ func.mol_chi3v(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.756194)

        rs = engine.execute(select([ func.mol_chi4v(func.mol('c1ccccc1O')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.427994)


        rs = engine.execute(select([ func.mol_kappa1(func.mol('C12CC2C3CC13')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.34375)

        rs = engine.execute(select([ func.mol_kappa2(func.mol('CC(C)C1CCC(C)CCC1')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 4.13265)

        rs = engine.execute(select([ func.mol_kappa3(func.mol('CC(C)C1CCC(C)CCC1')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.84444)


        rs = engine.execute(select([ func.mol_numspiroatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2')) ]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([ func.mol_numbridgeheadatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2')) ]))
        self.assertEqual(rs.fetchall()[0][0], 2)


        rs = engine.execute(select([ func.mol_formula(func.mol('[2H]C([3H])O')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'CH4O')


        rs = engine.execute(select([ func.mol_numrotatablebonds(func.mol('CCCC')) ]))
        self.assertEqual(rs.fetchall()[0][0], 1)

        rs = engine.execute(select([ func.mol_numheavyatoms(func.mol('CCC')) ]))
        self.assertEqual(rs.fetchall()[0][0], 3)

        rs = engine.execute(select([ func.mol_numatoms(func.mol('CCC')) ]))
        self.assertEqual(rs.fetchall()[0][0], 11)

        rs = engine.execute(select([ func.mol_numheteroatoms(func.mol('CCO')) ]))
        self.assertEqual(rs.fetchall()[0][0], 1)


        rs = engine.execute(select([ func.mol_tpsa(func.mol('CCO')) ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 20.23)


        rs = engine.execute(select([ func.mol_numrings(func.mol('CCO')) ]))
        self.assertEqual(rs.fetchall()[0][0], 0)


        rs = engine.execute(select([ func.mol_murckoscaffold(func.mol('c1ccccc1CCO')) ]))
        self.assertEqual(rs.fetchall()[0][0], 'c1ccccc1')


        rs = engine.execute(select([ func.mol_to_svg(func.mol('CCO')) ]))
        self.assertEqual(rs.fetchall()[0][0], '''<?xml version='1.0' encoding='iso-8859-1'?>
<svg:svg version='1.1' baseProfile='full'
              xmlns:svg='http://www.w3.org/2000/svg'
                      xmlns:rdkit='http://www.rdkit.org/xml'
                      xmlns:xlink='http://www.w3.org/1999/xlink'
                  xml:space='preserve'
width='250px' height='200px' >
<svg:rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='250' height='200' x='0' y='0'> </svg:rect>
<svg:path d='M 11.3636,124.362 95.7545,75.6385' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:path d='M 95.7545,75.6385 131.455,96.25' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:path d='M 131.455,96.25 167.155,116.862' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:text x='166.64' y='131.862' style='font-size:15px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#FF0000' ><svg:tspan>OH</svg:tspan></svg:text>
</svg:svg>
''')
예제 #9
0
    def test_props(self):

        rs = engine.execute(select([func.mol_amw(func.mol('c1ccccc1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 78.114)

        rs = engine.execute(select([func.mol_logp(func.mol('c1ccccc1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.6866)

        rs = engine.execute(select([func.mol_hba(func.mol('c1ccccc1'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([func.mol_hbd(func.mol('c1ccccc1'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(select([func.mol_chi0n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.83396)

        rs = engine.execute(select([func.mol_chi1n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.13429)

        rs = engine.execute(select([func.mol_chi2n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.33555)

        rs = engine.execute(select([func.mol_chi3n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.756194)

        rs = engine.execute(select([func.mol_chi4n(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.427994)

        rs = engine.execute(select([func.mol_chi0v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 3.83396)

        rs = engine.execute(select([func.mol_chi1v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.13429)

        rs = engine.execute(select([func.mol_chi2v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 1.33555)

        rs = engine.execute(select([func.mol_chi3v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.756194)

        rs = engine.execute(select([func.mol_chi4v(func.mol('c1ccccc1O'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 0.427994)

        rs = engine.execute(select([func.mol_kappa1(func.mol('C12CC2C3CC13'))
                                    ]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.34375)

        rs = engine.execute(
            select([func.mol_kappa2(func.mol('CC(C)C1CCC(C)CCC1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 4.13265)

        rs = engine.execute(
            select([func.mol_kappa3(func.mol('CC(C)C1CCC(C)CCC1'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 2.84444)

        rs = engine.execute(
            select(
                [func.mol_numspiroatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(
            select([
                func.mol_numbridgeheadatoms(func.mol('CC1(C)CC2(C)CCC1(C)CC2'))
            ]))
        self.assertEqual(rs.fetchall()[0][0], 2)

        rs = engine.execute(
            select([func.mol_formula(func.mol('[2H]C([3H])O'))]))
        self.assertEqual(rs.fetchall()[0][0], 'CH4O')

        rs = engine.execute(
            select([func.mol_numrotatablebonds(func.mol('CCCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 1)

        rs = engine.execute(select([func.mol_numheavyatoms(func.mol('CCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 3)

        rs = engine.execute(select([func.mol_numatoms(func.mol('CCC'))]))
        self.assertEqual(rs.fetchall()[0][0], 11)

        rs = engine.execute(select([func.mol_numheteroatoms(func.mol('CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 1)

        rs = engine.execute(select([func.mol_tpsa(func.mol('CCO'))]))
        self.assertAlmostEqual(rs.fetchall()[0][0], 20.23)

        rs = engine.execute(select([func.mol_numrings(func.mol('CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 0)

        rs = engine.execute(
            select([func.mol_murckoscaffold(func.mol('c1ccccc1CCO'))]))
        self.assertEqual(rs.fetchall()[0][0], 'c1ccccc1')

        rs = engine.execute(select([func.mol_to_svg(func.mol('CCO'))]))
        self.assertEqual(
            rs.fetchall()[0][0], '''<?xml version='1.0' encoding='iso-8859-1'?>
<svg:svg version='1.1' baseProfile='full'
              xmlns:svg='http://www.w3.org/2000/svg'
                      xmlns:rdkit='http://www.rdkit.org/xml'
                      xmlns:xlink='http://www.w3.org/1999/xlink'
                  xml:space='preserve'
width='250px' height='200px' >
<svg:rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='250' height='200' x='0' y='0'> </svg:rect>
<svg:path d='M 11.3636,124.362 95.7545,75.6385' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:path d='M 95.7545,75.6385 131.455,96.25' style='fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:path d='M 131.455,96.25 167.155,116.862' style='fill:none;fill-rule:evenodd;stroke:#FF0000;stroke-width:2px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1' />
<svg:text x='166.64' y='131.862' style='font-size:15px;font-style:normal;font-weight:normal;fill-opacity:1;stroke:none;font-family:sans-serif;text-anchor:start;fill:#FF0000' ><svg:tspan>OH</svg:tspan></svg:text>
</svg:svg>
''')