Csparc2star.py error

Hi,

I am trying to convert particles.cs file into particles.star file to process in Relion using csparc2star.py .
I encounter following error:
python3 /data/Cryosparc_user/pyem/csparc2star.py --copy-micrograph-coordinates P4_J21_passthrough_particles_selected.cs P4_J21_passthrough_particles_selected.star
Traceback (most recent call last):
File “/data/Cryosparc_user/pyem/csparc2star.py”, line 120, in
sys.exit(main(parser.parse_args()))
File “/data/Cryosparc_user/pyem/csparc2star.py”, line 38, in main
if args.input[0].endswith(".cs"):
IndexError: list index out of range

I was wondering if someone can help me resolve this issue.

Thanks

Anamika

Hi @Anamika1,

in your command, the flag “–copy-micrograph-coordinates” needs to be followed with your original particles.star file that was imported in cryoSPARC. or if your particles were picked in cryoSPARC, you don’t need this flag.

Hi Bing,

My particles were picked in Cryosparc and if I run the command without the flag, I see different error now.
(base) [cryosparc_user@delorean J21]$ python3 /data/Cryosparc_user/pyem/csparc2star.py P4_J21_passthrough_particles_selected.cs P4_J21_passthrough_particles_selected.star

Angular alignment parameters not found

(base) [cryosparc_user@delorean J21]$

I guess this is just a warning, you should still get a .star file. If you want to have star file containing Angular alignment parameters, you should convert .cs file in a refinement job.

Thanks, yes it worked.

Hi Bing,

Another issue, when I import the .cs to .star converted file in relion I see following error with bunch of missing variables. Is there something I need to specify during conversion?
in: /usr/local/relion-3.1-source/src/jaz/obs_model.cpp, line 198
ERROR:
ERROR: not all necessary variables defined in _optics.star file: rlnPixelSize, rlnVoltage and rlnSphericalAberration. Make sure to convert older STAR files anew in version-3.1, with relion_convert_star.
=== Backtrace ===
relion_import(_ZN11RelionErrorC1ERKSsS1_l+0x47) [0x4cfd17]
relion_import() [0x44073a]
relion_import(_ZN16ObservationModel10loadSafelyESsRS_R13MetaDataTableSsib+0x437) [0x4e0577]
relion_import(_ZN17import_parameters3runEv+0x1177) [0x4a3ba7]
relion_import(main+0x35) [0x49bbc5]
/usr/lib64/libc.so.6(__libc_start_main+0xf5) [0x7fd0ac2f0555]
relion_import() [0x49e7df]

ERROR:
ERROR: not all necessary variables defined in _optics.star file: rlnPixelSize, rlnVoltage and rlnSphericalAberration. Make sure to convert older STAR files anew in version-3.1, with relion_convert_star.

Are you using the most recent pyem? it should write out the optics group in the star file converted, something like:

data_optics

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

Or you can just add this manually.

Hi Bing,

As you mentioned above I converted the .cs file from refinement job and now I see following defocus value not found error. Any suggestion on how to fix it?

python3 /data/Cryosparc_user/pyem/csparc2star.py --swapxy /data/Cryosparc_user/P4/J68/P4_J68_passthrough_particles.cs P4_J68_passthrough_particles_swapxy.star
Defocus values not found

hi @Anamika
I guess you should convert particle meta data file something like: cryosparc_P4_J68_00?_particles.cs

Thanks! Yup that was it, no warnings any more!