Skip to content

Commit

Permalink
Add setup.py and count_ring_system tests
Browse files Browse the repository at this point in the history
  • Loading branch information
skearnes committed Jun 30, 2014
1 parent b418709 commit f44e993
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
6 changes: 3 additions & 3 deletions muv/descriptors.py
Expand Up @@ -15,7 +15,7 @@

from rdkit import Chem
from rdkit.Chem import AllChem
from rdkit.Chem.ChiralType import CHI_TETRAHEDRAL_CW, CHI_TETRAHEDRAL_CCW
from rdkit.Chem import ChiralType


class Descriptors(object):
Expand Down Expand Up @@ -55,8 +55,8 @@ def get_descriptors(self, mol):
# number of chiral centers
n_chiral = 0
for atom in mol.GetAtoms():
if (atom.GetChiralTag() == CHI_TETRAHEDRAL_CW or
atom.GetChiralTag() == CHI_TETRAHEDRAL_CCW):
if (atom.GetChiralTag() == ChiralType.CHI_TETRAHEDRAL_CW or
atom.GetChiralTag() == ChiralType.CHI_TETRAHEDRAL_CCW):
n_chiral += 1
d.append(n_chiral)

Expand Down
17 changes: 17 additions & 0 deletions muv/tests/test_descriptors.py
@@ -1 +1,18 @@
"""
Tests for descriptors.
"""
from rdkit import Chem

from muv.descriptors import Descriptors


def test_count_ring_systems():
d = Descriptors()
hexane = Chem.MolFromSmiles("CCCCCC")
assert d.count_ring_systems(hexane) == 0
benzene = Chem.MolFromSmiles("c1ccccc1")
assert d.count_ring_systems(benzene) == 1
naphthalene = Chem.MolFromSmiles("c1ccc2ccccc2c1")
assert d.count_ring_systems(naphthalene) == 1
biphenyl = Chem.MolFromSmiles("c1ccc(cc1)c2ccccc2")
assert d.count_ring_systems(biphenyl) == 2
15 changes: 15 additions & 0 deletions setup.py
@@ -0,0 +1,15 @@
from setuptools import setup, find_packages


def main():
setup(
name='muv',
version='0.1',
license='3-clause BSD',
url='https://github.com/skearnes/muv',
description='Generate maximum unbiased validation (MUV) datasets for virtual screening',
packages=find_packages(),
)

if __name__ == '__main__':
main()

0 comments on commit f44e993

Please sign in to comment.