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

Usage questions: Please ask here first [0] #589

Closed
hainm opened this issue Mar 9, 2017 · 246 comments
Closed

Usage questions: Please ask here first [0] #589

hainm opened this issue Mar 9, 2017 · 246 comments
Labels

Comments

@hainm
Copy link
Collaborator

hainm commented Mar 9, 2017

For any questions relating to how/why/ ... Or anything you don't know where to ask.

For bug, suggestion, ... please open seperate issue

@hainm hainm mentioned this issue Mar 9, 2017
@gph82
Copy link
Contributor

gph82 commented Mar 10, 2017

Hi, I notice a bunch of tempfiles in my /tmp directory after using nglviewer, containing essentially the molecular coordinates in pdb format. Do they stay there because of abrupt termination of nglivew or something?

@hainm
Copy link
Collaborator Author

hainm commented Mar 10, 2017

@gph82 I guess we did not do great job in cleaning those files. No, nglview do not need them to be there all the times.

updated: remove expired link.

@kain88-de
Copy link
Contributor

Hi is there a way to access and manipulate the rotation and zoom independently in the view object. NGL seems to support this. nglviewer/ngl#240 (comment)

I know about view.orientation but it handles zoom and rotation and at the same time and not separately.

@hainm
Copy link
Collaborator Author

hainm commented Mar 21, 2017

Hi, can you open a new issue so we can make it in our todo list. thx.

@lorenzoFabbri
Copy link

Hi all. I would like to do the following thing: each cell of my iPython notebook should contain only a "portion" of the entire protein. I explain: in each cell I would like to make visible only the portion of the protein that corresponds to a particular sequence. Is this possible? Is it possible to at least highlight in some way some portions of a protein using a sequence of amino acids as input? Thank you.

@hainm
Copy link
Collaborator Author

hainm commented Mar 25, 2017

@lorenzoFabbri

: in each cell I would like to make visible only the portion of the protein that corresponds to a particular sequence. Is this possible?

No it's not possible. You can can always create 3 views and display them.

views = [nglview.show_structure_file('my.pdb') for _ in range(3)]

# views[0]: do something
views[0]

# another cell
# views[1]: do something
views[1]
...

Is it possible to at least highlight in some way some portions of a protein using a sequence of amino acids as input? Thank you.

May be just adding representations for given residue selection if you know where they are?
http://arose.github.io/ngl/api/tutorial-selection-language.html

PR is welcome if you think those utils useful for you and others. Cheers.
Ping @arose here in case you have different answers.

@hainm hainm changed the title Usage questions Usage questions: Please ask here first Mar 25, 2017
@hainm hainm added the Q&A label Mar 25, 2017
@kain88-de
Copy link
Contributor

In a notebook I recently viewed two structures in different notebook cells. That worked fine.

@hainm
Copy link
Collaborator Author

hainm commented Mar 25, 2017

In a notebook I recently viewed two structures in different notebook cells. That worked fine.

Yes, you can create as many views as you want.

@kbsezginel
Copy link

Hi, is there a way to assign color to a given atom type in ball and stick model? It seems like other than common atoms in organic chemistry the rest of the atoms are represented with white color which makes it hard to distinguish with hydrogen atoms. Is there a way use something like CPK coloring? Thanks!

@kain88-de
Copy link
Contributor

Is there a way to install a development version as a isolated environment? I found using a different conda environment screws with the javascript in my root environment.

@hainm
Copy link
Collaborator Author

hainm commented Mar 30, 2017

@kbsezginel can you please provide screenshot?

Ping @arose

@arose
Copy link
Collaborator

arose commented Mar 30, 2017

is there a way to assign color to a given atom type in ball and stick model

There is CPK coloring based on the element. So if everything is white there is likely an error in determining the element. I would need an example file to look into that.

@kbsezginel
Copy link

When I create a list of different atoms such as this:
atom_names = ['C', 'H', 'O', 'N', 'F', 'Cl', 'Br', 'Li', 'Zn', 'Cu', 'Pd', 'Co']
separate them 4 angstroms apart and save to a pdb file, this is what I see with nglview:

nglview_atoms

When I load the same pdb file using a molecular graphics software this is what I get:
mercury-atoms

As you can see only a handful of atoms are colored and their radii are all the same as well.

I attached the jupyter notebook and pdb file below:
atom-color.zip

@arose
Copy link
Collaborator

arose commented Mar 30, 2017

The issue are non all-upper-case atom names. Fixed in the ngl development version. Will take some time to go into nglview. Workaround is providing all-upper-case atom names.

screenshot 42

@hainm
Copy link
Collaborator Author

hainm commented Mar 30, 2017

Will take some time to go into nglview

if you push to npm, will be available tonight :D

@arose
Copy link
Collaborator

arose commented Mar 30, 2017

if you push to npm, will be available tonight :D

there are some issues with the current version... ;)

@kbsezginel
Copy link

Thanks a lot! It seems like the radii are all the same though, is that also fixed in the ngl development version?

@arose
Copy link
Collaborator

arose commented Apr 1, 2017

It seems like the radii are all the same though

