def test_add_atom_map(toolkit): smiles = 'CCCC' mol = utils.load_molecule(smiles, toolkit=toolkit, strict=False) mapped_mol = utils.add_atom_map(mol, in_place=False) assert utils.has_atom_map(mapped_mol) assert not utils.has_atom_map(mol) assert not utils.is_missing_atom_map(mapped_mol) assert utils.is_missing_atom_map(mol)
def test_remove_restore_atom_map(toolkit): mapped_smiles = '[H:5][C:1]([H:6])([C:2]([H:7])([H:8])[O:4][H:10])[O:3][H:9]' mapped_mol = utils.load_molecule(mapped_smiles, toolkit=toolkit) utils.remove_atom_map(mapped_mol) assert utils.has_atom_map(mapped_mol) == False assert utils.is_missing_atom_map(mapped_mol) == True utils.restore_atom_map(mapped_mol) assert utils.has_atom_map(mapped_mol) == True assert utils.is_missing_atom_map(mapped_mol) == False smiles = 'OCCO' mol = utils.load_molecule(smiles, toolkit=toolkit) with pytest.warns(UserWarning): utils.restore_atom_map(mol)
def test_is_missing_map(toolkit, input, output): #ToDo - Known problem that RDKit does not add explicit H to molecules even with explicit H SMILES so if map of H is missing it will not pick it up mol = utils.load_molecule(input, toolkit=toolkit) assert utils.is_missing_atom_map(mol) == output