-
Notifications
You must be signed in to change notification settings - Fork 46
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
Integrate lasso highlight viz functions #177
Conversation
…this to make sure I'm on the right track
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
Codecov Report
@@ Coverage Diff @@
## main #177 +/- ##
==========================================
- Coverage 91.08% 91.01% -0.07%
==========================================
Files 47 48 +1
Lines 3509 3785 +276
==========================================
+ Hits 3196 3445 +249
- Misses 313 340 +27
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 2 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@dessygil thanks for this contribution, really enjoyed your notebook, small question after going quickly through the code: does this support SVG depictions, and if not, how complex would it be to support it? |
Hi @MichelML ! It does not right now, I have it working in a Jupyter Notebook so far but I'm guessing it would be similar to this piece of code below from to_image in datamol/viz/_viz.py?
|
@MichelML I was wrong in assuming it would be easy, but I have an idea. The final function I utilize to return an image is
The RDKit docs state that the PNG data is returned as a string and using io.BytesIO returns the PNG binary. I could use a library called Wand (or Potrace and PyCairo). The way I would use wand is shown below.
Whether I save it to a file or return it this could be a possible way of dealing with providing an SVG depiction. Please let me know if I can download another dependency or if there is a better way to approach this? |
Hi @dessygil, Thank you for your contributions so far! Just commenting on the how we could support SVG. I think this is doable by (conditionally, e.g. based on a |
@dessygil : there are some changes to be made, but it's going in the right direction. Please let us know if you have any questions. |
…endency and doing so without
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for the work and your patience here @dessygil!
I believe this will be quite a useful feature for our datamol users!
The reason I am being picky on the typing is because 1) it makes code maintenance much easier and 2) also facilitates consuming the datamol API for our downstream users.
(I also took the freedom to push a few commits that are not really related to that PR xD)
I will merge here once green. Thanks again!
Of course, I appreciate it. It helps me see what I need to do a bit better! Thanks to you and the team for jumping in whenever I needed help. I look forward to giving the next issue a go :) |
I am still working on this. I want to add test cases and improve the code. I have the Lasso highlight function working only for the ideal scenarios, but I wanted to ensure I was on the right track regarding what's expected. I've extended this tool to abstract the work required from the original program; now, it can be called by a single function. The tests that I thought would be worthwhile that sit outside testing the actual image can be found in Visualization.ipynb. I'm curious which tests would actually be worth adding (still a little new to open source and testing). After this, I plan to get items 2-4 done on the checklist.
Checklist:
news
entry.news/TEMPLATE.rst
tonews/my-feature-or-branch.rst
) and edit it.