コード例 #1
0
ファイル: test_rdkit_util.py プロジェクト: AhlamMD/deepchem
  def test_add_hydrogens_to_mol(self):
    current_dir = os.path.dirname(os.path.realpath(__file__))
    ligand_file = os.path.join(current_dir, "../../dock/tests/1jld_ligand.sdf")
    xyz, mol = rdkit_util.load_molecule(
        ligand_file, calc_charges=False, add_hydrogens=False)
    original_hydrogen_count = 0
    for atom_idx in range(mol.GetNumAtoms()):
      atom = mol.GetAtoms()[atom_idx]
      if atom.GetAtomicNum() == 1:
        original_hydrogen_count += 1

    mol = rdkit_util.add_hydrogens_to_mol(mol)
    after_hydrogen_count = 0
    for atom_idx in range(mol.GetNumAtoms()):
      atom = mol.GetAtoms()[atom_idx]
      if atom.GetAtomicNum() == 1:
        after_hydrogen_count += 1
    assert_true(after_hydrogen_count >= original_hydrogen_count)
コード例 #2
0
ファイル: test_rdkit_util.py プロジェクト: zzachw/deepchem
    def test_add_hydrogens_to_mol(self):
        current_dir = os.path.dirname(os.path.realpath(__file__))
        ligand_file = os.path.join(current_dir,
                                   "../../dock/tests/1jld_ligand.sdf")
        xyz, mol = rdkit_util.load_molecule(ligand_file,
                                            calc_charges=False,
                                            add_hydrogens=False)
        original_hydrogen_count = 0
        for atom_idx in range(mol.GetNumAtoms()):
            atom = mol.GetAtoms()[atom_idx]
            if atom.GetAtomicNum() == 1:
                original_hydrogen_count += 1

        mol = rdkit_util.add_hydrogens_to_mol(mol)
        after_hydrogen_count = 0
        for atom_idx in range(mol.GetNumAtoms()):
            atom = mol.GetAtoms()[atom_idx]
            if atom.GetAtomicNum() == 1:
                after_hydrogen_count += 1
        assert_true(after_hydrogen_count >= original_hydrogen_count)