that is just due to the default parameters of the ball+stick representation. Have a look at the radiusType parameter (http://arose.github.io/ngldev/api/global.html#StructureRepresentationParameters)

@kbsezginel
Copy link

Hi again! I run into this problem that in ball and stick model the bonds are not displayed after a certain number of atoms. Is there a way to force calculation of the bonds or does it just skip that when there is too many atoms?

Here with approximately 300 atoms:

12-linkers

Here with approximately 500 atoms:

24-linkers

Thanks!

@arose
Copy link
Collaborator

arose commented Apr 13, 2017

@kbsezginel Can you please provide the file you are loading. Thanks!

@kbsezginel
Copy link

Here, I attached the pdb files. Thanks!

n_atoms.zip

@arose
Copy link
Collaborator

arose commented Apr 13, 2017

You assign the same group/residue number to all molecules. If you give every molecule its own number the bond calculation will work fine.

@kbsezginel
Copy link

Thanks, that seems to get the bond calculation working however now I am seeing incorrect assignments of the bonds for some molecules:
600_atoms_group

When I visualize the same file without groups I see no bonds as expected:
600_atoms_no_group

I also tried with a smaller number of molecules:
Group:
4_mol_group

No group:
4_mol_no_group

Any idea why that's the case?
Thanks!

Attached pdb files here:
mol_grouping.zip

@arose
Copy link
Collaborator

arose commented Apr 14, 2017

I haven't looked at it but my hunch is that it will work if you give each group its own distinct three letter name instead of calling them all MOL. For efficiency reasons, NGL tries to reuse calculated bonds for identical groups. However the identity calculation seem wrong here.

@kbsezginel
Copy link

Thanks, that worked perfectly!

30_linkers

@morpholin
Copy link

I wanted to ask, if it is possible to also display external densities, extracted e.g. from a Gaussian Cube file?

@hainm hainm changed the title Usage questions: Please ask here first Usage questions: Please ask here first [0] Apr 22, 2019
@hainm
Copy link
Collaborator Author

hainm commented Apr 22, 2019

This page is too long now. I close it and open another issue: #785

@sperezconesa
Copy link

Hello,

Is it possible to make selections based on bfactor or something similar like:

view.add_surface('protein and bfactor < 1.0')

Thank you very much and keep up the good work!
Best,
Sergio

@hainm
Copy link
Collaborator Author

hainm commented Sep 3, 2020

hi @sperezconesa: I don't think so. Please see the selection language here: http://nglviewer.org/ngl/api/manual/selection-language.html

@DustBytes
Copy link

Need few "How to" ideas. I don't have any jupyter for demo :(

  1. I have a table with two residues in each row. How to highlight/make bold etc these two residues in the nglviewport when hovering over the table rows. This working I saw in jsmol.
  2. Other similar idea, (any working will do), how to highlight two or more residues when hovering on certain residues in nglviewport?
  3. How to change the name of the residue/atom when we hover the cursor over the ngl viewport? Right now it looks like ATOM: [GLN]261:A.CA(1mnp.pdb) . How can we have cutom name?
  4. How to colour each chain with "chainid" but also put cutom colours on certain resiudes.
    Bug opened here : Help: Colouring ngl#822 and here: Help: Colouring #937

@hainm
Copy link
Collaborator Author

hainm commented Dec 22, 2020

hi @DustBytes: sorry to disappoint you again. Those type of questions should be addressed in NGL's repo: https://github.com/nglviewer/ngl/issues

@juliasubbotina
Copy link

python -c 'import nglview; print(nglview.__version__)'
3.0.3
python -c 'import ipywidgets; print(ipywidgets.__version__)'
7.6.5

Hello,--
I started to experience the issue with shape function. The PDB has only 1 atom and the radii_core > 10.0. With the code below it does not produce the view. It only does so if the radii of the sphere is less than 10.

view=nv.show_mdanalysis(system)
view.add_representation(repr_type='spacefill')
view.shape.add_sphere([ 0.0, 0.0, 0.0 ], color_core, radii_core*10, "AUM")

However, the same view.shape.add_sphere() works just fine for systems with large number of atoms. it doesn't break at radii > 10.

view=nv.show_mdanalysis(system)
view.add_representation(repr_type='spacefill', selection='PEG',  opacity=0.5, color=color_shell, radius=0.5*10*float(r_poly))
view.update_representation(component=view.n_components - 1, opacity=0.9) 
view.update_representation()
view.shape.add_sphere([ 0.0, 0.0, 0.0 ], color_core, radii_core*10, "AUM")

Any idea why this can happen?

Thanks.

@LijieZhong
Copy link

  • Version report
python -c 'import nglview; print(nglview.__version__)'
3.1.2
!python -c 'import ipywidgets; print(ipywidgets.__version__)'
8.1.2
from ase.io import read,write
import nglview as ngl
data = read("./)pro.gro")
vis = ngl.show_ase(data)
vis.use_style = 'ngl'
vis
![stru](https://github.com/nglviewer/nglview/assets/64005198/72b9546f-8d90-40e7-801d-4421b1ffd384)

Hello, I am trying to view a mixed solvent system using the above code, but the lithium ions in this system do not seem to display properly, how should I solve this problem
Thanks

@juliasubbotina
Copy link

Not sure if its relevant to the problem, but maybe the definition of "data" object is an issue (need to remove one bracket)?

data = read("./)pro.gro") == should be ==> data = read("./pro.gro")

@LijieZhong
Copy link

Oh,I made a simple mistake. I think the error occurred when I copy this code, but there's actually no brackets in the local version.

@LijieZhong
Copy link

I uploaded a structure file.
pro.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests