How to batch submit 2D classification jobs

Hi, everyone! Does anyone know how to batch submit 2D classification jobs in CryoSAPAC? For example, I split a large particles dataset in several small datasets followed by creating 2D cls jobs for them. How to batch submit or create jobs in the GUI ?
Thanks very much!

How many small particle sets do you need 2D classified? Is the GUI constraint in your question “negotiable”?

Hi, wtempel! The large dataset contains 10 million particles which should be splited into 0.5 million per copy. I think other methods will be ok if works. Thanks!

This is a use case for cryosparc-tools.
You may:

  1. ensure prerequisites and install cryosparc-tools in a conda environment
  2. edit this script
#! /usr/bin/env python

# Requires: project and job ids of an existing Particle Set Tools job
# implementing the split of a particle set, specifying the split size

# Will queue 2d classification of subsets from splitting
# (including classification of the remainder)

from cryosparc.tools import CryoSPARC

# Instance info. Must edit.
license_id = "681437fb-d6ae-47b8-870b-b530c587da94"
master_host = "cryosparc.your.domain"
base_port = 39000
email = "your@email.address" # you usually user for login to the CryoSPARC UI
password = "toP_s4cret"
worker_lane_name = "default" # from "cryosparcm cli 'get_scheduler_lanes()'"

# Job settings. Must edit.
project_uid = "P147"
particle_set_tools_uid = "J33" # where you have already split your set

# Change job parameters below if needed

cs = CryoSPARC(license=license_id,
               host=master_host,
               base_port=base_port,
               email=email,
               password=password)

splits = {split.get("group_name") for split in cs.cli.get_job(
          project_uid, particle_set_tools_uid).get("output_results")}              

# 2D classification jobs will be created here
workspace = cs.create_workspace(project_uid, "many 2D class jobs")

for split in splits:
    class_2d_job = workspace.create_job("class_2D")
    class_2d_job.connect("particles", particle_set_tools_uid, split)
    class_2d_job.set_param("compute_use_ssd", "False")
    class_2d_job.set_param("class2D_K", 50)
    class_2d_job.queue(worker_lane_name)
  1. Save the script in a file, say many_2d.py
  2. activate the conda environment that you created for the installation of cryosparc-tools and run
    python many_2d.py
4 Likes