Skip to content

Commit

Permalink
Merge branch 'main' into explainability_module
Browse files Browse the repository at this point in the history
  • Loading branch information
JochenSiegWork authored Sep 27, 2024
2 parents 4d20311 + 21b1f10 commit cdbece2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
5 changes: 2 additions & 3 deletions molpipeline/mol2any/mol2morgan_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ def _explain_rdmol(self, mol_obj: RDKitMol) -> dict[int, list[tuple[int, int]]]:
fp_generator = self._get_fp_generator()
additional_output = AllChem.AdditionalOutput()
additional_output.AllocateBitInfoMap()
_ = fp_generator.GetSparseFingerprint(
mol_obj, additionalOutput=additional_output
)
# using the dense fingerprint here, to get indices after folding
_ = fp_generator.GetFingerprint(mol_obj, additionalOutput=additional_output)
bit_info = additional_output.GetBitInfoMap()
return bit_info
12 changes: 2 additions & 10 deletions tests/test_elements/test_mol2any/test_mol2morgan_fingerprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,8 @@ def test_setter_getter_error_handling(self) -> None:
self.assertRaises(ValueError, mol_fp.set_params, **params)

def test_bit2atom_mapping(self) -> None:
"""Test that the mapping from bits to atom weights works as intended.
Notes
-----
lower n_bit values, e.g. 2048, will lead to a bit clash during folding,
for the test smiles "NCCOCCCC(=O)O".
We want no folding clashes in this test to check the correct length
of the bit-to-atom mapping.
"""
n_bits = 2100
"""Test that the mapping from bits to atom weights works as intended."""
n_bits = 2048
sparse_morgan = MolToMorganFP(radius=2, n_bits=n_bits, return_as="sparse")
dense_morgan = MolToMorganFP(radius=2, n_bits=n_bits, return_as="dense")
explicit_bit_vect_morgan = MolToMorganFP(
Expand Down

0 comments on commit cdbece2

Please sign in to comment.