Skip to main content

cryohub

cryohub is a library for reading and writing Cryo-ET data based on the cryotypes specification.

Installation

pip install cryohub

Usage

cryohub provides granular I/O functions such as read_star and read_mrc, which will all return objects following the cryotypes specification.

from cryohub.reading import read_star
poseset = read_star('/path/to/file.star')

A higher level function called read adds some magic to the IO procedure, guessing file formats and returning a list of cryotypes.

from cryohub import read
data = read('/path/to/file.star', '/path/to/directotry/', lazy=False, name_regex=r'tomo_\d+')

See the help for each function for more info.

Similarly to the read_* functions, cryohub provides a series of write_* functions, and a magic higher level write funtion.

from cryohub import write
write([poseset1, poseset2], 'particles.tbl')

From the command line

cryohub can be used as a conversion tool between all available formats:

cryohub convert input_file.star output_file.tbl

If instead you just need to quickly inspect your data but want something more powerful than just reading text files or headers, this command will land you in an ipython shell with the loaded data collected in a list called data:

cryohub view path/to/files/* /other/path/to/file.star
print(data[0])

Features

Currently cryohub is capable of reading images in the following formats:

  • .mrc (and the .mrcs, .st, .map, .rec variants) = .tif(f)
  • Dynamo .em
  • EMAN2 .hdf

and particle data in the following formats:

  • Relion .star
  • Dynamo .tbl
  • Cryolo .cbox and .box
  • EMAN2 .json1

Writer functions currently exist for:

  • .mrc
  • EMAN2 .hdf
  • Dynamo .em
  • Relion .star
  • Dynamo .tbl

Image data

When possible (and unless disabled), cryohub loads images lazily using dask. The resulting objects can be treated as normal numpy array, except one needs to call array.compute() to apply any pending operations and return the result.

Contributing

Contributions are more than welcome! If there is a file format that you wish were supported in reading or writing, simply open an issue about it pointing to the specification. Alternatively, feel free to open a PR with your proposed implementation; you can look at the existing functions for inspiration.

  1. EMAN2 uses the center of the tomogram as the origin for particle coordinates. This means that when opening a tomogram, you'll have to recenter the particles based on its dimensions. To do so automatically, you can use the center_on_tomo argument to provide the hdf file with the tomogram you want to use. ↩

Metadata

Release files for cryohub 0.6.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cryohub 0.6.4
File Size Uploaded
cryohub-0.6.4.tar.gz 23.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cryohub 0.6.4
File Interpreter ABI Platform
cryohub-0.6.4-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 53.9 kB

Release files / cryohub-0.6.4.tar.gz

Download URL cryohub-0.6.4.tar.gz
Size 23.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f3630fee37b493e55948b35d017d5a9d10ca80d198e63cf6688df285c058a358
BLAKE2b-256 checksum
How to use checksums
f54289dfa4a24e89ef147d59b2d02b61dfda1c2ff02553f3b537d22a45a43c6c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / cryohub-0.6.4-py2.py3-none-any.whl

Download URL cryohub-0.6.4-py2.py3-none-any.whl
Size 30.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
7130ed139ced86ca35d4fb00907e860aee22361f7d1e2a363da91bacea096c1d
BLAKE2b-256 checksum
How to use checksums
bd2174cffec913b0f2064b8e194691f4c320e76d9e99b73968469cb50a0940f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

0.6.4 This release

2 release files

0.6.3

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page