-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
2244 | ||
-OEChem-12012120113D | ||
|
||
21 21 0 0 0 0 0 0 0999 V2000 | ||
1.2333 0.5540 0.7792 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.6952 -2.7148 -0.7502 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
0.7958 -2.1843 0.8685 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
1.7813 0.8105 -1.4821 O 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.0857 0.6088 0.4403 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.7927 -0.5515 0.1244 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.7288 1.8464 0.4133 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-2.1426 -0.4741 -0.2184 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-2.0787 1.9238 0.0706 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-2.7855 0.7636 -0.2453 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.1409 -1.8536 0.1477 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
2.1094 0.6715 -0.3113 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
3.5305 0.5996 0.1635 C 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.1851 2.7545 0.6593 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-2.7247 -1.3605 -0.4564 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-2.5797 2.8872 0.0506 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-3.8374 0.8238 -0.5090 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
3.7290 1.4184 0.8593 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
4.2045 0.6969 -0.6924 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
3.7105 -0.3659 0.6426 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
-0.2555 -3.5916 -0.7337 H 0 0 0 0 0 0 0 0 0 0 0 0 | ||
1 5 1 0 0 0 0 | ||
1 12 1 0 0 0 0 | ||
2 11 1 0 0 0 0 | ||
2 21 1 0 0 0 0 | ||
3 11 2 0 0 0 0 | ||
4 12 2 0 0 0 0 | ||
5 6 1 0 0 0 0 | ||
5 7 2 0 0 0 0 | ||
6 8 2 0 0 0 0 | ||
6 11 1 0 0 0 0 | ||
7 9 1 0 0 0 0 | ||
7 14 1 0 0 0 0 | ||
8 10 1 0 0 0 0 | ||
8 15 1 0 0 0 0 | ||
9 10 2 0 0 0 0 | ||
9 16 1 0 0 0 0 | ||
10 17 1 0 0 0 0 | ||
12 13 1 0 0 0 0 | ||
13 18 1 0 0 0 0 | ||
13 19 1 0 0 0 0 | ||
13 20 1 0 0 0 0 | ||
M END | ||
> <PUBCHEM_COMPOUND_CID> | ||
2244 | ||
|
||
$$$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,37 @@ | ||
import unittest | ||
from collections import OrderedDict | ||
|
||
from padelpy import from_smiles, from_mdl | ||
from padelpy import from_mdl, from_sdf, from_smiles | ||
|
||
|
||
class TestAll(unittest.TestCase): | ||
|
||
def test_from_smiles(self): | ||
|
||
descriptors = from_smiles('CCC') | ||
self.assertEqual(len(descriptors), 1875) | ||
self.assertAlmostEqual(float(descriptors['MW']), 44.0626, 4) | ||
self.assertEqual(int(descriptors['nC']), 3) | ||
|
||
def test_multiple_smiles(self): | ||
|
||
smiles = ['CCC', 'CCCC'] | ||
descriptors = from_smiles(smiles) | ||
self.assertEqual(len(descriptors), 2) | ||
self.assertEqual(len(descriptors[0]), 1875) | ||
|
||
def test_errors(self): | ||
|
||
bad_smiles = 'SJLDFGSJ' | ||
self.assertRaises(RuntimeError, from_smiles, bad_smiles) | ||
bad_smiles = ['SJLDFGSJ', 'CCC'] | ||
self.assertRaises(RuntimeError, from_smiles, bad_smiles) | ||
|
||
def test_from_sdf(self): | ||
"""Test SDF file input functionality.""" | ||
descriptors = from_sdf("aspirin_3d.sdf")[0] | ||
self.assertEqual(len(descriptors), 1875) | ||
self.assertAlmostEqual(float(descriptors['MW']), 180.04225, 4) | ||
self.assertAlmostEqual(float(descriptors['SsCH3']), 1.2209, 4) | ||
self.assertEqual(int(descriptors['nC']), 9) | ||
|
||
if __name__ == '__main__': | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |