Last HMEDit 20210207
Converting Cryosparc particles to relion3.1 format
1. ON RESCOMP. Navigate to the refinement job directory that you wish to convert to relion format and note the path. Within this directory there should be a particles .cs and a pass through .cs files. Download both of these files to your strubi directory.
NOW TO STRUBI...
2. If you have not done so already, download the latest pyem package. The python script used to convert a .cs (format used by cryosparc) into a .star (format used by Relion) is named csparc2star.py and is part of UCSF PyEM suite (https://github.com/asarnow/pyem). It is important that you use the latest version, since a few modifications have been made to cater for the different coordinate conventions between relion and cryosparc.
Instructions to install Pyem can be found here: https://github.com/asarnow/pyem/wiki/Install-pyem-with-Miniconda
3. Once you have installed pyem under a conda environement you will need activate it:
source activate "environment_name"
Run csparc2star.py on your particles cs file, ensuring that you use python3!
Path/to/csparc2star.py --inverty --swapxy --boxsize 440 cryosparc_P???_J??_???_particles.cs P???_J??_passthrough_particles.cs J??_refine.star
Where '?' is a wildcard to be replaced with your particular job number etc.
It is also possible to include the --micrograph-path argument if you want to direct relion to the relion motion corrected movies e.g. --micrograph-path MotionCorr/job002/Frames/ .
#Note that the conversion script uses some modules from the the pyem suite in addition to panda etc and so worth checking that everything is installed.
#Should convert the cs file to a particles star file. Never straight forward, some errors often occurs.
3. Modify the resulting star file with the following. The easiest method at the moment is using gedit and ctrl+h ...I will make a script at some point hopefully to make things more streamlined.
i. such that the path to the micrographs is targeting your relion directory (e.g. Motioncor/job002/Movies/movies_name.mrc), and has the correct name extension e.g..mrc rather than patch.mrc.
ii. Change the particle file name extension from .mrc to .mrcs.
iii. Alter the header optics group:
# version 30001
opticsGroup1 2 ../../mtfs/mtf_k2_300kV.star 1.050000 300.000000 2.700000 0.100000 1.050000 440 2
4. Copy the resulting star file back to rescomp.
BACK TO RESCOMP...
5. Sym link the absolute path of your particles directory from cryosparc (listed in the star file) to your relion directory. To do this, I advise creating a director with the relevant job number, than another inside with extract and then sym link the particles to the extract directory. The reason for doing this as opposed to just sym linking the entire directory structure inclusive of particles is that Relion only accepts particles with a .mrcs extension, and it is only possible to rename the extension if only the files are sym linked.
6. Rename the file extension mrc of the particles to mrcs. This is simply achieved with a 'rename' command. Within your newly created extract directory containing sym linked particles, execute the following command;
rename mrc mrcs *mrc
Do a quick ls to check that it has done something sensible.
7. Import the new star file in relion as a particles star file and run extraction. I would recommend checking the display of the resulting output coordinates and see if they are centred on your particles.