Csparc2star to export particles after heterogeneous refinement

Hi,

I’m using the csparc2star.py, trying to export the particles after heterogeneous refinement in cryosparc. I used the .cs file from output “alignments3D”, and passthrough .cs file from output “blob”. I run into the error like this: (commands and debug info included)

./csparc2star.py cryosparc_P23_J31_class_00_00182_particles.cs P23_J31_passthrough_particles_class_0.cs test.star --loglevel debug

Detected CryoSPARC 2+ .cs file
Reading primary file
Assigning parameters 2D classes or single 3D class
Reading auxiliary file P23_J31_passthrough_particles_class_0.cs
Trying to merge: blob/path, blob/idx, blob/shape, blob/psize_A, blob/sign, ctf/type, ctf/exp_group_id, ctf/accel_kv, ctf/cs_mm, ctf/amp_contrast, ctf/df1_A, ctf/df2_A, ctf/df_angle_rad, ctf/phase_shift_rad, ctf/scale, ctf/scale_const, ctf/shift_A, ctf/tilt_A, ctf/trefoil_A, ctf/tetra_A, ctf/anisomag, ctf/bfactor, alignments2D/split, alignments2D/shift, alignments2D/pose, alignments2D/psize_A, alignments2D/error, alignments2D/error_min, alignments2D/resid_pow, alignments2D/slice_pow, alignments2D/image_pow, alignments2D/cross_cor, alignments2D/alpha, alignments2D/alpha_min, alignments2D/weight, alignments2D/pose_ess, alignments2D/shift_ess, alignments2D/class_posterior, alignments2D/class, alignments2D/class_ess

Merging: ucsfImageIndex, rlnDefocusV, rlnAmplitudeContrast, rlnOpticsGroup, ucsfImagePath, rlnVoltage, rlnDefocusAngle, rlnPhaseShift, rlnSphericalAberration, rlnDefocusU, rlnDetectorPixelSize, rlnCtfBfactor

no field of name blob/shape

Traceback (most recent call last):
File “./csparc2star.py”, line 42, in main

df = metadata.parse_cryosparc_2_cs(cs, passthroughs=args.input[1:], minphic=args.minphic, boxsize=args.boxsize, swapxy=args.swapxy)

File “/home/syang/software/pyem/pyem/metadata.py”, line 417, in parse_cryosparc_2_cs
df[star.Relion.IMAGESIZE] = cs[“blob/shape”][:, 0]

ValueError: no field of name blob/shape
Required fields could not be mapped. Are you using the right input file(s)?

Could you help with this issue?Thanks a lot!

And if I try the same but renamed .cs files again, it comes the new error:

./csparc2star.py class_00_particles.cs passthrough_particles.cs test.star --loglevel debug
Traceback (most recent call last):
File “./csparc2star.py”, line 28, in
from pyem import metadata
File “/home/syang/software/pyem/pyem/init.py”, line 3, in
from . import metadata
File “/home/syang/software/pyem/pyem/metadata.py”, line 399
ptdf = util.dataframe_from_records_mapped(pt, {**general, **micrograph})
^
SyntaxError: invalid syntax

Could anybody help to fix the problem? Thanks!

I fixed problem 1, by checking for the field in every provided .cs file and not throwing an error if it’s missing. In that case, though, one would have to add rlnImageSize manually. Probably you won’t ever have to.

2nd problem is caused by using Python2, which is reached end-of-life last year. Python3
is required.

Thanks! After re-install miniconda3, the problem is solved.