本文整理汇总了Python中testbabel.run_exec函数的典型用法代码示例。如果您正苦于以下问题:Python run_exec函数的具体用法?Python run_exec怎么用?Python run_exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_exec函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testSingleHit
def testSingleHit(self):
"""PR#2955101 - Difficulty reading from a fastsearch index"""
smiles = """C12(C(N(C(=O)C)c3c2cccc3)=O)Nc2c(ccc(c2N1)OCCCC)OCCCC
n1c([nH]c(cc1c1ccccc1)=O)c1ccc(cc1)Br
n1c(nc2c(c1N(C)C)cccc2)c1c(O)cccc1
C1(/[CH]2[CH]3\C(=C4/CC(C)(C)NC(C4)(C)C)C=C[CH]3[CH]1C=C2)=C1/CC(C)(C)NC(C1)(C)C
n1c(c2ccc(C(=O)O)cc2)ccc(c1)CCCCC
N1(C(CN(CC1=O)C(=O)C1CCCCC1)=O)CCc1ccccc1
S(N1[CH](c2ccccc2C=C1)C#N)(c1ccc(cc1)C)(=O)=O
c12c(c(OC)c3c(c1OC)occ3)ccc(o2)=O
c12c(O[CH](C1=O)C(C)C)cc1c(c2)ccc(=O)o1
c12[C]3([[email protected]]4([[email protected]@](CCc1c1ccccc1[nH]2)C[[email protected]](C=C4CC)C3))C(=O)OC"""
outputfile = open("ten.smi", "w")
outputfile.write(smiles)
outputfile.close()
output, error = run_exec("babel ten.smi ten.fs")
self.canFindFile("ten.fs")
self.assertConverted(error, 10)
query = "Nc2nc(c1ccccc1)nc3ccccc23"
output, error = run_exec("babel ten.fs -ifs -s %s -osmi" % query)
self.assertConverted(error, 1)
开发者ID:annulen,项目名称:openbabel,代码行数:25,代码来源:testfastsearch.py
示例2: testSMILESto3DMDL
def testSMILESto3DMDL(self):
"""Test interconversion between SMILES and 3D MDL"""
data = [
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3]), # 'ClC=CF'
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]), # 'Cl/C=C/F'
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]), # 'Cl/C=C\\F'
# The bond parities are irrelevant/meaningless for the next two
([0, 0, 0, 0, 1], []), # 'Cl[[email protected]@](Br)(F)I'
([0, 0, 0, 0, 2], []), # 'Cl[[email protected]](Br)(F)I'
([0, 0, 0, 0, 3], [0, 0, 0, 4]), # 'ClC(Br)(F)I'
([0, 0, 0, 1], []), # 'O=[[email protected]@](Cl)I),
([0, 0, 0, 2], []), # 'O=[[email protected]](Cl)I),
([0, 0, 0, 3], []), # 'O=S(Cl)I),
([0]*9, [0]*8 + [3]), # "IC=C1NC1"
([0]*9, [0]*9), # r"I/C=C\1/NC1"
([0]*9, [0]*9), # r"I/C=C/1\NC1"
]
for i, (atompar, bondstereo) in enumerate(data):
smiles, can = self.data[i][0:2]
output, error = run_exec(smiles, "babel -ismi -osdf --gen3d")
atoms, bonds = self.parseMDL(output)
parities = [atom['parity'] for atom in atoms]
parities.sort()
stereos = [bond['stereo'] for bond in bonds]
stereos.sort()
self.assertEqual(atompar, parities)
if bondstereo:
self.assertEqual(bondstereo, stereos)
output, error = run_exec(output, "babel -isdf -ocan")
self.assertEqual(output.rstrip(), can)
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:30,代码来源:testsym.py
示例3: testRSMItoRINCHI
def testRSMItoRINCHI(self):
data = [
("C>N>O", "RInChI=1.00.1S/CH4/h1H4<>H2O/h1H2<>H3N/h1H3/d+"),
("O>N>C", "RInChI=1.00.1S/CH4/h1H4<>H2O/h1H2<>H3N/h1H3/d-"),
("O>>C", "RInChI=1.00.1S/CH4/h1H4<>H2O/h1H2/d-"),
# The following is assumed to be d+ by analogy with
# the empty reaction which is d+
("O>>O", "RInChI=1.00.1S/H2O/h1H2<>H2O/h1H2/d+"),
# Example: esterification of acetic acid
("OCC.CC(=O)O>S(=O)(=O)(O)O>CC(=O)OCC.O", "RInChI=1.00.1S/C2H4O2/c1-2(3)4/h1H3,(H,3,4)!C2H6O/c1-2-3/h3H,2H2,1H3<>C4H8O2/c1-3-6-4(2)5/h3H2,1-2H3!H2O/h1H2<>H2O4S/c1-5(2,3)4/h(H2,1,2,3,4)/d+"),
# Example: alkaline ring opening
("CC[[email protected]]1(C)O[[email protected]]1C.[OH-]>>CC[[email protected]](C)(O)[[email protected]@H](C)O", "RInChI=1.00.1S/C6H12O/c1-4-6(3)5(2)7-6/h5H,4H2,1-3H3/t5-,6-/m0/s1!H2O/h1H2/p-1<>C6H14O2/c1-4-6(3,8)5(2)7/h5,7-8H,4H2,1-3H3/t5-,6+/m1/s1/d+"),
# Partial reactions
(">>C1CC=C(O)CC1", "RInChI=1.00.1S/<>C6H10O/c7-6-4-2-1-3-5-6/h4,7H,1-3,5H2/d+"),
("C1CC=C(O)CC1>>", "RInChI=1.00.1S/<>C6H10O/c7-6-4-2-1-3-5-6/h4,7H,1-3,5H2/d-"),
# The empty reaction
(">>", "RInChI=1.00.1S//d+"),
# Test 'no-structure'
("c1ccccc1C=C>>*", "RInChI=1.00.1S/<>C8H8/c1-2-8-6-4-3-5-7-8/h2-7H,1H2/d-/u1-0-0"),
("*>>C1CC=C(O)CC1", "RInChI=1.00.1S/<>C6H10O/c7-6-4-2-1-3-5-6/h4,7H,1-3,5H2/d+/u1-0-0"),
("O>*>C", "RInChI=1.00.1S/CH4/h1H4<>H2O/h1H2/d-/u0-0-1"),
("*.O>>C", "RInChI=1.00.1S/CH4/h1H4<>H2O/h1H2/d-/u0-1-0"),
# Empty except for 'no-structures' (assumed)
("*>*>*", "RInChI=1.00.1S//d+/u1-1-1"),
]
for eqm in [False, True]:
for rsmi, rinchi in data:
if eqm:
output, error = run_exec('obabel -:%s -ismi -orinchi -xe' % rsmi)
ans = rinchi.replace("/d-", "/d=").replace("/d+", "/d=")
self.assertEqual(output.rstrip(), ans)
else:
output, error = run_exec('obabel -:%s -ismi -orinchi' % rsmi)
self.assertEqual(output.rstrip(), rinchi)
开发者ID:Reinis,项目名称:openbabel,代码行数:34,代码来源:testRInChI.py
示例4: testSMIthruXML
def testSMIthruXML(self):
"""Verify that roundtripping through CML preserves stereo"""
output, error = run_exec("\n".join(self.smiles), "babel -ismi -ocml tmp.cml")
output, error = run_exec(output.rstrip(), "babel -icml tmp.cml -ocan")
output = "\n".join([x.rstrip() for x in output.split("\n")])
self.assertEqual(output.rstrip(), "\n".join([self.cansmi] * len(self.smiles)))
os.remove("tmp.cml")
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:7,代码来源:testsym.py
示例5: testInChIToSMILES_Bug
def testInChIToSMILES_Bug(self):
"""PR#2101034- InChI <-> SMILES conv misrepresents stereo"""
test_inchi = 'InChI=1S/C10H10/c1-2-3-7-10-8-5-4-6-9-10/h2-9H,1H2/b7-3+'
output, error = run_exec(test_inchi, "babel -iinchi -osmi")
self.assertEqual(output.rstrip(), "C=C/C=C/c1ccccc1")
test_smiles = "C=C\C=C/c1ccccc1"
output, error = run_exec(test_smiles, "babel -ismi -oinchi")
self.assertEqual(output.rstrip(), "InChI=1S/C10H10/c1-2-3-7-10-8-5-4-6-9-10/h2-9H,1H2/b7-3-")
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:9,代码来源:testsym.py
示例6: testSMILEStoInChI
def testSMILEStoInChI(self):
# Tests interconversions between the SMILES on the left versus
# the InChI on the right.
# The canonical smiles (in the middle) were derived from the SMILES.
for smiles, can, inchi in self.data:
output, error = run_exec(smiles, "babel -ismi -oinchi")
self.assertEqual(output.rstrip(), inchi)
output, error = run_exec(inchi, "babel -iinchi -ocan")
self.assertEqual(output.rstrip(), can)
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:9,代码来源:testsym.py
示例7: test2DMDLto0D
def test2DMDLto0D(self):
"""Test conversion for 2D MDL to CAN and InChI"""
# The following file was created using RDKit starting from
# the SMILES strings in data[x][0] below.
filename = self.getTestFile("testsym_2Dtests.sdf")
output, error = run_exec("babel -isdf %s -ocan" % filename)
for i, smiles in enumerate(output.rstrip().split("\n")):
self.assertEqual(smiles.rstrip(), self.data[i][1])
output, error = run_exec("babel -isdf %s -oinchi" % filename)
for i, inchi in enumerate(output.rstrip().split("\n")):
self.assertEqual(inchi.rstrip(), self.data[i][2])
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:13,代码来源:testsym.py
示例8: testChiralToLonePair
def testChiralToLonePair(self):
"""PR#3058701 - Handle stereochemistry at lone pair on S"""
# Note to self: Need to ensure that roundtripping through the various
# 2D and 3D formats works. In the meanwhile, this test at least ensures
# that SMILES reading and writing works fine.
can = '[[email protected]@](=O)(Cl)C'
smiles = [can, '[[email protected]](Cl)(=O)C', 'O=[[email protected]](Cl)C']
for smile in smiles:
output, error = run_exec(smile, "babel -ismi -ocan")
self.assertEqual(output.rstrip(), can)
# Check that regular chiral S still work fine
smi = "[[email protected]](=O)(=N)(C)O"
output, error = run_exec(smi, "babel -ismi -osmi")
self.assertEqual(output.rstrip(), smi)
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:14,代码来源:testsym.py
示例9: test2DMDLto2DMDL
def test2DMDLto2DMDL(self):
"""Make sure that stereo is preserved when writing wedge bonds"""
filenames = [self.getTestFile(x) for x in
["testsym_2Dtests_more.sdf",
"testsym_2Dtests_threeligands.sdf"]]
# The test files have the correct canonical SMILES string
# stored in the data field "smiles"
output, error = run_exec("obabel -isdf %s %s -osdf --append smiles" %
(filenames[0], filenames[1]))
finaloutput, error = run_exec(output, "obabel -isdf -ocan")
for line in finaloutput.rstrip().split("\n"):
result, correct_answer = line.split()
self.assertEqual(result, correct_answer)
开发者ID:Acpharis,项目名称:openbabel,代码行数:14,代码来源:testsym.py
示例10: testRInChIOfficialExamples
def testRInChIOfficialExamples(self):
"""These test RXN to RInChI using the examples in the RInChI distrib"""
for rxnfile in glob.glob(os.path.join(here, "rinchi", "*.rxn")):
dirname, fname = os.path.split(rxnfile)
output, error = run_exec('obabel %s -orinchi' % rxnfile)
ans = open(os.path.join(dirname, fname.split(".")[0]+".txt")).readlines()[0]
self.assertEqual(output.rstrip(), ans.rstrip())
开发者ID:cstein,项目名称:openbabel,代码行数:7,代码来源:testRInChI.py
示例11: fastcheckmatch
def fastcheckmatch(query, molecules):
"""May fail where Open Babel does not output the input query, e.g.
[[email protected]@]([H])(Br)(Cl)I is output as [[email protected]@H](Br)(Cl)I"""
output, error = run_exec("\n".join(molecules), "obabel -ismi -s%s -osmi" % query)
converted = [x.rstrip() for x in output.split("\n")]
results = [smi in converted for smi in molecules]
return results
开发者ID:Acpharis,项目名称:openbabel,代码行数:7,代码来源:testsmartssym.py
示例12: testSMILEStoInChI
def testSMILEStoInChI(self):
# Tests interconversions between the SMILES on the left versus
# the InChI on the right.
# The canonical smiles (in the middle) were derived from the SMILES.
data = [
('ClC=CF', 'FC=CCl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H'),
('Cl/C=C/F', 'F/C=C/Cl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H/b2-1+'),
('Cl/C=C\\F', 'F/C=C\\Cl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H/b2-1-'),
('Cl[[email protected]@](Br)(F)I', 'F[[email protected]@](Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5/t1-/m0/s1'),
('Cl[[email protected]](Br)(F)I', 'F[[email protected]](Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5/t1-/m1/s1'),
('ClC(Br)(F)I', 'FC(Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5')]
for smiles, can, inchi in data:
output, error = run_exec(smiles, "babel -ismi -oinchi")
self.assertEqual(output.rstrip(), inchi)
output, error = run_exec(inchi, "babel -iinchi -ocan")
self.assertEqual(output.rstrip(), can)
开发者ID:annulen,项目名称:openbabel,代码行数:16,代码来源:testsym.py
示例13: testSMItoCAN
def testSMItoCAN(self):
"""PR#1842055- bad isotope canonicalization"""
self.canFindExecutable("babel")
# A series of isotopamers, and their canonical forms
self.smiles = [
'c1ccccc1',
'c1[14cH]cccc1',
'c1[14cH][14cH]ccc1',
'c1[14cH][14cH][14cH]cc1',
'c1[14cH][14cH][14cH][14cH]c1',
'c1[14cH][14cH][14cH][14cH][14cH]1',
'[14cH]1[14cH][14cH][14cH][14cH][14cH]1',
]
self.cansmis = [
'c1ccccc1',
'[14cH]1ccccc1',
'[14cH]1[14cH]cccc1',
'[14cH]1[14cH]ccc[14cH]1',
'[14cH]1[14cH][14cH]cc[14cH]1',
'[14cH]1[14cH][14cH]c[14cH][14cH]1',
'[14cH]1[14cH][14cH][14cH][14cH][14cH]1',
'[14cH]1[14cH][14cH][14cH][14cH][14cH]1',
]
for i in range(0, len(self.smiles)):
output, error = run_exec(self.smiles[i], "babel -ismi -ocan")
self.assertEqual(output.rstrip(), self.cansmis[i])
开发者ID:Reinis,项目名称:openbabel,代码行数:27,代码来源:testkekule.py
示例14: testSMItoSMI
def testSMItoSMI(self):
"""
PR#2705497 aromatic - kekule conversion issue
PR#1445453 SMILES aromaticity fails on 4-valent N+ atoms
PR#1814248 Aromaticity munged by SMILES input
PR#1761638 Error in Aromaticity / Kekulize
PR#2948661 Trunk fails aromaticity
"""
self.canFindExecutable("babel")
# A series of aromatic strings, which should convert to themselves
self.smiles = [
'c12-c3c(cc(N)cc3)Cc1cccc2',
'c1(=O)n(c2c(c(=O)o1)cccc2)CC(=O)OCC',
'c1n[nH]c(=S)[nH]1',
'O=c1[nH]ccc2nc3oc4ccccc4c(=O)c3cc12',
'c1nc2sccn2c1',
'c1[nH+]cnc2[nH]cnc12',
'c1onc(c2ccccc2Cl)c1',
'c1ccc2[nH]c3ccc4cc[nH+]cc4c3c2c1',
'[nH]1c2ccccc2c2c3C(=O)NCc3c3c4ccccc4[nH]c3c12',
'c1c(C)c2C=c3[n-]c(=Cc4[nH]c(C=c5[n-]c(=Cc1[nH]2)c(C)c5C=C)c(C)c4CCC(=O)O)c(CCC(=O)O)c3',
'C1=C2CCC(=Cc3ccc([nH]3)C=c3ccc(=Cc4ccc1[nH]4)[nH]3)N2',
'c1(NC(=O)C2CC2)nc2-c3c(cccc3)CCc2cn1',
'O=C1N(CCCC)C(=O)NC2C1C1N(N2)CCN1',
'Cn1cccnc1=O',
'O=c1n(C)c(=O)nc2-c1c1n([nH]2)cc[nH]1',
'Cn1ccn2c1nc1c2c(=O)n(C)c(=O)n1C'
]
for i in range(0, len(self.smiles)):
output, error = run_exec(self.smiles[i], "babel -ismi -osmi")
self.assertEqual(output.rstrip(), self.smiles[i])
开发者ID:Reinis,项目名称:openbabel,代码行数:32,代码来源:testkekule.py
示例15: testSMILESto0DMDL
def testSMILESto0DMDL(self):
"""Test interconversion between SMILES and 0D MDL"""
data = [
([0, 0, 0, 0, 1], [0, 0, 0, 0]), # 'Cl[[email protected]@](Br)(F)I'
([0, 0, 0, 0, 2], [0, 0, 0, 0]), # 'Cl[[email protected]](Br)(F)I'
([0, 0, 0, 0, 3], [0, 0, 0, 0]) # 'ClC(Br)(F)I'
]
for i, (atompar, bondstereo) in enumerate(data):
smiles, can = self.data[i + 3][0:2]
output, error = run_exec(smiles, "babel -ismi -osdf")
atoms, bonds = self.parseMDL(output)
parities = [atom['parity'] for atom in atoms]
parities.sort()
stereos = [bond['stereo'] for bond in bonds]
stereos.sort()
self.assertEqual(atompar, parities)
self.assertEqual(bondstereo, stereos)
output, error = run_exec(output, "babel -isdf -as -ocan")
self.assertEqual(output.rstrip(), can)
开发者ID:baoilleach,项目名称:openbabel-svn-mirror,代码行数:19,代码来源:testsym.py
示例16: test2DMDLto0D
def test2DMDLto0D(self):
"""Test conversion for 2D MDL to CAN and InChI"""
# The following file was created using RDKit starting from
# the SMILES strings in data[x][0] below.
filename = self.getTestFile("testsym_2Dtests.sdf")
data = [
('ClC=CF', 'FC=CCl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H'),
('Cl/C=C/F', 'F/C=C/Cl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H/b2-1+'),
('Cl/C=C\\F', 'F/C=C\\Cl', 'InChI=1S/C2H2ClF/c3-1-2-4/h1-2H/b2-1-'),
('Cl[[email protected]@](Br)(F)I', 'F[[email protected]@](Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5/t1-/m0/s1'),
('Cl[[email protected]](Br)(F)I', 'F[[email protected]](Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5/t1-/m1/s1'),
('ClC(Br)(F)I', 'FC(Cl)(Br)I', 'InChI=1S/CBrClFI/c2-1(3,4)5')]
output, error = run_exec("babel -isdf %s -ocan" % filename)
for i, smiles in enumerate(output.rstrip().split("\n")):
self.assertEqual(smiles.rstrip(), data[i][1])
output, error = run_exec("babel -isdf %s -oinchi" % filename)
for i, inchi in enumerate(output.rstrip().split("\n")):
self.assertEqual(inchi.rstrip(), data[i][2])
开发者ID:annulen,项目名称:openbabel,代码行数:20,代码来源:testsym.py
示例17: testSMILESto3DMDL
def testSMILESto3DMDL(self):
"""Test interconversion between SMILES and 3D MDL"""
data = [
('ClC=CF', 'FC=CCl', [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3]),
('Cl/C=C/F', 'F/C=C/Cl', [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]),
('Cl/C=C\\F', 'F/C=C\\Cl', [0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]),
('Cl[[email protected]@](Br)(F)I', 'F[[email protected]@](Cl)(Br)I', [0, 0, 0, 0, 1], [0, 0, 0, 1]),
('Cl[[email protected]](Br)(F)I', 'F[[email protected]](Cl)(Br)I', [0, 0, 0, 0, 2], [0, 0, 0, 6]),
('ClC(Br)(F)I', 'FC(Cl)(Br)I', [0, 0, 0, 0, 3], [0, 0, 0, 4])
]
for smiles, can, atompar, bondstereo in data:
output, error = run_exec(smiles, "babel -ismi -osdf --gen3d")
atoms, bonds = self.parseMDL(output)
parities = [atom['parity'] for atom in atoms]
parities.sort()
stereos = [bond['stereo'] for bond in bonds]
stereos.sort()
self.assertEqual(atompar, parities)
self.assertEqual(bondstereo, stereos)
output, error = run_exec(output, "babel -isdf -ocan")
self.assertEqual(output.rstrip(), can)
开发者ID:annulen,项目名称:openbabel,代码行数:21,代码来源:testsym.py
示例18: testXYZtoSMILESand3DMDL
def testXYZtoSMILESand3DMDL(self):
"""Test conversion from XYZ to SMILES and 3D MDL"""
# Since the XYZ format does not trigger stereo perception,
# this test makes sure that the SMILES and 3D MDL formats
# perceive stereo themselves.
data = [
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3]), # 'ClC=CF'
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 3]), # 'ClC=CF'
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]), # 'Cl/C=C/F'
([0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0]), # 'Cl/C=C\\F'
# The bond parities are irrelevant/meaningless for the next two
([0, 0, 0, 0, 1], []), # 'Cl[[email protected]@](Br)(F)I'
([0, 0, 0, 0, 2], []), # 'Cl[[email protected]](Br)(F)I'
([0, 0, 0, 0, 3], [0, 0, 0, 4]), # 'ClC(Br)(F)I'
([0, 0, 0, 1], []), # 'O=[[email protected]@](Cl)I),
([0, 0, 0, 2], []), # 'O=[[email protected]](Cl)I),
([0, 0, 0, 3], []), # 'O=S(Cl)I),
([0]*9, [0]*8 + [3]), # "IC=C1NC1"
([0]*9, [0]*9), # r"I/C=C\1/NC1"
([0]*9, [0]*9), # r"I/C=C/1\NC1"
]
for i, (atompar, bondstereo) in enumerate(data):
if i in [0, 1, 6, 10]: continue # ambiguous stereo is lost in XYZ
if i in [7, 8, 9]: continue # perception of S=O from XYZ fails
smiles, can = self.data[i][0:2]
output, error = run_exec(smiles, "babel -ismi -oxyz --gen3d")
canoutput, error = run_exec(output, "babel -ixyz -ocan")
self.assertEqual(canoutput.rstrip(), can)
sdfoutput, error = run_exec(output, "babel -ixyz -osdf")
atoms, bonds = self.parseMDL(sdfoutput)
parities = [atom['parity'] for atom in atoms]
parities.sort()
stereos = [bond['stereo'] for bond in bonds]
stereos.sort()
self.assertEqual(atompar, parities)
if bondstereo:
self.assertEqual(bondstereo, stereos)
开发者ID:Acpharis,项目名称:openbabel,代码行数:40,代码来源:testsym.py
示例19: testFindDups
def testFindDups(self):
"""Look for duplicates using --unique"""
params = [("", 13), ("/formula", 5),
("/connect", 6), ("/nostereo", 9),
("/nosp3", 11), ("/noEZ", 11),
("/nochg", 12), ("/noiso", 11),
("cansmi", 13), ("cansmiNS", 7)]
for param in params:
output, error = run_exec(self.smiles,
"babel -ismi -osmi --unique %s" % param[0])
self.assertConverted(error, param[1])
开发者ID:annulen,项目名称:openbabel,代码行数:13,代码来源:testunique.py
示例20: test2DMDLto0D_more
def test2DMDLto0D_more(self):
"""Test various combinations of stereobonds in 2D perception"""
filenames = [self.getTestFile(x) for x in
["testsym_2Dtests_more.sdf",
"testsym_2Dtests_threeligands.sdf"]]
# The test files have the correct canonical SMILES string
# stored in the data field "smiles"
output, error = run_exec("obabel -isdf %s %s -ocan --append smiles" %
(filenames[0], filenames[1]))
for line in output.rstrip().split("\n"):
result, correct_answer = line.split()
self.assertEqual(result, correct_answer)
开发者ID:Acpharis,项目名称:openbabel,代码行数:13,代码来源:testsym.py
注:本文中的testbabel.run_exec函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论