Welcome to sqclib’s documentation!

Command line utility

In addition to the python API, the library also provides a command line utility sqc. It can be used to quickly submit a single request to the SQC server and get a JSON response. To use the client, the environment variables SQC_ACCESS_KEY and SQC_SECRET_KEY must be set with your credentials.

$ sqc structure.mmcif
$ sqc structure.pdb

For more options, use the --help switch.

Python library API

This module contains the client used for communicating with the SQC validation server.

class sqclib.client.SQCClient(access_key: str, secret_key: str, url: str = 'sqc-minio.dyn.cloud.e-infra.cz', secure=True)

Client used for communication with the SQC server.

Parameters
  • access_key (str) – Access key provided by SQC administrators.

  • secret_key (str) – Secret key provided by SQC administrators.

  • url (str, optional) – URL of the minio server. Public MetaCentrum instance by default.

  • secure (bool, optional) – Use HTTPS for communication. True by default.

Examples

>>> client = SQCClient(
        'access_key',
        'secret_key',
        url='sqc-minio.dyn.cloud.e-infra.cz',
        secure=True,
    )
>>> client.validate('./struct.mmcif')
{'results': 'ok'}
get_result(request_id: str, timeout_s: float = 0.0) dict[str, typing.Any] | None

Get a validation result from a request ID.

Parameters
  • request_id (str) – A valid request ID returned from submit()

  • timeout_s (float, optional) – Timeout for waiting in seconds. No timeout by default.

Returns

A dictionary containing the validation results or None if the validation timed out.

Examples

>>> validation_id = client.submit('./struct.mmcif')
>>> client.get_result(validation_id, timeout_s=60)
{'results': 'ok'}
submit(path: str | pathlib.Path) str

Submit a .mmcif, .cif, .ent or .pdb file for validation asynchronously. Returns an ID of the submitted validation.

Parameters

path (str, Path) – A string or a Path object of the file to be submitted.

Returns

A request id that can be used for getting results with the get_result() function.

Examples

>>> validation_id = client.submit('./struct.mmcif')
>>> client.get_result(validation_id, timeout_s=60)
{'results': 'ok'}
validate(path: str | pathlib.Path, timeout_s: float = 0.0) dict[str, typing.Any] | None

Validate a .mmcif, ‘.cif’, .ent or .pdb file. This function blocks until the submitted file is validated. If you want to validate more structures, consider using the submit() and get_result() functions.

Parameters
  • path (str, Path) – A string or a Path object of the file to be submitted.

  • timeout_s (float, optional) – Timeout for waiting in seconds. No timeout by default.

Returns

A dictionary containing the validation results or None if the validation timed out.

Examples

>>> client.validate('./struct.mmcif', timeout_s=60)
{'results': 'ok'}
exception sqclib.client.SQCException(msg: str)

SQC exception type raised by SQCClient().

Parameters

msg (str) – Error message.

Indices and tables