asarnow / pyem

Python programs for electron microscopy
GNU General Public License v3.0
114 stars 52 forks source link

Trouble converting exported .cs file #124

Open SI18 opened 1 month ago

SI18 commented 1 month ago

Hello! I have an issue with using csparc2star. I enter the following commands:

conda activate pyem

(pyem) csparc2star.py --boxsize 150 --copy-micrograph-coordinates path J26_particles_exported.cs J26_particles_exported.star

Traceback (most recent call last): File "/home/sofia.ievleva/miniconda3/bin/csparc2star.py", line 33, in sys.exit(load_entry_point('pyem', 'console_scripts', 'csparc2star.py')()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sofia.ievleva/pyem/pyem/cli/csparc2star.py", line 185, in main sys.exit(main(parser.parse_args())) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sofia.ievleva/pyem/pyem/cli/csparc2star.py", line 122, in main df = star.smart_merge(df, coord_star, fields=fields, key=key) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sofia.ievleva/pyem/pyem/star/star.py", line 209, in smart_merge s2 = s2.set_index(key, drop=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/sofia.ievleva/miniconda3/lib/python3.12/site-packages/pandas/core/frame.py", line 6122, in set_index raise KeyError(f"None of {missing} are in the columns") KeyError: 'None of [None] are in the columns'

I have downloaded everything including miniforge3 in hopes that it can help but this error still occurs. What can be done to fix this error? Thank you.

asarnow commented 1 month ago

Looks like the image names don't match between the star file and the exported particles.

SI18 commented 1 month ago

Thank you for your response! Could you please share what image names I need to change and how I can do that? I currently have .cs file and micrograph coordinates extracted from Relion as particles.star but I cannot seem to open .cs file and no matter what I do, I cannot convert it to .star.

asarnow commented 1 month ago

Start by converting the .cs file on its own and take a look. Then you can see if there is some mismatch in the image file names such that the ones in your old star file don't match anymore.

andreanans commented 1 week ago

You probably need to add --strip-uid to your command. Try this: csparc2star.py --strip-uid --boxsize 150 --copy-micrograph-coordinates path J26_particles_exported.cs J26_particles_exported.star