Skip to content

Commit

Permalink
avoid replacing chiral C with R groups #33
Browse files Browse the repository at this point in the history
  • Loading branch information
OBrink committed Nov 4, 2022
1 parent e98dd87 commit c761483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions RanDepict/randepict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions Tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit c761483

Please sign in to comment.