Csparc2star error removing path uid

Hi All,

I’m trying to convert particles extracted in cryosparc using the updated csparc2star.py and I’m running into an error that looks related to the new strip_path_uid function. The command and error are below. Does anyone have suggestions?


./csparc2star.py --swapxy P23_J45_particles_exported.cs from_cs.star

  File "./csparc2star.py", line 128, in <module>
  File "./csparc2star.py", line 61, in main
    df = star.strip_path_uids(df, inplace=True, count=args.strip_uid)
  File "/home/XXX/pyem/pyem/pyem/star.py", line 699, in strip_path_uids
    df[Relion.MICROGRAPH_NAME] = df[Relion.MICROGRAPH_NAME].str.replace(pat, "", regex=True, count=count)
  File "/home/XXX/pyem/lib/python3.8/site-packages/pandas/core/strings/accessor.py", line 116, in wrapper
    return func(self, *args, **kwargs)
TypeError: replace() got an unexpected keyword argument 'count'
1 Like

Hi Ryan,

I have been getting the exact same error since yesterday. I am trying to convert particles that I refined using the newest version of Cryosparc (3.3.1). I can still, however, convert particles processed using previous versions (e.g 3.2.x). Nothing I’ve tried has worked so an update (pyem) may be required to fix?


Hi Alex,

This error was from the updated version of pyem that should be able to handle the numbers in the paths. It’s not really a solution but I was able to work around this by using the older version of pyem to get a converted file containing UIDs and then use a search and replace script to remove those.

Update: here’s my script incase it’s helpful.



I’m also getting this error for particles extracted and refined in the newest version of cryosparc (before patch) with updated pyem.

I’ve been breaking things again. Sorry. Hopefully all the current difficulties (UIDs, etc) will be resolved in the next few days.


Hi Daniel,
Any news on the Csparc2star error?

@gptomaleri Yes, it’s fixed. And the UIDs are being stripped as well. In the future I will add the ability to specify a certain depth of UIDs to keep (since more UIDs are added with each export/import round), for now they will all be removed if --strip-uid is passed.

For --copy-micrograph-coordinates the stripped UIDs are always tried if it fails on the attempt with the raw path names.