diff --git a/RanDepict/randepict.py b/RanDepict/randepict.py index f9ede06..49fe537 100644 --- a/RanDepict/randepict.py +++ b/RanDepict/randepict.py @@ -3244,6 +3244,7 @@ def get_valid_replacement_positions(self, smiles: str) -> List[int]: "f", "d", "n", + "@" # replacing chiral C leads to invalid SMILES ]: replacement_positions.append(index - 1) return replacement_positions diff --git a/Tests/test_functions.py b/Tests/test_functions.py index 64e5497..ba90099 100644 --- a/Tests/test_functions.py +++ b/Tests/test_functions.py @@ -539,3 +539,11 @@ def test_get_valid_replacement_positions_caffeine(self): observed = self.markush_creator.get_valid_replacement_positions("CN1C=NC2=C1C(=O)N(C(=O)N2C)C") expected = [0, 3, 11, 18, 25, 27] assert observed == expected + + def test_get_valid_replacement_positions_alanine(self): + # Example with stereo + smiles = "C([H])([H])([H])[C@@]([H])(C(=O)O[H])N([H])[H]" + observed = self.markush_creator.get_valid_replacement_positions(smiles) + expected = [0, 3, 8, 13, 23, 27, 34, 40, 44] + assert observed == expected +