Re: [ccp4bb] Maps on mobile phones.

2022-03-27 Thread Phoebe A. Rice
Oo that looks handy!

And it reminds me to ask the community: if you wanted to do outreach to high 
schoolers and get them to, say, look at a DNA structure, is there a PyMol-like 
program that works on tablets?  I see PyMol for ipad has been discontinued.

  Thanks,
Phoebe


From: CCP4 bulletin board  on behalf of Paul Emsley 

Reply-To: Paul Emsley 
Date: Sunday, March 27, 2022 at 11:11 AM
To: "CCP4BB@JISCMAIL.AC.UK" 
Subject: Re: [ccp4bb] Maps on mobile phones.



On 27/03/2022 00:17, Jon Cooper wrote:
Hello, I have been trying to put together a thing for viewing small blocks of 
CCP4 electron density maps with a mobile web browser. If anyone is interested, 
the current state of it is here:

http://ic50.org/jbctest14.html



Have you seen/heard about uglymol? The name is an insult but the project is 
interesting.

https://github.com/uglymol/uglymol



Sorry, the link is not https yet, but nothing gets uploaded to the server! It 
seems to work OK on Android and iPhone and the maps (note: only maps; it 
doesn't do MTZ's, sorry) look similar when viewed in Coot (taken as the gold 
standard ;-),

For the record, I've never much liked the contouring of Coot - too many close 
lines and tiny triangles. I've wanted to change it for a long time, but it's 
never been the most important thing to fix.


but I have a few questions about the contouring algorithm that I have used. It 
is "surfacenets.js" from here:

https://github.com/mikolalysenko/isosurface

and a paper describing it is here:

https://www.merl.com/publications/docs/TR99-24.pdf

Unfortunately, my maths is not good enough to tell if it matters if you give it 
fractional coordinates, rather than orthogonal. I simply give it the electron 
density values on the CCP4 map grid coordinates, which will be on 
non-orthogonal axes for unit cells with non-90 degree angles. It seems to give 
qualitatively similar results to Coot in these cases, so I am cautiously 
optimistic, but not sure.


uglymol makes the transformation that you need - so does CootVR for that matter

https://github.com/hamishtodd1/hamishtodd1.github.io/tree/master/cvr

Here's Chris Hassall playing with it:

https://www.youtube.com/watch?v=-wfopgdN8o4

Just to be clear, this is running inside Firefox.

(It looks like he discovered a contouring bug when he zooms out)



Another thing is that the results of the contouring are sent out in groups of 3 
points which are the vertices of triangles forming the surface. Hence, I 
orthogonalize them and get three.js to draw them as just that - triangles. My 
worry is that, since the triangles all have edges in common, nearly all of the 
contour lines (except the ones at the edges of the map box) get drawn twice, or 
at least are sent to three.js twice for drawing, which doesn't seem terribly 
efficient?!

Coot used to remove double drawing. The large speed up in contouring in the 0.9 
series is a result of removing that test and just drawing the lines twice.


Is there a nicer way of doing this? I think it might be better to have 
FRODO-style contouring just on the 2D sections of the map, rather than having 
lots of diagonal lines?

I think so too, especially as a larger Shannon sampling factor is now not much 
of an issue.


Anyway, my 5 YO phone takes about 3 seconds to step from one  residue to the 
next, so it seems not too bad, although not ideal!



FWIW, Kevin Cowtan recently advertised a position to "develop next generation 
web based molecular graphics software" - sounds related.



Finally, its been asked before, but is there a nice way in CCP4i2 to output 
maps that cover the coordinates of the structure, rather than the asymmetric 
unit? Saving maps in Coot gives the asymmetric unit, too, although using Export 
Map Fragment seems the best option. I know about doing this in the old gui with 
mapmask, or using phenix, so just wondering if I've missed a way of doing this 
in i2, etc? I know that suitably extended CCP4 maps are available from the PDBe 
EBI.


I just use a script that runs mapmask - using a GUI seems like an overhead.



Paul.







To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=CCP4BB&A=1



To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=CCP4BB&A=1

This message was issued to members of www.jiscmail.ac.uk/CCP4BB, a mailing list 
hosted by www.jiscmail.ac.uk, terms & conditions are available at 
https://www.jiscmail.ac.uk/policyandsecurity/


Re: [ccp4bb] Maps on mobile phones.

2022-03-27 Thread Paul Emsley


On 27/03/2022 00:17, Jon Cooper wrote:
Hello, I have been trying to put together a thing for viewing small 
blocks of CCP4 electron density maps with a mobile web browser. If 
anyone is interested, the current state of it is here:


http://ic50.org/jbctest14.html



Have you seen/heard about uglymol? The name is an insult but the project 
is interesting.


https://github.com/uglymol/uglymol




Sorry, the link is not https yet, but nothing gets uploaded to the 
server! It seems to work OK on Android and iPhone and the maps (note: 
only maps; it doesn't do MTZ's, sorry) look similar when viewed in 
Coot (taken as the gold standard ;-),


