From fafcb897911d50c767212b397b62914c4edf3adc Mon Sep 17 00:00:00 2001 From: maclandrol Date: Thu, 7 Dec 2023 17:16:02 -0500 Subject: [PATCH] fix viz --- safe/sample.py | 4 ++-- safe/viz.py | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/safe/sample.py b/safe/sample.py index b04796a..f3fb1a0 100644 --- a/safe/sample.py +++ b/safe/sample.py @@ -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, @@ -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, ): diff --git a/safe/viz.py b/safe/viz.py index b4669bc..369fb9f 100644 --- a/safe/viz.py +++ b/safe/viz.py @@ -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))]