Importing crYOLO particle coordinates into cryoSPARC

Currently, I’m trying to import particles picked using crYOLO into cryoSPARC. Initially, I use crYOLO to pick particles from the patch motion correction job’s output (the dose-weighted aligned micrographs). crYOLO outputs a list of star files with the particle coordinates for each micrograph. From this point on, I’m unsure of how to be using the ‘Import Particle Stack’ job to be importing those coordinates into cryoSPARC.

This is what I have tried so far with Import Particle Stack:

  1. Importing source micrographs from an earlier patch motion correction job
  2. Selecting ignore raw data and setting particle data path to all the star files outputted by crYOLO
  3. Setting the 2 suffix cuts to their correct values

This fails due to lacking, I think, the Particle meta path. But I’m not sure what the meta path for the particles should be here. crYOLO does not output any such files. What should I do in this case so that the particles can be imported successfully?

Have you tried just concatenating all the per-mic crYOLO star files together into one big particle star file (removing all except the first header of course) - that should work I would think?

Cheers
Oli

Thanks @olibclarke for the suggestion - that should work. @kmzaw please let us know if you were able to import successfully!

That did work! Thanks @olibclarke

1 Like

Hi, I am also trying to do this but still got an error that says “Could not import star file: too many fields missing” Does your star file looks like this?
Screen Shot 2021-04-30 at 2.07.34 PM|225x499

Hi Smona, the other way to do it (which I have been doing recently) is just to do an extraction in relion (using either crYOLO box or star files) purely to generate a particle star file, then import the resulting star file into cryosparc, with ignore raw data on. Maybe give that a try?

Cheers
Oli

1 Like

Has anyone attempted to make a script to import cryolo picks directly to crysoparc? I tried to concatenate as @olibclarke suggested without any luck.

Currently picked particles from denoised micrographs (using topaz output), which works just fine, but having issues converting them into a particle.star file that will import and link to the topaz denoising job which I ran in cryosparc. Any ideas @apunjani?

I know this is an older thread, but I since it was related to my question I did not want to open a new thread.

we just do an extraction in relion (using the .box files) and import ignoring raw data - does that not work for you @Omid?

Hi @olibclarke,

I have done it in the past but for some reason I had a hard t using the same denoised micrographs that I used for picking. Maybe it is because some of the micrographs have zero picked particles. I am sure I can figure it out using relion eventually… Just curious if someone had a script for it that they did not mind sharing which avoids going from cryolo, to relion and then to cryosparc. Perhaps I’ll set some time aside and make one. I am just very slow at scripting.

Best,
Omid

hmm - was it giving an error of some kind? I’ve been doing it with JANNI denoised micrographs without issues

Yeah it was not able to find one of the input micrographs. I suspect it is because no particles were picked for that image and hence no box file output for that corresponding micrograph. I’ll test it out later…

Hello everyone, @Omid and @olibclarke,

I always use cryolo for picking and directly import to csparc using the following very simple script.

It can be adapted to a different routine, but to make sure that it will work each time, I use the csparc’s /path_to/motioncorrected/*_patch_aligned_doseweighted.mrc as input for cryolo (which is important for the x,y axis to be the same and to match the name for each micrograph) and I import only the coordinates, while connecting the exposures to the imported particles. Make sure that all exposures used as input for cryolo are dragged to be connected with the particles (it will fail if there are particles for micrographs that are not included in the exposure set, eg because some exposures have been rejected to a previous curate exposures step).

After that you can use the imported particles and any selected subset of the exposures as input for an extraction job. For example, for a csparc live session, export exposures to csparc and then use the “all_exposures” set to connect with the particles at the import particles step but only the “accepted_exposures” for the extract from mics step (to avoid manually selecting mics twice).

Hope that helps.
Best,
Left

##################################

cd cryolo_output/STAR

echo ' ' > ../picks.star
echo 'data_' >> ../picks.star
echo ' ' >> ../picks.star
echo 'loop_' >> ../picks.star
echo '_rlnMicrographName #1' >> ../picks.star
echo '_rlnCoordinateX #2' >> ../picks.star
echo '_rlnCoordinateY #3' >> ../picks.star


foreach file (*.star) 

      awk -v f="$file" '{if (NF>3) printf "%s\t%s\t%s\n", f, $1, $2}' $file >> ../picks.star

end 

sed -i 's|.star|.mrc|g' ../picks.star

gedit ../picks.star #if you want to inspect the output

cd ../../

##################################

2 Likes

Hi @lezark

So sorry for the late reply. Been a busy few months. I will definitely give this a shot. Thank you so much for sharing.

Best,
Omid

I tried your script finally, but ran into a few issues. Sorry I have no formal computer science training. Had to change the foreach command since that only works in c-shell (I think). Then I removed the CF/LF lines with dos2unix program which occur with copy and pasting from windows computers I suppose.

This is the script I used for bash shell to make it work for those interested. I figured others may run into the same issue as most basic user use bash shell.

echo ’ ’ > …/picks.star
echo ‘data_’ >> …/picks.star
echo ’ ’ >> …/picks.star
echo ‘loop_’ >> …/picks.star
echo ‘_rlnMicrographName #1’ >> …/picks.star
echo ‘_rlnCoordinateX #2’ >> …/picks.star
echo ‘_rlnCoordinateY #3’ >> …/picks.star
for file in /data/CRYOSPARC/cryolo/full_data/STAR/*.star ; do
awk -v f="$file" ‘{if (NF>3) printf “%s\t%s\t%s\n”, f, $1, $2}’ “$file” >> …/picks.star ; done

Thanks again for your suggestion!