Run Topaz, Gctf, Ctffind and Motioncor2 via CLI

I would like to run Topaz,Ctftfind, Gctf and Motioncor2 jobs via command line(cryosparcm cli). I know we can run the T20 jobs via command line with “cryosparc cli”. Do you have anything done in the past for the plug-ins?

As you are already familiar with running the T20 workflow via CLI, it may be helpful to generalize the relevant command patterns to other cryoSPARC job types, including invocations of the “external” programs you mentioned via the cryoSPARC CLI.
Functioning installations of the “external” programs are a prerequisite. I also recommend running instances of the “external” programs via the cryoSPARC browser interface initially. Logs and other documents (such as job.json) thus generated are valuable sources of job input and parameter definitions.
I am also posting for motivation an annotated movie import template written by a member of our team.

import os
from pymongo import MongoClient
from cryosparc_compute.client import CommandClient

mongo_url = f"mongodb://{os.getenv('CRYOSPARC_MASTER_HOSTNAME')}:{os.getenv('CRYOSPARC_MONGO_PORT')}"
db = MongoClient(mongo_url)['meteor']
cli = CommandClient(os.getenv('CRYOSPARC_MASTER_HOSTNAME'), int(os.getenv('CRYOSPARC_COMMAND_CORE_PORT')))

project_uid = 'P2'  # Substitute with your project ID
workspace_uid = 'W1'  # Substitute with your workspace ID
user_id = db.users.find_one({'emails.0.address': 'YOUR EMAIL'})['_id'] # Substitute with your cryoSPARC email address

movies_juid = cli.make_job(
  job_type='import_movies',
  project_uid=project_uid,
  workspace_uid=workspace_uid,
  user_id=user_id,
  params={ # Substitute each parameter with your dataset parameters
      'blob_paths': '/path/to/movies/*.tif',
      'gainref_path': '/path/to/movies/gainref.mrc',
      'psize_A': 0.6575,
      'accel_kv': 300,
      'cs_mm': 2.7,
      'total_dose_e_per_A2': 53})

cli.enqueue_job(project_uid, movies_juid, 'default')  # Substitute last arg with a worker lane name

After substituting the correct values for their placeholders, the script can be saved to a file, say my_import_movies.py and run with
cryosparcm call python my_import_movies.py

You may want to check out forum topics 7606 and 8249 where some questions you might encounter have already been answered.

2 Likes

Hi @wtempel, Thanks. Let me try with this.

Relevant in this context: cryosparc-tools was just released. For a motivating example, please see here.

Hi @wtempel , Thanks for sharing, I was going to test 4.x. :+1: