Csparc2star.py final update

yes, patch motion and patch CTF. These are particles extracted from coordinates and accepted micrographs from different workspaces. Can this be an issue ? It should not matter, I think.
Thank you for your help

I wouldn’t have thought so, but maybe? Easy to test - do you have an example where the whole workflow is in a single workspace, and does the conversion work for that case?

Cheers
Oli

Indeed it works when the files come from a single workspace.

So a solution if you have different datasets is to create .star files from the single workspaces (e.g. from the single select2D jobs), merge them in relion, and modify the .mrc extension in the images present in the relative JX/extract folders, and modify the .mrc to .mrcs in the merged star file… correct ?

Sorry about the misleading error messages, it’s true that most exceptions will lead to the old passthrough message. The rest of the messages are just warnings about missing values since usually you want to make sure defocus and alignment parameters are copied.

Would you mind sending me your .cs files?

Hi Daniel, I can send you the .cs files. However the problem arised because the extracted particles had as input particles linked from other workspaces. To solve this, I am testing now what I described above.
Thanks again

I can add the the strategy I mentioned earlier to merge multiple datasets it works.

Daniel,

Wondering if you might have written code to convert to other formats like mrcs or equivalent?

Cheers,
Alex

.mrcs is just an extension used by Relion for MRC files that contain particle stacks - the format is MRC. It doesn’t have any metadata, and all our current processing programs can use them natively. STAR files, CS files (serialized numpy record arrays), and PAR files are all metadata formats that store information for particles.

If you want a single particle stack, e.g. for cisTEM, you can convert using csparc2star.py, then use relion_stack_create or stack.py to restack the particles.

1 Like

Dear Daniel,
is this script still working for relion 3.1?
we are trying to use it to create an star file
using particles extracted from cryosparc, ( .cs files). We can import the star file and also see the images in relion 3.1

However, relion complains about the boxsize and we cannot run it

ERROR:
ObservationModel::getBoxSize: box sizes not available. Make sure particle images are available before converting/importing STAR files from earlier versions of RELION.

we seem to have missed the data corresponding to this column

_rlnImageBoxSize

during the passhtrough in cryosparc, as I do not see any related to the boxsize in the metadata

thnaks for your help

@gmontoya-dk you can just add it to the optics group table.

with relion_star_handler after the conversion?

With a text editor. The optics table is tiny and at the top, so editing it directly is easiest.

Like this

data_optics

_rlnPixelSize 256

loop_
_rlnVoltage #1
_rlnSphericalAberration #2
_rlnAmplitudeContrast #3
_rlnOpticsGroup #4
_rlnImagePixelSize #5
_rlnImageDimensionality #6
300.000000 2.700000 0.070000 1 0.832000 2

data_particles

loop_
_rlnImageName #1
_rlnMicrographName #2
_rlnCoordinateX #3
_rlnCoordinateY #4
_rlnAnglePsi #5
_rlnOriginXAngst #6
_rlnOriginYAngst #7
_rlnDefocusU #8
_rlnDefocusV #9
_rlnDefocusAngle #10
_rlnPhaseShift #11
_rlnCtfBfactor #12
_rlnOpticsGroup #13
_rlnRandomSubset #14
_rlnClassNumber #15

That’s part of the header of the optics table, you can’t modify it. You would instead add _rlnImageBoxSize (the field Relion told you it needed) to the list of fields, and add a value for that to the optics groups (in this case, there is one optics group and only one line in the table).

thanks i!!!

t worked by including _rlnImageSize #7

loop_

_rlnVoltage #1

_rlnSphericalAberration #2

_rlnAmplitudeContrast #3

_rlnOpticsGroup #4

_rlnImagePixelSize #5

_rlnImageDimensionality #6

_rlnImageSize #7

300.000000 2.700000 0.070000 1 0.832000 2 256

Great, I knew you would figure it out :slight_smile:

There is a field in cryoSPARC for that value, I’ll add it to csparc2star.py this week.

Hey, is csparc2star.py still required with the new export tools (mostly added in v2.11)? If not, what’s the recommended procedure for exporting data for relion now?

yes, it is still needed - there is no native tool for conversion to star to my knowledge

Hello Oli,
Could you please comment on following error. Is installation have problem or something missing in command?

csparc2star.py P6_J50_passthrough_particles.cs P6_J50_passthrough_particles.star
no field of name blob/shape
Traceback (most recent call last):
File “/programs/x86_64-linux/pyem/20200813/pyem/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 “/opt/sbgrid/x86_64-linux/pyem/20200813/pyem_extlib/pyem-20200813-rcmw/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