Skip to content

Commit

Permalink
fix viz
Browse files Browse the repository at this point in the history
  • Loading branch information
maclandrol committed Dec 7, 2023
1 parent e1e2cbd commit fafcb89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions safe/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def linker_generation(
n_samples_per_trial: int = 10,
n_trials: Optional[int] = 1,
sanitize: bool = False,
do_not_fragment_further: Optional[bool] = False,
do_not_fragment_further: Optional[bool] = True,
random_seed: Optional[int] = None,
model_only: Optional[bool] = False,
**kwargs,
Expand Down Expand Up @@ -142,7 +142,7 @@ def scaffold_morphing(
n_samples_per_trial: int = 10,
n_trials: Optional[int] = 1,
sanitize: bool = False,
do_not_fragment_further: Optional[bool] = False,
do_not_fragment_further: Optional[bool] = True,
random_seed: Optional[int] = None,
**kwargs,
):
Expand Down
6 changes: 4 additions & 2 deletions safe/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ def to_image(
sf.decode(x, as_mol=False, remove_dummies=False, ignore_errors=False)
for x in safe_str.split(".")
]
else:
elif fragments and len(fragments) > 0:
parsed_fragments = []
for fg in fragments:
if isinstance(fg, str) and dm.to_mol(fg) is None:
fg = sf.decode(fg, as_mol=False, remove_dummies=False, ignore_errors=False)
parsed_fragments.append(fg)
parsed_fragments.append(fg)
fragments = parsed_fragments
else:
fragments = []
mol = dm.to_mol(safe_str, remove_hs=False)
cm = plt.get_cmap("gist_rainbow")
current_colors = [cm(1.0 * i / len(fragments)) for i in range(len(fragments))]
Expand Down

0 comments on commit fafcb89

Please sign in to comment.