Motion corrected mrcs from CS to RELION

Is there a simple way to take patch motion corrected micrographs from CS and import them into RELION for use in Bayesian Polishing or re-extraction of particles?

I have successfully got my particles into a star file and they can be used in 2D or 3D classification, but I have tried to import the patch motcorr aligned and dose weighted aligned mrcs into RELION and none of my attempts have been fruitful. I want to avoid redoing the motcorr due to space limitations on our cluster.

I found this [Preparing CryoSPARC-Processed Files for Futher Processing in Relion?] from a few months back, but there was no direct answer posted.

Thanks,
Kye

4 Likes

I also want to know how to import Relion, can someone answer?

I just did a quick test and the same method that I use to import particles from cryosparc to relion works for micrographs. Make a folder in your relion directory corresponding to the patch motion job (J100). Make the subdirectory “motioncorrected” and then within this directory make symbolic links to the cryosparc database housing the J100/motioncorrected/*doseweighted.mrc files. Then import the mics to relion via normal method. Note leading numbers may need to be removed.

You cannot use these micrographs to run polishing, but you should be able to re-extract from them in relion if you get the coordinates correct. Polishing requires that the original mics were generated through either motioncor2 or relioncor run via the relion gui.

Hi there,

I am having trouble with this. I ran motioncor2 in CS and want to perform bayesian polishing in relion, but when I import the doseweighted.mrc files, I am met with an error “ERROR:
The corrected_micrographs STAR file does not contain rlnMicrographMetadata label. Did you not run motion correction from the RELION-3.0 GUI?”

Can you please send me or comment a detailed step by step on how you were able to do this? How can I have two sets of particles extracted from the same data set in CS. How would I use these coordinates to re-extract from the movies in RELION? Also, will I need to run CTF estimation again since in CS I used the motioncor2 output as input for GCTF?

Any help would be greatly appreciated!

Right now the only sure way to do the polishing is to:

  1. repeat motion correction on your original movies, either using Relion (“motioncor2” or “own” version are both OK) or WARP
  2. Export particles from cryoSPARC - double check coordinates are correct
  3. Extract particles from new motioncorrection result. DO NOT RECENTER BASED ON ALIGNED SHIFTS
  4. Import particles to cryoSPARC
  5. New global refinement of imported particles
  6. Export refinement, use --copy-micrograph-coordinates
  7. Run relion_postprocess on the refinement volumes from cryoSPARC
  8. Double check all paths in files
  9. Use Relion/WARP MotionCorr corrected_micrographs.star, new exported particles, and the postprocess .star file for Bayesian polishing

Any other method, including any conversion of motion trajectories from Patch Motion, is experimental and not validated to work. The above protocol will definitely work if you are careful with your file paths and parameters. Double check pixel sizes and optics group names. Optic group matching between micrograph and particle files is by the group name - the numbers only need to be unique within one file.

I have obtained resolution improvements as good as 0.6 Å and as bad as -6 Å (that means 6 Å worse). YMMV.

PS correct per-particle CTF values will come along in the export chain.

4 Likes

Thank you for the response! This was very clear and easy to understand, I hope it helps others looking to do the same thing. That’s interesting though - I wonder why the results for improvements/worsening are so different?

Hi Daniel,

I tried to use warp for Relion polishing but got some weird error for gain reference. The movies are in EER format and gain ref was converted to mrc for Warp processing (Y flipped in Warp as well). Warp produced good picked particles and nice maps to 2.5A in Relion. Then use the micrographs.star (exported by Warp) for Polishing, it gave following error about gain ref. Any suggestion to correct this? Thanks!

Size of input gain: X = 4096 Y = 4096 Expected: X = -4096 Y = -4096
in: /ap/relion/relion_4_0/src/relion/src/renderEER.h, line 148
ERROR:
Invalid gain size in EERRenderer::upsampleEERGain()

@jzhu No idea. WARP is not carefully debugged, so new features e.g. separate output directory do not work with all types of operations in the software. Crashes are also triggered by certain parameter settings, such as setting the max motion correction or CTF resolution to beyond Nyquist. It may work if you use the same directory and double check all of the movie size and frame number values (they are not consistently read from the data, sometimes you need to set them manually). For single particle analysis, I wouldn’t choose WARP over cryoSPARC live or even Relion (which also has an on-the-fly capability).

OTOH, for tomography, WARP has a number of nice features that are not available in other software. I speak only about SPA above.

@DanielAsarnow How do I use --copy-micrograph-coordinates when exporting the new refinement job?
For instance, I now have Extract/job135/particles.star that I imported into csparc for 3D refinement (J698). I now want to use that 3D refinement for post-processing and bayesian polishing. I am using the following command csparc2star.py --copy-micrograph-coordinates Extract/job135/particles.star /mnt/data/EC/P2/J698/J698_008_particles.cs /mnt/data/EC/P2/J698/J698_passthrough_particles.cs J698_particles.star but it errors out with

Traceback (most recent call last):
File “/usr/bin/csparc2star.py”, line 177, in
sys.exit(main(parser.parse_args()))
File “/usr/bin/csparc2star.py”, line 118, in main
df = star.smart_merge(df, coord_star, fields=fields, key=key)
File “/usr/local/pyem/pyem/star.py”, line 188, in smart_merge
s2 = s2.set_index(key, drop=False)
File “/usr/local/miniconda3/envs/pyem/lib/python3.10/site-packages/pandas/util/_decorators.py”, line 331, in wrapper
return func(*args, **kwargs)
File “/usr/local/miniconda3/envs/pyem/lib/python3.10/site-packages/pandas/core/frame.py”, line 6009, in set_index
raise KeyError(f"None of {missing} are in the columns")
KeyError: ‘None of [None] are in the columns’

Is re-running the 3d refinement in csparc important or can I just use the same particles.star I used initially (input for extract job) as input for bayesian polishing?

1 Like

You probably also need --strip-uid. (The particle stack names need to agree).

1 Like

That seems to be exactly what I needed @DanielAsarnow , thanks! I am finally running a Bayesian Polishing job. Very curious to see the results.

I have encountered this error as well, but I was transferring EER data from cryoSPARC 4.4.0 directly to relion 4. I found that two parameters were missed in the movie metadata star files when I compared the native motion correction output from relion: _rlnEERUpsampling and _rlnEERGrouping.

I ran the following commands to add the lines into all star files:

for i in *.star; do sed -i '29 i _rlnEERUpsampling 1' $i; done
for i in *.star; do sed -i '30 i _rlnEERGrouping 27' $i; done

In my case, I added these 2 lines at line 29 and 30 of the files. For _rlnEERGrouping, since there are 1085 frames in the EER movies, dividing 40 fractions means each fraction contains 1085/40 ~= 27 frames.