3D representation of angular distribution from cryosparc output

Hi @DanielAsarnow, I was able to plot results, but when I am including --loglevel info flag, it did not have any output lines or should I expect any text output in the command line? … I cloned the latest github code.

Super thanks!
Hong

There are indeed some INFO level logging statements, but there was also a bug that prevented the program from working at all. If you try it again (after updating the git repo) it should work. The output should tell you the average number of particles per bin, and the min and max number of particles with the corresponding colors. You can use these to create a color bar for your figures.

1 Like

Hi @user123 and @DanielAsarnow,

I haven’t run pyem in a while. Just reinstalled it and tried running csparc2star.py to eventually make the bild file, but ran into this error:

Traceback (most recent call last):
File “/usr/bin/csparc2star.py”, line 29, in
from pyem import metadata
File “/data/CRYOSPARC/pyem/pyem/init.py”, line 3, in
from . import metadata
File “/data/CRYOSPARC/pyem/pyem/metadata/init.py”, line 2, in
from .cistem import *
File “/data/CRYOSPARC/pyem/pyem/metadata/cistem.py”, line 20, in
from pyem import star
File “/data/CRYOSPARC/pyem/pyem/star.py”, line 89
SyntaxError: Non-ASCII character ‘\xc3’ in file /data/CRYOSPARC/pyem/pyem/star.py on line 89, but no encoding declared; see PEP 263 – Defining Python Source Code Encodings | peps.python.org for details

Any ideas?

nvm wrong python version. If anyone encounters this make sure to use Miniconda — conda documentation and a file with python 3.7

1 Like

Hi @DanielAsarnow,

First of all thank you for all the tools you are providing, I use them a lot !

Lately, I am facing a strange issue using star2bild.py to generate the angular distribution of my particles on the final 3D volume.
Too make is short, the particles angular distribution is upside down in comparison with the 2D classes.
The complex is composed of a head very well resolved (<4Å) and the lower with poor resolution ± 10Å. Almost no cylinder are on the head but all on the lower part… One important info is the need to z-flip the 3D structure to be the right handed.

Do you have any idea how I can change it? I had a look into the files but it does not seems as simple as inverting values.
Thanks in advance!
Best,
E>

Glad to hear it, thanks for using my software!

I think the issue is the z-flip, since the angles for a flipped structure are different (in a systematic way). If you use star.py --invert-hand on the star file before using star2bild.py does that work?

1 Like

Hi,
You are right!
I did not think about the option in the star.py command… It works perfectly now.
Thank you very much for the quick answer.
Best,
E>

1 Like

Glad to hear it & thanks for testing!

1 Like

Hi@user123,
I went to the third step and input this “star2bild.py particles.star particles.bild --boxsize 288”,
then got this error:
/opt/pyem/pyem/mrc.py:57: SyntaxWarning: “is” with a literal. Did you mean “==”?
elif origin is “center”:
Traceback (most recent call last):
File “/opt/pyem/star2bild.py”, line 114, in
sys.exit(main(parser.parse_args()))
File “/opt/pyem/star2bild.py”, line 37, in main
df = star.parse_star(args.input, keep_index=False)
File “/opt/pyem/pyem/star.py”, line 419, in parse_star
augment_star_ucsf(df, inplace=True)
File “/opt/pyem/pyem/star.py”, line 536, in augment_star_ucsf
df[UCSF.IMAGE_INDEX], df[UCSF.IMAGE_PATH] =
ValueError: too many values to unpack (expected 2).
what can do, thanks

Please post the first ~50 lines of your star file. Thanks.

"data_optics

loop_
_rlnVoltage #1
_rlnSphericalAberration #2
_rlnAmplitudeContrast #3
_rlnOpticsGroup #4
_rlnImageSize #5
_rlnImagePixelSize #6
_rlnImageDimensionality #7
300.000000 2.700000 0.070000 0 256 1.060000 2
300.000000 2.700000 0.070000 1 256 1.060000 2
300.000000 2.700000 0.070000 2 256 1.060000 2

data_particles

loop_
_rlnImageName #1
_rlnAngleRot #2
_rlnAngleTilt #3
_rlnAnglePsi #4
_rlnOriginXAngst #5
_rlnOriginYAngst #6
_rlnDefocusU #7
_rlnDefocusV #8
_rlnDefocusAngle #9
_rlnPhaseShift #10
_rlnCtfBfactor #11
_rlnOpticsGroup #12
_rlnRandomSubset #13
_rlnClassNumber #14
"
Thanks

I need some data lines to see if there’s anything wrong. (E.g. the next 19 lines up until 50).

Sorry, here is more information:
"data_optics

loop_
_rlnVoltage #1
_rlnSphericalAberration #2
_rlnAmplitudeContrast #3
_rlnOpticsGroup #4
_rlnImageSize #5
_rlnImagePixelSize #6
_rlnImageDimensionality #7
300.000000 2.700000 0.100000 2 288 0.832000 2

data_particles

loop_
_rlnImageName #1
_rlnAngleRot #2
_rlnAngleTilt #3
_rlnAnglePsi #4
_rlnOriginXAngst #5
_rlnOriginYAngst #6
_rlnDefocusU #7
_rlnDefocusV #8
_rlnDefocusAngle #9
_rlnPhaseShift #10
_rlnCtfBfactor #11
_rlnOpticsGroup #12
_rlnRandomSubset #13
_rlnClassNumber #14
000001@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 118.587212 78.062759 11.088031 1.157558 -0.092122 9263.204102 8672.324219 29.346466 0.000000 0.000000 2 1 1
000002@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 131.833267 93.201424 -15.022625 0.276936 -0.719417 9125.863281 8534.983398 29.346466 0.000000 0.000000 2 2 1
000004@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -157.526505 39.442150 -108.609131 0.847701 0.448150 9150.856445 8559.976562 29.346466 0.000000 0.000000 2 1 1
000005@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 94.781013 94.493568 -89.652985 -0.044887 0.160124 9314.765625 8723.885742 29.346466 0.000000 0.000000 2 2 1
000006@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -145.048676 81.101799 78.770416 0.933886 -1.449788 8987.407227 8396.527344 29.346466 0.000000 0.000000 2 1 1
000008@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -29.445900 43.167999 -155.774811 -3.051456 1.191721 9605.867188 9014.987305 29.346466 0.000000 0.000000 2 2 1
000010@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -156.357315 79.023430 135.646042 -0.236180 -1.743491 9029.238281 8438.358398 29.346466 0.000000 0.000000 2 1 1
000011@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -133.608322 12.870781 -81.539261 -14.038801 6.420242 9026.803711 8435.923828 29.346466 0.000000 0.000000 2 2 1
000012@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 130.971100 84.692764 120.035156 -0.727004 0.096398 9014.473633 8423.593750 29.346466 0.000000 0.000000 2 1 1
000013@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 14.601289 148.234451 168.689087 0.005510 -0.618523 9302.521484 8711.641602 29.346466 0.000000 0.000000 2 2 1
000014@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc -54.442616 97.529259 -102.017365 0.035194 1.175625 9203.395508 8612.515625 29.346466 0.000000 0.000000 2 1 1
000015@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 62.669823 107.997574 -101.900169 1.275636 2.090652 9016.214844 8425.334961 29.346466 0.000000 0.000000 2 2 1
000016@J389/extract/014627435563850374073_20221008_zzb_0001_patch_aligned_doseweighted_particles.mrc 83.903076 101.371132 45.352219 -1.253132 1.960781 9308.490234 8717.610352 29.346466 0.000000 0.000000 2 1 1
000001@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc -158.631485 45.176445 60.226044 0.314107 -0.194239 9853.389648 9220.423828 32.172337 0.000000 0.000000 2 2 1
000002@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc 98.329346 88.130112 94.420555 -1.523045 -0.581107 9491.027344 8858.061523 32.172337 0.000000 0.000000 2 1 1
000003@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc 54.024296 105.088295 135.449020 0.059578 4.834510 9730.207031 9097.241211 32.172337 0.000000 0.000000 2 2 1
000004@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc 106.032188 124.743561 124.680550 -0.471373 -0.442335 9542.354492 8909.388672 32.172337 0.000000 0.000000 2 1 1
000005@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc 173.446533 60.459785 99.702858 0.028489 -0.836644 9516.281250 8883.315430 32.172337 0.000000 0.000000 2 2 1
000007@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc -8.109679 19.362747 -106.194221 -0.386964 1.650997 9567.585938 8934.620117 32.172337 0.000000 0.000000 2 1 1
000009@J389/extract/009255598385786313581_20221008_zzb_0002_patch_aligned_doseweighted_particles.mrc -15.626041 169.793350 101.431648 -9.577100 -7.648548 9516.652344 8883.686523 32.172337 0.000000 0.000000 2 2 1
"
I move this star file to another machine which can run normally, it did work.
Then I move a star file produced by csparc2star.py in another machine to my machine, it returns the same error message.
maybe it is a problem happened in star2bild.py.
my machine is run pyem in python 3.10.10 and the other is in 3.9.7.
Thanks a lot.

Thanks. There’s nothing wrong with the star file, and star2bild.py works with it over here. Can you make sure your pyem is up to date?

I will reinstall and try.
Thanks for you reply!

Great, if you still see the error please post the python version, numpy version, and pandas versions.