For the record, I've never much liked the contouring of Coot - too many 
close lines and tiny triangles. I've wanted to change it for a long 
time, but it's never been the most important thing to fix.



but I have a few questions about the contouring algorithm that I have 
used. It is "surfacenets.js" from here:


https://github.com/mikolalysenko/isosurface

and a paper describing it is here:

https://www.merl.com/publications/docs/TR99-24.pdf

Unfortunately, my maths is not good enough to tell if it matters if 
you give it fractional coordinates, rather than orthogonal. I simply 
give it the electron density values on the CCP4 map grid coordinates, 
which will be on non-orthogonal axes for unit cells with non-90 degree 
angles. It seems to give qualitatively similar results to Coot in 
these cases, so I am cautiously optimistic, but not sure.


uglymol makes the transformation that you need - so does CootVR for that 
matter


https://github.com/hamishtodd1/hamishtodd1.github.io/tree/master/cvr

Here's Chris Hassall playing with it:

https://www.youtube.com/watch?v=-wfopgdN8o4

Just to be clear, this is running inside Firefox.

(It looks like he discovered a contouring bug when he zooms out)




Another thing is that the results of the contouring are sent out in 
groups of 3 points which are the vertices of triangles forming the 
surface. Hence, I orthogonalize them and get three.js to draw them as 
just that - triangles. My worry is that, since the triangles all have 
edges in common, nearly all of the contour lines (except the ones at 
the edges of the map box) get drawn twice, or at least are sent to 
three.js twicefor drawing, which doesn't seem terribly efficient?!


Coot used to remove double drawing. The large speed up in contouring in 
the 0.9 series is a result of removing that test and just drawing the 
lines twice.



Is there a nicer way of doing this? I think it might be better to have 
FRODO-style contouring just on the 2D sections of the map, rather than 
having lots of diagonal lines?


I think so too, especially as a larger Shannon sampling factor is now 
not much of an issue.



Anyway, my 5 YO phone takes about 3 seconds to step from one  residue 
to the next, so it seems not too bad, although not ideal!



FWIW, Kevin Cowtan recently advertised a position to "develop next 
generation web based molecular graphics software" - sounds related.





Finally, its been asked before, but is there a nice way in CCP4i2 to 
output maps that cover the coordinates of the structure, rather than 
the asymmetric unit? Saving maps in Coot gives the asymmetric unit, 
too, although using Export Map Fragment seems the best option. I know 
about doing this in the old gui with mapmask, or using phenix, so just 
wondering if I've missed a way of doing this in i2, etc? I know that 
suitably extended CCP4 maps are available from the PDBe EBI.



I just use a script that runs mapmask - using a GUI seems like an overhead.


Paul.





To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=CCP4BB&A=1

This message was issued to members of www.jiscmail.ac.uk/CCP4BB, a mailing list 
hosted by www.jiscmail.ac.uk, terms & conditions are available at 
https://www.jiscmail.ac.uk/policyandsecurity/


Re: [ccp4bb] Maps on mobile phones.

2022-03-27 Thread Marcin Wojdyr
Hi Jon,

> Another thing is that the results of the contouring are sent out in groups of 
> 3 points which are the vertices of triangles forming the surface. Hence, I 
> orthogonalize them and get three.js to draw them as just that - triangles. My 
> worry is that, since the triangles all have edges in common, nearly all of 
> the contour lines (except the ones at the edges of the map box) get drawn 
> twice, or at least are sent to three.js twice for drawing, which doesn't seem 
> terribly efficient?! Is there a nicer way of doing this?

I was also concerned about it when writing UglyMol. It was ~6 years
ago. Drawing maps as lines was definitely affecting speed, because fps
was lower when the number of lines was huge. So to reduce duplicated
lines I calculated new tables for the marching cubes algorithms - with
lines instead of triangles in the tables. This allowed me to reduce
some (most of?) duplicates. I don't remember the details, but the
script that I used for calculating tables is here:
https://github.com/uglymol/uglymol/blob/master/tools/isolut.py

Then I was disappointed, because it didn't change the fps. I don't
know why. And I don't know how to check where the bottleneck in the
graphics pipeline is (vertex shader, fragment shader or something
else?). I guess optimizing map rendering would require someone with
expertise in 3D graphics rendering.

> Finally, its been asked before, but is there a nice way in CCP4i2 to output 
> maps that cover the coordinates of the structure, rather than the asymmetric 
> unit?

The maps that cover asu are, on average, smaller. They contain the
list of symmetry operators that expand the map to the whole unit cell.
So such maps may actually be better. Or, even better, use MTZ files. I
think UglyMol is still the only web viewer that can show maps from
MTZ, but it works on mobile web browsers (it's not designed for
mobile, but rendering works) and you can re-use parts of it.
https://uglymol.github.io/view/

Best wishes,
Marcin



To unsubscribe from the CCP4BB list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/WA-JISC.exe?SUBED1=CCP4BB&A=1

This message was issued to members of www.jiscmail.ac.uk/CCP4BB, a mailing list 
hosted by www.jiscmail.ac.uk, terms & conditions are available at 
https://www.jiscmail.ac.uk/policyandsecurity/