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

T017 - Advanced NGLview usage #92

Merged
merged 12 commits into from
Apr 26, 2021
Merged

T017 - Advanced NGLview usage #92

merged 12 commits into from
Apr 26, 2021

Conversation

jaimergp
Copy link
Contributor

@jaimergp jaimergp commented Jan 28, 2021

Details

  • Talktorial ID: 017
  • Title: Advanced NGLview usage
  • Original authors: Jaime Rodríguez-Guerra
  • Reviewer(s): Dominique Sydow
  • Date of review:

Content review

  • Potential labels or categories (e.g. machine learning, small molecules, online APIs): XXXXXXXX
  • One line summary: XXXXXXXXXX
  • The table of contents reflects the talktorial story-line; order of #, ##, ### headers is correct
  • URLs are linked with meaningful words, instead of pasting the URL directly or linking words like here.
  • I have spell-checked the notebook
  • Images have enough resolution to be rendered with quality, without being too heavy.
  • All figures have a description
  • Markdown cell content is still in-line with code cell output (whenever results are discussed)
  • I have checked that cell outputs are not incredibly long (this applies also to DataFrames)
  • Formatting looks correctly on the Sphinx render (bold, italics, figure placing)

Code review

  • Time it took to execute (approx.):
  • Variable and function names follow snake case rules (e.g. a_variable_name vs aVariableName)
  • Spacing follows PEP8 (run Black on the code cells if needed)
  • Code line are under 99 characters each (run black -l 99)
  • Comments are useful and well placed
  • There are no unpythonic idioms like for i in range(len(list)) (see slides)
  • All 3rd party dependencies are listed at the top of the notebook
  • I have marked all code cell with output referenced in markdown cells with the label # TODO: CI
  • I have identified potential candidates for a code refactor / useful functions
  • All import ... lines are at the top (practice part) cell, ordered by standard library / 3rd party packages / our own (teachopencadd.*)
  • I have update the relative paths to absolute paths.
  • List here unfamiliar libraries you find in the imports and their intended use:

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@jaimergp jaimergp mentioned this pull request Feb 2, 2021
27 tasks
@dominiquesydow
Copy link
Collaborator

dominiquesydow commented Feb 2, 2021

Hi @jaimergp,

I had a quick look at the table of contents as requested - very well done!

First things first:

  • Love the video (of course) - and the slow intro on interactive controls
  • Excellent idea to have "troubleshooting tips"!!!

Things that come to mind for 1.3.2:

  • [As part of 1.3.2.3?] Selection algebra (with link to their documentation)
  • [As part of 1.3.2.3?] Show how to use custom color schemes (coloring residues by some user values): Some like this in a minimal example (cell 31)
  • GUI usage with viewer.display(gui=True) - it is super convenient for many quick tasks and people should know that it exists (even when you might not comment much on it)
  • Simple example on how you can add e.g. spheres (e.g. show protein center)
  • Mention that there is a plethora of nglview.show_... options (e.g. how to load trajectories, cross-referencing our MD talktorials)

W.r.t. 1.3.3 I do not know really what will live behind the titles, so here is what I would like to learn maybe?

  • How can I layout an nglview window with a second window where I can choose between (toogle on/off)
    • different structures to be shown
    • different coloring schemes which represent different features (as in highlight all HBDs or HBAs or ...)
  • How can I manipulate the label for residues (the labels that appear when I hover over a residue)?

Looking forward to this notebook - it will be helpful for everyone who starts out using nglview :)

@jaimergp
Copy link
Contributor Author

Only theory missing! 🥳

@jaimergp
Copy link
Contributor Author

Theory done. I need to update the table of contents and polish for typos and so on, but this will be ready for review later today!

@jaimergp
Copy link
Contributor Author

@dominiquesydow, this is ready for review!

@dominiquesydow
Copy link
Collaborator

Excellent! On my agenda for tomorrow :)

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:47Z
----------------------------------------------------------------

If we wanted to be in-line with the other notebooks, this would be

- Jaime Rodríguez-Guerra, 2021, [Volkamer lab, Charité](https://volkamerlab.org/)


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:48Z
----------------------------------------------------------------

Style for references in T001-T010 notebooks - example:

[Davies *et al.*, <i>Nucleic Acids Res.</i> (2015), <b>43</b>, 612-620](https://academic.oup.com/nar/article/43/W1/W612/2467881)


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:49Z
----------------------------------------------------------------

This is great! Thanks for this clear explanation!

Some typos:

insallation > installation

offers provides > provides

Some of the most advanced features > Some of the more (?) advanced features


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:49Z
----------------------------------------------------------------

Ah! Did not know that distances are representations, too! The representations-coordinates link to remember this is brilliant!

A component can be a molecular structure or a geometric shape. Components can be rendered with one or more representations.

Maybe put this first representations mention in italic (instead of later).

Put first mention of shape in italic, too?

To make sure you got the gist, you can also check the examples in the demo application and get more familiar with the NGL terminology.

Where would I find more details on components/representations/shapes following this link? Or were you thinking people can simply start using the viewer and play around (asking because I was expecting to see something like a schema).


jaimergp commented on 2021-04-13T13:45:24Z
----------------------------------------------------------------

Added one more sentence to clarify:

To make sure you got the gist, you can also check the examples in the demo application (dropdown in the top menu) and get more familiar with the NGL terminology. Each example will load a state on the 3D canvas, with components being on the top level of the hierarchy, and their representations under each one.

dominiquesydow commented on 2021-04-13T15:35:56Z
----------------------------------------------------------------

Perfect!

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:50Z
----------------------------------------------------------------

Simply beautiful :)


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:51Z
----------------------------------------------------------------

Cool to know how this can be done with print statements!


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:51Z
----------------------------------------------------------------

Thanks for that explanation!


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:52Z
----------------------------------------------------------------

Do you know why it is not possible to export the canvas from the JavaScript layer to the cell output directly?

Minor: Add dot after 2nd and 3rd bullet points.


jaimergp commented on 2021-04-26T12:28:17Z
----------------------------------------------------------------

No clue why. It might be a JS/Python IO buffer thing. Not sure why but if at this point it hasn't been "fixed", it might be unfixable with the current design.

Thanks for the dots!

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:53Z
----------------------------------------------------------------

If you combine all those add_* function

implies to me that we have talked about add_* functions before but we have not, right? Is this an artifact from moving things around or am I overseeing something?


jaimergp commented on 2021-04-13T13:47:51Z
----------------------------------------------------------------

Good catch!

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:54Z
----------------------------------------------------------------

That doesn't mean the structures were not loaded

Would it be correct to say

That doesn't mean the structures were not loaded (the components are loaded but no representation is set, yet).

If so, this could be a nice circle back to your introduction.


jaimergp commented on 2021-04-13T13:49:37Z
----------------------------------------------------------------

Excellent!

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:54Z
----------------------------------------------------------------

I know it is a bit annoying, but in this first case where you show this, I would split this cell (only this once) into

cell 1

# add ribbon to protein only

view.add_cartoon("protein")

view

cell 2

view.render_image(trim=True, factor=2);

Would be nice for the Jupyter Lab usage of this notebook.

... or you comment here that the view will be updated above (you do this later in this notebook).


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:55Z
----------------------------------------------------------------

Interesting. So I am seeing these stars when I am drawing "lines" using only one atom?


jaimergp commented on 2021-04-13T13:53:28Z
----------------------------------------------------------------

Apparently that's how the shader works 🤷

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:38:55Z
----------------------------------------------------------------

with a larger radius

larger than what?

Would it be correct to say sphere (or does it look like sphere but technically is not a sphere)?

as a sphere

also

the Iridium ion

sounds like we have talked about the structure before looking at it. So maybe add a short description about the type of protein we look at before you start displaying it?

Thinking about this - why did you choose that structure? (Unhappy about kinases? :) They would have protein+ligand+Mg as well)


jaimergp commented on 2021-04-13T14:07:03Z
----------------------------------------------------------------

It's a PDB with sentimental value in my PhD :D I know how it should look like and how it to get a good representation of its features. I don't think we need to go into many details about it, but I added a small sentence at the beginnign of the section.

dominiquesydow commented on 2021-04-13T15:50:40Z
----------------------------------------------------------------

Happy with the changes!

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:39:07Z
----------------------------------------------------------------

  • This is possible via the addShape widget method- Some considerations: > This is possible via the addShape widget method - some considerations:
  • args > arguments

@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:39:08Z
----------------------------------------------------------------

a f-string > an f-string


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:39:09Z
----------------------------------------------------------------

Ah! Can you explicitly add that this code (document.nglview) should go in the Dev Console?

you can inspect the document.nglview object:

to something like this

you can type there document.nglview and inspect the object:

Thanks for all the tips and pitfalls!


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:39:09Z
----------------------------------------------------------------

This is a nice and clean overview, thanks!


@review-notebook-app
Copy link

review-notebook-app bot commented Feb 17, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-02-17T15:39:10Z
----------------------------------------------------------------

sidechains > side chains

People will need to know how to access KLIFS programmatically for this, right? If so, could you link to the KLIFS talktorial T013?


@dominiquesydow
Copy link
Collaborator

@jaimergp, this notebook is amazing on so many levels! My brain is fried from all the new things I learnt. Great job! And thank you ❤️

Copy link
Contributor Author

Added one more sentence to clarify:

To make sure you got the gist, you can also check the examples in the demo application (dropdown in the top menu) and get more familiar with the NGL terminology. Each example will load a state on the 3D canvas, with components being on the top level of the hierarchy, and their representations under each one.

View entire conversation on ReviewNB

Copy link
Contributor Author

Good catch!


View entire conversation on ReviewNB

Copy link
Contributor Author

Excellent!


View entire conversation on ReviewNB

Copy link
Contributor Author

Apparently that's how the shader works 🤷


View entire conversation on ReviewNB

Copy link
Contributor Author

It's a PDB with sentimental value in my PhD :D I know how it should look like and how it to get a good representation of its features. I don't think we need to go into many details about it, but I added a small sentence at the beginnign of the section.


View entire conversation on ReviewNB

Copy link
Contributor Author

Hm, apparently not all classes are fully documented... I clarified that and your other comments!


View entire conversation on ReviewNB

Copy link
Contributor Author

I added a sentence clarifying the intent, but we can change to other enzyme if you have a clearer example at hand!


View entire conversation on ReviewNB

Copy link
Contributor Author

No clue... Let me know if you get it work and we can add a sentence!


View entire conversation on ReviewNB

Copy link
Contributor Author

Without fixed, interact will consider every option a thing that needs to be modified by widgets.


View entire conversation on ReviewNB

Co-authored-by: dominiquesydow <dominiquesydow@users.noreply.github.com>
@jaimergp
Copy link
Contributor Author

@dominiquesydow, thanks for the thorough review!!

Took me ages but I have started reviewing your comments :) I have resolved most of the feedback, but there are some outstanding issues I need some help and/or clarification! Thanks again!

Copy link
Collaborator

Perfect!


View entire conversation on ReviewNB

Copy link
Collaborator

Great, motivation is clear and unused PDB is gone - no need to change enzymes here.


View entire conversation on ReviewNB

Copy link
Collaborator

Ok, question was pure curiosity. If I find that out, I'll let you know :)


View entire conversation on ReviewNB

Copy link
Collaborator

Ok, I admit the word "non-dynamic" says it all. Was lacking mental flexibility here, thanks for clarifying!


View entire conversation on ReviewNB

@review-notebook-app
Copy link

review-notebook-app bot commented Apr 13, 2021

View / edit / reply to this conversation on ReviewNB

dominiquesydow commented on 2021-04-13T15:45:07Z
----------------------------------------------------------------

Iridiu > Iridium


@dominiquesydow
Copy link
Collaborator

Excellent!

Unsure what the open issues are - I did comment on hopefully everything you wrote. Basically everything a ready-to-go :)

This talktorial helped me tremendously in another project with NGLview and a lot of ipywidget-enabled plots, so thank you.

Copy link
Collaborator

Happy with the changes!


View entire conversation on ReviewNB

Copy link
Contributor Author

No clue why. It might be a JS/Python IO buffer thing. Not sure why but if at this point it hasn't been "fixed", it might be unfixable with the current design.

Thanks for the dots!


View entire conversation on ReviewNB

Copy link
Contributor Author

You can use hex colors like #FF00AA or int colors like 0xFF00AA . Added a note about this :)


View entire conversation on ReviewNB

Co-authored-by: Dominique Sydow <dominiquesydow@users.noreply.github.com>
@jaimergp
Copy link
Contributor Author

jaimergp commented Apr 26, 2021

Ok, we are done! Thank you so much for the review @dominiquesydow!

@jaimergp jaimergp merged commit 0eae059 into t011-base Apr 26, 2021
@jaimergp jaimergp deleted the jrg-017-nglview branch April 26, 2021 12:43
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