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)
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)
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)
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)
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)
def test_from_rdkit_feature_atom_charge(testset): smi, charge = testset g = Graph.from_rdkit(Chem.MolFromSmiles(smi)) assert(g.nodes.charge[0] == charge)
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)
def test_from_rdkit_feature_bond_stereo(testset): smi, stereo = testset g = Graph.from_rdkit(Chem.MolFromSmiles(smi)) assert(g.edges.stereo[1] == stereo)
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)
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)
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))