Import particles from CryoSPARC v3.3.1 to Relion (relion/4.0-beta2_cu10.2, Sbgrid)

Hello all,

We are having problems importing particles (or coordinates to re-extract later) from CryoSPARC v3.3.1 to Relion (relion/4.0-beta2_cu10.2, from Sbgrid).

To do so we use PyEM (pyem/20220107, fro; Sbgrid).


Packages used:

  1. pyem/20220107 (sbgrid module)

  2. relion/4.0-beta2_cu10.2 (sbgrid module)

  3. CryoSPARC v3.3.1

Basically, we can generate an .star file with optics information but lacking the coordinates. Or coordinates are there (_rlnCoordinateX #3, _rlnCoordinateY #4) but not good _rlnImageName #1 ?

$ csparc2star.py J184/extracted_particles.cs J184/P10_J184_passthrough_particles.cs particles_box.star –strip-uid

Angular alignment parameters not found

$ more particles_box.star

data_optics

loop_

_rlnVoltage #1

_rlnSphericalAberration #2

_rlnAmplitudeContrast #3

_rlnOpticsGroup #4

_rlnImageSize #5

_rlnImagePixelSize #6

_rlnImageDimensionality #7

300.000000 2.700000 0.100000 3 350 0.850000 2

data_particles

loop_

_rlnImageName #1

_rlnMicrographName #2

_rlnCoordinateX #3

_rlnCoordinateY #4

_rlnDefocusU #5

_rlnDefocusV #6

_rlnDefocusAngle #7

_rlnPhaseShift #8

_rlnCtfBfactor #9

_rlnOpticsGroup #10

000001@J184/extract/000004360215995426433_20211216_B2G1_ND_H__146-4_011_-0.0_Jan

28_rigid_aligned_particles.mrc J113/motioncorrected/000004360215995426433_202112

16_B2G1_ND_H__146-4_011_-0.0_Jan28_rigid_aligned.mrc 554 1578 19529.330078 19006

.982422 -21.646286 0.000000 0.000000 3

I can import this .star file but if I display these particles, it comes out with: Cannot read file J202/extract/014424738750866394221_20211216_B2G1_ND_H__106_002_-0.0_Jan27_rigid_aligned_particles.mrc It does not exist

I could change .mcr to .mrcs in the star file and then it is able to read particles imported, I can sub-select them, but coordinates are not there anyway if I want to re-extract them.

=================

Extracting particles from the micrographs …

0/ 0 sec …~~(,_,">

Joining metadata of all particles from 2080 micrographs in one STAR file…

The pixel size of the extracted particles in optics group 1 is 0.85 Angstrom/pixel.

Written out STAR file with 0 particles in Extract/job067/particles.star

Done preprocessing!

Furthermore:

If I add -copy-micrograph-coordinates (before of after passthrough, no matter) does not work either.

$ csparc2star.py J184/extracted_particles.cs J184/P10_J184_particles.cs --copy-micrograph-coordinates particles_box.star --strip-uid

Defocus values not found

Angular alignment parameters not found

/opt/sbgrid/x86_64-linux/pyem/20220107/pyem_extlib/pyem-20220107-ulwm/pyem/star.py:538: FutureWarning: Columnar iteration over characters will be deprecated in future releases.

df[UCSF.IMAGE_INDEX], df[UCSF.IMAGE_PATH] = \

/opt/sbgrid/x86_64-linux/pyem/20220107/pyem_extlib/pyem-20220107-ulwm/pyem/star.py:546: FutureWarning: Columnar iteration over characters will be deprecated in future releases.

df[UCSF.IMAGE_ORIGINAL_INDEX], df[UCSF.IMAGE_ORIGINAL_PATH] = \

I would really appreciate if somebody can help us with this issue… :slight_smile:

Best,

Borja

Hi Borja,

You may not be using the latest version of pyem. Try installing the latest version from github in a virtual environment and running it there. The easiest way to do this with SBGrid is to use venv instead of conda in my opinion. I’m happy to provide more info on that if needed.

Best,

Ryan

1 Like

Hi guys,
I have problem in importing particles from cryosparc to relion, pyem was installed latest, tried both python 2 and python 3, but it did not work, here is the command I used:
csparc2star.py --copy-micrograph-coordinates original_particles.star particles_selected.cs P78_J30_passthrough_particles_selected.cs output.star

It shows error:
Traceback (most recent call last):
File “/Users/Wenbo/pyem/csparc2star.py”, line 28, in
from pyem import metadata
File “/Users/Wenbo/pyem/pyem/init.py”, line 3, in
from . import metadata
File “/Users/Wenbo/pyem/pyem/metadata.py”, line 23, in
from . import star
File “/Users/Wenbo/pyem/pyem/star.py”, line 27, in
from pyem.geom import e2r_vec
File “/Users/Wenbo/pyem/pyem/geom/init.py”, line 3, in
from .convert_numba import *
File “/Users/Wenbo/pyem/pyem/geom/convert_numba.py”, line 18, in
import numba
File “/Users/Wenbo/opt/miniconda3/envs/pyem/lib/python3.10/site-packages/numba/init.py”, line 200, in
_ensure_critical_deps()
File “/Users/Wenbo/opt/miniconda3/envs/pyem/lib/python3.10/site-packages/numba/init.py”, line 140, in _ensure_critical_deps
raise ImportError(“Numba needs NumPy 1.21 or less”)
ImportError: Numba needs NumPy 1.21 or less

Can anyone give a hint what could be the reason?

Thanks
Wen

Hi Borja,

I believe the problem with your extract job is that you need to have the correct relative path to the motioncorrected images. When relion looks for the file to extract from it can’t find it because it’s not located at the relative path J113/motioncorrected/000004360215995426433_20211216_B2G1_ND_H__146-4_011_-0.0_Jan28_rigid_aligned.mrc

The path in the particle file should look something like: MotionCorr/jobXXX/Micrographs/20211216_B2G1_ND_H__146-4_011_-0.0_Jan28_rigid_aligned.mrc

You will need to edit or replace it for every particle to point to the location of the motion corrected files in the relion directory.

If the UIDs weren’t in the path you could use:
sed -i ‘s+JXXX/imported+MotionCorr/jobXXX/Micrographs+g’ from_cryosparc.star

The directory named “Micrographs” could be different depending on how you imported your raw movies. This is also assuming that you performed motioncor in relion.

Alternatively, you could make the path “J113/motioncorrected/000004360215995426433_20211216_B2G1_ND_H__146-4_011_-0.0_Jan28_rigid_aligned.mrc” accessible from the relion project directory by recursively sym linking the folder J113 to your relion project directory but this might cause problems later if you want to polish the particles since your particles won’t be linked to the raw movies.

Best,

Ryan

2 Likes

Hi Wen,

It looks like you’re missing the correct version of the NumPy module. Try installing it with conda install numpy=1.12

Best,

Ryan

1 Like