datamol-io / datamol

Molecular Processing Made Easy.
https://docs.datamol.io
Apache License 2.0
462 stars 48 forks source link

Allow additional args for colors in lasso #223

Closed maclandrol closed 9 months ago

maclandrol commented 9 months ago

Changelogs


Checklist:


This PR allows us to now do something like this:

  smi = "CO[C@@H](O)C1=C(O[C@H](F)Cl)C(C#N)=C1ONNC[NH3+]"
  mol = dm.to_mol(smi)
  smarts_list = "CONN"
  highlight_atoms = [4, 5, 6]
  highlight_bonds = [1, 2, 3, 4]
  highlight_atom_colors = {4:(186,85,211), 5:(186,85,211), 6:(186,85,211)}
  highlight_bond_colors = {1:(186,85,211), 2:(186,85,211), 3:(186,85,211), 4:(186,85,211)}
  dm.lasso_highlight_image(mol, smarts_list, highlight_atoms=highlight_atoms, highlight_bonds=highlight_bonds, highlight_atom_colors=highlight_atom_colors, highlight_bond_colors=highlight_bond_colors, continuousHighlight=False, circleAtoms=False)

See the purple part of the molecule here.

image
codecov[bot] commented 9 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (5d1cde1) 91.95% compared to head (e56d083) 91.99%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #223 +/- ## ========================================== + Coverage 91.95% 91.99% +0.03% ========================================== Files 46 46 Lines 3843 3873 +30 ========================================== + Hits 3534 3563 +29 - Misses 309 310 +1 ``` | [Flag](https://app.codecov.io/gh/datamol-io/datamol/pull/223/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datamol-io) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/datamol-io/datamol/pull/223/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datamol-io) | `91.99% <100.00%> (+0.03%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=datamol-io#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.