Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow additional args for colors in lasso #223

Merged
merged 6 commits into from
Jan 19, 2024
Merged

Conversation

maclandrol
Copy link
Member

Changelogs

  • Add support for some drawer options and fix edge cases where user-provided options are not properly handled. This concerns mostly the atom and bonds highlighting and color system

Checklist:

  • Was this PR discussed in an issue? It is recommended to first discuss a new feature into a GitHub issue before opening a PR.
  • Add tests to cover the fixed bug(s) or the new introduced feature(s) (if appropriate).
  • Update the API documentation is a new function is added, or an existing one is deleted.
  • Write concise and explanatory changelogs below.
  • If possible, assign one of the following labels to the PR: feature, fix or test (or ask a maintainer to do it for you).

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

@maclandrol maclandrol requested a review from hadim as a code owner January 17, 2024 18:12
@maclandrol maclandrol requested a review from zhu0619 January 17, 2024 18:12
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

Additional details and impacted files
@@            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 Coverage Δ
unittests 91.99% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@zhu0619 zhu0619 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Manu.
Overall, it looks good to me.
I just have one question below.

datamol/viz/_lasso_highlight.py Outdated Show resolved Hide resolved
@zhu0619 zhu0619 self-requested a review January 19, 2024 14:50
@maclandrol maclandrol merged commit 4fbb047 into main Jan 19, 2024
15 checks passed
@maclandrol maclandrol deleted the fix/parse-args-in-lasso branch January 19, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants