Beispiel #1
0
def test_from_rdkit_linear_hydrocarbon():
    for i in range(2, 10):
        smi = 'C' * i
        mol = Chem.MolFromSmiles(smi)
        g = Graph.from_rdkit(mol)
        assert(len(g.nodes) == i)
        assert(len(g.edges) == i - 1)
Beispiel #2
0
def test_from_rdkit_options():
    m = Chem.MolFromSmiles('CCOCC')
    g = Graph.from_rdkit(m, bond_type='order')
    assert('order' in g.edges.columns)
    g = Graph.from_rdkit(m, bond_type='type')
    assert('type' in g.edges.columns)
    g = Graph.from_rdkit(m, set_ring_list=True)
    assert('ring_list' in g.nodes.columns)
    g = Graph.from_rdkit(m, set_ring_list=False)
    assert('ring_list' not in g.nodes.columns)
    g = Graph.from_rdkit(m, set_ring_stereo=True)
    assert('ring_stereo' in g.edges.columns)
    g = Graph.from_rdkit(m, set_ring_stereo=False)
    assert('ring_stereo' not in g.edges.columns)
Beispiel #3
0
def test_from_rdkit_feature_atom_aromatic(testset):
    smi, aromatic = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.nodes.rows():
        assert(n.aromatic == aromatic)
Beispiel #4
0
def test_from_rdkit_feature_atom_hybridization(testset):
    smi, hybridization = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.nodes.rows():
        assert(n.hybridization == hybridization)
Beispiel #5
0
def test_from_rdkit_feature_atom_hcount(testset):
    smi, hcount = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.nodes.rows():
        assert(n.hcount == hcount)
Beispiel #6
0
def test_from_rdkit_feature_atom_charge(testset):
    smi, charge = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    assert(g.nodes.charge[0] == charge)
Beispiel #7
0
def test_from_rdkit_feature_atomic_number(testset):
    smi, atomic_number = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.nodes.rows():
        assert(n.atomic_number == atomic_number)
Beispiel #8
0
def test_from_rdkit_feature_bond_stereo(testset):
    smi, stereo = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    assert(g.edges.stereo[1] == stereo)
Beispiel #9
0
def test_from_rdkit_feature_bond_conjugated(testset):
    smi, conjugated = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.edges.rows():
        assert(n.conjugated == conjugated)
Beispiel #10
0
def test_from_rdkit_feature_bond_order(testset):
    smi, order = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    for n in g.edges.rows():
        assert(n.order == order)
Beispiel #11
0
def test_from_rdkit_feature_atom_ring_list(testset):
    smi, ring_list = testset
    g = Graph.from_rdkit(Chem.MolFromSmiles(smi))
    assert(set(g.nodes.ring_list[0]) == set(ring_list))