Bayesian Polishing of cryosparc-processed particles

Hi Daniel,

Thanks for the response. I ended up using the operate function in relion_star_handler twice, but this would have been easier. I didn’t see those options in the csparc2star.py -help. Will use in the future.

Thanks,
Matt

after relion reconstruct, what mask you use for postprocess? mask from cryosparc refine job or you make a new mask? Thanks

I usually use the refine mask from cryosparc for postprocess. Just make sure it encompasses the entire volume you wish to analyze.

2 Likes

hi, user123,

I followed your suggestion of use subselect to split particles into 2 random sets, then
relion_reconstruct --i Select/job031/particles_split1.star --o reconstruct/run_half1_class001_unfil.mrc
relion_reconstruct --i Select/job031/particles_split2.star --o reconstruct/run_half1_class002_unfil.mrc
however, I check the half map mrc file, it looks wired


and relion posrprocess job does not recognize it, anything wrong with my process? Thank you

you need the --ctf flag in relion_reconstruct, and usually it will be faster to run the mpi parallelized version, e.g.:

mpirun -n 8 relion_reconstruct_mpi --i J1334_particles_half1.star --angpix 0.83 --ctf --o P1_J1334_half1.mrc >& log1 &

3 Likes

Hi @DanielAsarnow,

The --flipx and --flipy doesn’t seem to work in my csparc2star.py. We have pyem installed through sbgrid and are using version 20200813?:

/programs/x86_64-linux/pyem/20200813/pyem/csparc2star.py

Is this outdated?

Thanks,
Matt

Yes, very much so. It’s a rolling release, the date must just be when the SBgrid maintainers performed a check-out. You can install it following the instructions on github, or ask SBgrid to do an update. They are usually very responsive.

1 Like

works, thank you, oli

1 Like

Hi @DanielAsarnow,

We’ve updated pyem to 20210211 and I see inverty as an option now, but I’m having a problem with the arguments in csparc2star.py. I’m trying to use both --copy-micrograph-coordinates and --inverty, is that possible or do I have to use the arguments separately? How would an example look?

Thanks,
Matt

There’s no reason to use them together, because --copy-micrograph-coordinates copies the (presumably correct) coordinates from another .star file after converting the particles from .cs. For example, if you’ve imported a particles .star into cryoSPARC, done some processing, and then want to pull those particles back out of cryoSPARC to re-extract in Relion.

On the other hand, if cryoSPARC already knows the coordinates, because you have picked and/or extracted in cryoSPARC, then when you convert to .star you will get coordinates, but the convention might not be right for re-extraction in another program. Then --swapxy, --inverty etc. may be necessary.

Hi @DanielAsarnow,

My particles were extracted outside of cryosparc (in relion), but now I want to extract from cryosparc processed movies so I can test local motion correction in cryosparc. Thats why I need to inverty for importing and linking to the cryosparc micrographs.

When I use the inverty with --copy-micrograph-coordinates, csparc2star.py doesn’t like it:

csparc2star.py –copy-micrograph-coordinates --inverty import.star particle.cs output.star
csparc2star.py: error: argument --copy-micrograph-coordinates: expected one argument

In the meantime, I’ve been using relion_star_handler twice:

relion_star_handler --operate rlnCoordinateY --add_to -5760 #pixel dimension in y
relion_star_handler --operate rlnCoordinateY --multiply_by -1

This works, but would prefer less steps.

Thanks,
Matt

1 Like

--copy-micrograph-coordinates copies the coordinates (and micrograph names) from an existing .star file, it expects one argument as per the error message.

For example:
csparc2star.py --copy-micrograph-coordinates orig.star particles.cs passthrough.cs particles_orig_coords.star

The other csparc2star.py arguments alter cryoSPARC-sourced coordinates before converting them from normalized to pixel coordinates. What you want to do is a bit different: altering some previous coordinates in an existing .star file. Can you not combine your relion_star_handler solution to a single command?

pyem includes a program called star.py which does this sort of thing, though I never implemented the --invertx etc arguments there because there were existing solutions. I could add them in if folks think it’s useful.

1 Like

Hi @stefan
Sorry to revive this thread that you probably thought was behind you by now, but I’m wondering if you (or others) ever found a convenient way to edit the particle star file generated from csparc2star.py to point to the motion-corrected mics you generated in relion? I’m trying to do basically the same thing you laid out here.

Please let me know when you get a chance–thanks!
-jonny

Hey @Cryo_EM_Jonny,
Check out Dan’s detailed instruction page for pyem here, particularly use of the sed command. Sorry if I misinterpreted what you are asking.

@user123 is right, changing the path to the micrographs is all you need now. Relion 3.1+ no longer requires a micrographs.star for re-extraction, so star.py --to-micrographs isn’t needed.

@user123 @DanielAsarnow thanks to you both! I realized that the changes I wanted to make were easily do-able with visual block mode with vim.

Hi Daniel,
I am trying to move 2D classified particles from cryosparc to relion for further processing and want to also overcome this problem of not having particles corresponding to a relion motion corrected star file.

Sorry to ask for clarification on something that might be obvious but - by changing the path to the micrographs, what do you mean exactly? Do you mean edit the created star file (using pyem, particle stack from cryosparc, swapxy, inverty options) to alter rlnMicrographName and rlnImageName so that these correspond to micrographs motion corrected in relion (MotionCorr). Will this then allow bayesian polishing later on in relion on 3D models generated? Do I just to this manually?
Any help would be much appreciated.
Thanks
Becca

vi, sed, even excel will allow you to do search-and-replace on the micrograph names pretty easily, and if you need to copy micrograph names and coordinates you can use star.py --copy-micrograph-coordinates or --merge-source <file> --merge-key <keys> --merge-fields <fields> to match up particles between star files.

At the end of the day for Bayesian polishing you need 1) movies and motion correction in a Relion project (Relion or motioncor2 are both fine as long as motioncor2 was launched from Relion), and 2) particles with correct coordinates (and 3D alignments), with micrograph names that match the Relion micrographs.

Ok I see, so only altering rlnMicrograph name…
Thank you so much!

Hi Daniel, the combination of --swapxy and --inverty works great to port particles from cryosparc to relion. However, none of these options changes the _rlnOriginXAngst or the _rlnOriginYAngst. Does that mean the axes of the shifts are consistent between cryosparc and relion? Thanks!