Problem in Extract particles from different Patch Motion outputs

Hi, I want to re-extract particle with different patch motion output (same dataset, but different motion correction option). Use https://discuss.cryosparc.com/t/extract-particles-from-different-patch-motion-outputs/5802 this link as reference, I use following code to in CLI mode of Cryosparc.

from cryosparc_compute.dataset import Dataset
micrographs_path = '/home/cs/P4/P4/J1016/micrographs_rigid_aligned.cs'
exported_particles_path = '/home/cs/P4/P4/exports/jobs/J1167_manual_picker_v2/J1167_particles/J1167_particles_exported.cs'
micrographs = Dataset.load(micrographs_path)
particles = Dataset.load(exported_particles_path)
mic_uid_to_path = dict(zip(micrographs['uid'], micrographs['micrograph_blob/path']))
for particle in particles.rows():
    particle['location/micrograph_path'] = mic_uid_to_path[particle['location/micrograph_uid']]
particles.to_file(exported_particles_path)

I made substitution from original one in link following instruction of Cryosparc CLI mode because of NotImplementedError

and I finally faced this error

KeyError Traceback (most recent call last)
in <cell line: 7>()
6 mic_uid_to_path = dict(zip(micrographs[‘uid’], micrographs[‘micrograph_blob/path’]))
7 for particle in particles.rows():
----> 8 particle[‘location/micrograph_path’] = mic_uid_to_path[particle[‘location/micrograph_uid’]]
9 particles.to_file(exported_particles_path)

KeyError: 13606637446806277392

Please give me any suggestions to solve this error.

Thank you for your help.

Bong Heon Kim

Welcome to the forum @qhd0207!

The CLI method you are referring to is deprecated in >=v3.2.

If you haven’t tried, I’d first try re-extracting the particles by creating a new extraction job then connect the particle coordinates and the new set of micrographs as inputs for the new extraction job.

If the first method above doesn’t work, I’d try Reassign Particles to Micrographs job to connect the particles to the new set of exposures then extract the particles using the output of the reassign job.

Best,
Kookjoo

Thanks for your kind help and welcoming.

I could successfully re-extract particle using reassign particles to micrographs job, the latter one of the strategies you said.

Thanks again

Bong Heon Kim

1 Like