Skip to main content

Read and write Dynamo table files as pandas dataframes

Project description

dynamotable

Build Status PyPI version PyPI pyversions

dynamotable is a Python package to facilitate reading and writing of table files from the Dynamo subtomogram averaging package

Features

  • Read table files created by Dynamo as pandas DataFrames
  • Write table files compatible with Dynamo subtomogram averaging from minimal data
  • Supports reading and writing of table map files with tables to keep track of tomogram files
  • clean API

Installation

Installation is available directly from the Python package index

pip install dynamotable

Usage

Reading table files

Simple

import dynamotable
df = dynamotable.read('t_double.tbl')
>>> df = dynamotable.read('t_double.tbl')
>>> df
     tag  aligned_value  averaged_value        dx  ...  npar  undefined1  ref  sref
0      1              1               0  2.517800  ...     0           0    0     5
1      2              1               0  3.246300  ...     0           0    0     4
2      3              1               0 -2.984100  ...     0           0    0     4
3      4              1               0  3.307000  ...     0           0    0     4
4      5              1               0  1.058900  ...     0           0    0     2
..   ...            ...             ...       ...  ...   ...         ...  ...   ...
295  296              1               0 -2.656600  ...     0           0    0     5
296  297              1               0  3.829400  ...     0           0    0     1
297  298              1               0  1.701600  ...     0           0    0     5
298  299              1               0  0.003773  ...     0           0    0     2
299  300              1               0 -0.231290  ...     0           0    0     3

[300 rows x 35 columns]

With table map file

table map files are two column text files containing the tomogram index (found in column 20 of a table file) and the file path of the tomogram.

>>> df = dynamotable.read('t_complex.tbl', 'tmap_complex.doc')
>>> df
>>> df
        tag  aligned_value  ...  eig1                   tomo_file
0         2              1  ...     0  tomo_ts01.mrc_15.00Apx.mrc
1         4              1  ...     0  tomo_ts01.mrc_15.00Apx.mrc
2         6              1  ...     0  tomo_ts01.mrc_15.00Apx.mrc
3         8              1  ...     0  tomo_ts01.mrc_15.00Apx.mrc
4        10              1  ...     0  tomo_ts01.mrc_15.00Apx.mrc
     ...            ...  ...   ...                         ...
8737  18064              1  ...     0  tomo_ts99.mrc_15.00Apx.mrc
8738  18066              1  ...     0  tomo_ts99.mrc_15.00Apx.mrc
8739  18068              1  ...     0  tomo_ts99.mrc_15.00Apx.mrc
8740  18070              1  ...     0  tomo_ts99.mrc_15.00Apx.mrc
8741  18072              1  ...     0  tomo_ts99.mrc_15.00Apx.mrc

[8742 rows x 42 columns]

An extra column called tomo_file is added to the dataframe which contains the filepath of the tomogram you wish the particle to be linked to

Writing table files

Table files are written with dynamotable.write

>>> dynamotable.write(df, 'table_out.tbl')

Note that

  • if tag is not a column in the dataframet then tags will be generated automatically
  • if tomo_file is a column in the dataframe then a corresponding table map file will be generated
  • if tomo_file is provided but no tomogram table indices are present these will be generated automatically
  • if the aligned_value column is not present it will be set to 1 to mark particles for alignment in subtomogram averaging projects

License

The project is released under the BSD 3-Clause License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dynamotable-0.3.0.tar.gz (359.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dynamotable-0.3.0-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file dynamotable-0.3.0.tar.gz.

File metadata

  • Download URL: dynamotable-0.3.0.tar.gz
  • Upload date:
  • Size: 359.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dynamotable-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e88b9419404f3ca32537b02a2a2b25e57127d36b11180937bfac702a7bac9f58
MD5 b979257281bfca92d5421f12b1e5e523
BLAKE2b-256 7f0832caf193f06ee56f6fe5a9b51b7741cbe1dba21f46fa6d52aed44738a9af

See more details on using hashes here.

Provenance

The following attestation bundles were made for dynamotable-0.3.0.tar.gz:

Publisher: ci.yml on teamtomo/dynamotable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dynamotable-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dynamotable-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dynamotable-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 378c2536e09594d06ca7a0d6b48cb78e3af480d5e5a96bcfdd8b83360c808ba0
MD5 d6166fa160e823408dcb3c6416bc59a4
BLAKE2b-256 d122661c0e01f4fc96f48f28699c509aaf0a1c15ab31c3aee838fa8fdc530d2e

See more details on using hashes here.

Provenance

The following attestation bundles were made for dynamotable-0.3.0-py3-none-any.whl:

Publisher: ci.yml on teamtomo/dynamotable

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page