Export data to Relion in v2

Hi @DanielAsarnow,

I’m trying to use cscparc2star, but getting an error (below). I thought it might be because I originally extracted my particles in Relion, then imported that particle stack into cryosparc for 2Ds and 3Ds, and now I’m trying to export the particles from my 3D refinement back out into a relion .star file so I can refine further in Relion. I tried using --copy-micrograph-coordinates, but as you mentioned previously in this thread, this argument is no longer recognized. I also tried using --micrograph-path, but this argument was not recognized.

Is there an alternative?

Thanks!
~Mimi

Error:
Traceback (most recent call last):
File “/home/mimilinh/software/bin/csparc2star.py”, line 144, in
sys.exit(main(parser.parse_args()))
File “/home/mimilinh/software/bin/csparc2star.py”, line 62, in main
meta = parse_metadata(args.input) # Read cryosparc metadata file.
File “/home/mimilinh/software/bin/csparc2star.py”, line 129, in parse_metadata
meta = pd.read_csv(csvfile, skiprows=idx, header=None, skip_blank_lines=True)
File “/datadisk/zhoulab9/mimilinh/software/miniconda2/lib/python2.7/site-packages/pandas/io/parsers.py”, line 702, in parser_f
return _read(filepath_or_buffer, kwds)
File “/datadisk/zhoulab9/mimilinh/software/miniconda2/lib/python2.7/site-packages/pandas/io/parsers.py”, line 435, in _read
data = parser.read(nrows)
File “/datadisk/zhoulab9/mimilinh/software/miniconda2/lib/python2.7/site-packages/pandas/io/parsers.py”, line 1139, in read
ret = self._engine.read(nrows)
File “/datadisk/zhoulab9/mimilinh/software/miniconda2/lib/python2.7/site-packages/pandas/io/parsers.py”, line 1995, in read
data = self._reader.read(nrows)
File “pandas/_libs/parsers.pyx”, line 899, in pandas._libs.parsers.TextReader.read
File “pandas/_libs/parsers.pyx”, line 914, in pandas._libs.parsers.TextReader._read_low_memory
File “pandas/_libs/parsers.pyx”, line 991, in pandas._libs.parsers.TextReader._read_rows
File “pandas/_libs/parsers.pyx”, line 1050, in pandas._libs.parsers.TextReader._convert_column_data
pandas.errors.ParserError: Too many columns specified: expected 84 and found 4

I tried using --copy-micrograph-coordinates, but as you mentioned previously in this thread, this argument is no longer recognized.

You’re mistaken, this argument is/has always been used to copy in the coordinates from a star file, in the case where particles from Relion are imported to cryoSPARC.

I think there’s something wrong with your command line (please share it). Are you still using cryoSPARC 0.65? You can run with --loglevel debug to get some more output as well.

I’m using cryoSPARC v2.8.3, command is:

csparc2star.py --copy-micrograph-coordinates …/2bn_12356_reextract_unbinned.star cryosparc_P39_J38_007_particles.cs from_cryosparc_P39_J38_007_particles.star

this is the error I get when I run that command:

csparc2star.py: error: unrecognized arguments: --copy-micrograph-coordinates from_cryosparc_P39_J38_007_particles.star

Are you missing a space between the argument and the filename? When there is an unrecognized argument, the option to the argument (filename in this case) is not printed. Since it’s printed in your error it must not be passed correctly. You can use --argument="<option>" to make extra sure it’s passed right.

Hi Dan,

I don’t think I am missing a space, but just tried it again just in case with the same result.

the command:
csparc2star.py --copy-micrograph-coordinates=“2bn_12356_reextract_unbinned.star” cryosparc/cryosparc_P39_J38_007_particles.cs from_cryosparc_P39_J38_007_particles.star

gives this error:
csparc2star.py: error: unrecognized arguments: --copy-micrograph-coordinates=2bn_12356_reextract_unbinned.star cryosparc_P39_J38_007_particles.star

I tried running with --loglevel debug, but this argument was also not recognized:

com: csparc2star.py cryosparc/cryosparc_P39_J38_007_particles.cs from_cryosparc_P39_J38_007_particles.star --loglevel=“debug”

err: csparc2star.py: error: unrecognized arguments: --loglevel=debug

Best,
~Mimi

Perhaps you have a very outdated version of the program. Are you using the current version of the release branch?

I just installed it using this command: git clone -b release https://github.com/asarnow/pyem.git cd pyem pip install -e . Is this the current version of the release branch? When I use the -h option, the --copy-micrograph-coordinates option is not listed.

How’d you run it? Maybe the one on your path is not the one you just checked out? The argument is definitely in the program.

You’re right, I had thought that was strange, since I could see it in the program. I had a really old copy in my path. Just replaced, and it is working now. Thank you for your help, and sorry it turned out to be such a dumb problem!!!

No worries, glad it’s working now!

@DanielAsarnow, I run cryoSPARC on some cluster where pyem has not been installed. Can I copy the cs files from this cluster to a local computer where I have installed pyem, and csparc2star.py can work to convert cs to star files? Thanks so much!

@donghuachen Sure thing, it doesn’t check anything but the .cs files. (No inspection or validation of actual particle images for example).