cryosparcm cli reference (v5.0+)

How to use CryoSPARC's low-level command line interface to perform actions that can be performed in the UI.

Accessing the command line interface

CryoSPARC exposes nearly all actions that can be taken in the user interface through a command-line interface (CLI) for programatic operation. The CLI can be used to query information about jobs, projects, users, etc. from a CryoSPARC instance, or to take actions such as creating projects, queueing jobs, etc. Each CLI command is a Pythonarrow-up-right expression, in the format api.FUNCTION(...) or api.NAMESPACE.FUNCTION(...) , where ... is a list of function arguments.

The CLI can be called in three ways:

  1. From bash or other shells, cryosparcm cli "EXPRESSION" can be used to easily execute a single command. For example:

    cryosparcm cli "api.jobs.enqueue('P3', 'J42', lane='default')"
  2. Using CryoSPARC’s built-in interactive shell that is started by calling cryosparc icli. Once the interactive shell is started, Python code can be executed directly:

    $ cryosparcm icli
    
    Connected to cryoem0.sbi:61002
    api, db, gfs ready to use
    
    In [1]: api.jobs.enqueue('P3', 'J42', lane='default')
    
    In [2]:
  3. Using the standalone cryosparc-toolsarrow-up-right python package in a Python script, for example:

    from cryosparc.tools import CryoSPARC
    
    cs = CryoSPARC(...)
    cs.api.jobs.enqueue('P3', 'J42', lane='default')
    

Available CLI commands

The CryoSPARC CLI exposes Python functions of the form api.FUNCTION(...) or api.NAMESPACE.FUNCTION(...) , where ... is a list of function arguments.

All available NAMESPACE options (e.g., projects, jobs) and namespace-specific FUNCTION options (e.g., find_one, create) and their arguments are listed and documented in the cryosparc-tools documentation for the CryoSPARC API:

circle-exclamation

Last updated