Visualizing orientation distribution other than heatmap?

Is there a way to visualize the orientation distribution of particles contributing to a map other than the Elevation/Azimuth heatmap? Can I export the cryosparc metadata file to another program for visualization of this distribution?

In particular, I’d like to view as cylinders with height proportional to the number of particles in the orientation indicated (similar to Relion).

Thanks!

1 Like

Hi Aaron,

You could export to relion and run a “fake” 3D auto refine run - setting searches to 0.1 degree, lowpass to the global res from cryosparc, and offsets to 0 & 0 - that should more or less accomplish this I think.

Cheers
Oli

If you convert to a star file, you can use the star2bild.py program in pyem to produce a XMIPP/Chimera style orientation plot like the ones made by Relion. This program works with any particle star file. I set the colors and cylinder sizes to mimic the ones made by Relion, and it uses the same HealPix angle bins as Relion.

4 Likes

Thanks so much for your response, Oli! I’ll try to get this going and report back on the final result in case anyone else is interested.
-Aaron

Thank you, Daniel! I will definitely be trying this out.
-Aaron

Hi Daniel,

I have had some trouble updating pyem on linux. I was previously on the version that could not handle cryosparc2 files. Perhaps you may have some insight to my problems. I tried just installing fresh after removing the old version and got this error. Then I tried to git pull in the old folder (after putting it back in its original location) and still had this error. After completing the " pip install -e ." command, it says installation was successful.

Sorry, this is my first time trying to update any program from github.

Thanks for any help,
Aaron

Traceback (most recent call last):
File “/home/user/pyem/csparc2star.py”, line 28, in
from pyem import metadata
File “/home/user/pyem/pyem/ init .py”, line 3, in
from . import metadata
File “/home/user/pyem/pyem/metadata.py”, line 25, in
from . import star
File “/home/user/pyem/pyem/star.py”, line 31, in
from pyem.util import rot2euler
File “/home/user/pyem/pyem/util/ init .py”, line 3, in
from .util import *
File “/home/user/pyem/pyem/util/util.py”, line 25, in
from … import geom
File “/home/user/pyem/pyem/geom/ init .py”, line 4, in
from .geom import *
File “/home/user/pyem/pyem/geom/geom.py”, line 22, in
from .quat_numba import qslerp
File “/home/user/pyem/pyem/geom/quat_numba.py”, line 153, in
“(m)->(m), (m), (m), (m)”, nopython=True, cache=False)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/decorators.py”, line 179, in wrap
guvec.add(fty)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.py”, line 198, in add
self.nb_func, targetoptions, sig)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.py”, line 129, in _compile_element_wise_function
cres = nb_func.compile(sig, **targetoptions)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.py”, line 78, in compile
return self._compile_core(sig, flags, locals)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/npyufunc/ufuncbuilder.py”, line 113, in _compile_core
flags=flags, locals=locals)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/compiler.py”, line 871, in compile_extra
return pipeline.compile_extra(func)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/compiler.py”, line 365, in compile_extra
return self._compile_bytecode()
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/compiler.py”, line 802, in _compile_bytecode
return self._compile_core()
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/compiler.py”, line 789, in _compile_core
res = pm.run(self.status)
File “/home/user/miniconda2/lib/python2.7/site-packages/numba/compiler.py”, line 251, in run
raise patched_exception
TypeError: Failed at nopython (analyzing bytecode)
Signature mismatch: 2 argument types given, but function takes 1 arguments

Thanks for trying out my stuff. I have been making some breaking changes in the master branch lately, which is why you’ve seen this error.

Try git checkout tags/v0.4 to switch to the latest release version. Since you installed with pip install -e it should be updated immediately and no new pip command should be required.

Really fantastic! Thank you so much, Daniel! This worked after performing git pull, followed by your command and installing healpy. The bild file looks nice.
Now, is there a way to customize the visualization of this file? For example, I have seen figures showing just half of this bild sphere.
-Aaron

you can just do that in Chimera, Aaron - e.g. use per model clipping

Thanks for pointing out the missing healpy requirement, I added it to the requirements.txt for future users.

Right now star2bild.py just uses the angles in the star file, so if Relion isn’t accounting for projection ambiguity (and it indeed does not) then you get the whole sphere covered.

It would be easy to force half the sphere, or a certain symmetry group, using my implementation (I take advantage of the order-preserving surjection between great circle arc length and secant distance, and use a kD-tree to rapidly histogram the Euler angles). If there’s interest, and in particular if there are good suggestions, I could revisit it.

Thanks for the info and all the help, Daniel. It’s working great for my needs at the moment. I know clipping is not perfect, but to achieve the 1/4 sphere, I use the per model clipping as suggested by Oli, with global clipping in the second plane.
Thanks to you both for the advice!
Aaron

@user123 @olibclarke I implemented a --sym argument for star2bild.py which will apply the symmetry to the angles from cryoSPARC. It was trickier than I thought!

Great, I look forward to giving it a spin!

Hi Daniel, revisiting this topic and have reinstalled my pyem package just yesterday.
Hope this is the right place to ask my qn and seek your advice.
I cannot seem to convert the particles.star to .bild file. error message below:

/home/dlsw1/pyem/pyem/star.py:539: FutureWarning: Columnar iteration over characters will be deprecated in future releases.
df[UCSF.IMAGE_INDEX], df[UCSF.IMAGE_PATH] =
/home/dlsw1/pyem/pyem/star.py:547: FutureWarning: Columnar iteration over characters will be deprecated in future releases.
df[UCSF.IMAGE_ORIGINAL_INDEX], df[UCSF.IMAGE_ORIGINAL_PATH] =
Traceback (most recent call last):
File “/usr/bin/star2bild.py”, line 122, in
sys.exit(main(parser.parse_args()))
File “/usr/bin/star2bild.py”, line 71, in main
log.info("%.0f (%.2f%) +/- %.1f (%.2f%) particles per bin" %
ValueError: unsupported format character ‘)’ (0x29) at index 11

1 Like

Got the same error today!

This was my bad, I fixed it about 2 weeks ago.

1 Like

Got a question!

In a refinement with symmetry, rot, tilt, and psi are not restricted to the “symmetry unit” in the star file.

Is this because CS does not do that in the .cs (although I guess it is used for calculations) or is it more a pyem “feature” :wink:

that is a cryosparc thing: How does cryosparc treat symmetry? - #2 by apunjani

1 Like

star2bild.py just shows you what’s in the .star file, but there is a --sym argument that will average all the symmetry equivalent angles so you get something more easily compared to Relion’s distributions.

to the point! Thanks!