Read and write Dynamo table files as pandas dataframes
Project description
dynamotable
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
tagis not a column in the dataframet then tags will be generated automatically - if
tomo_fileis a column in the dataframe then a corresponding table map file will be generated - if
tomo_fileis provided but no tomogram table indices are present these will be generated automatically - if the
aligned_valuecolumn 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e88b9419404f3ca32537b02a2a2b25e57127d36b11180937bfac702a7bac9f58
|
|
| MD5 |
b979257281bfca92d5421f12b1e5e523
|
|
| BLAKE2b-256 |
7f0832caf193f06ee56f6fe5a9b51b7741cbe1dba21f46fa6d52aed44738a9af
|
Provenance
The following attestation bundles were made for dynamotable-0.3.0.tar.gz:
Publisher:
ci.yml on teamtomo/dynamotable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dynamotable-0.3.0.tar.gz -
Subject digest:
e88b9419404f3ca32537b02a2a2b25e57127d36b11180937bfac702a7bac9f58 - Sigstore transparency entry: 1210086345
- Sigstore integration time:
-
Permalink:
teamtomo/dynamotable@f4198fd1372a1c6f051d3bd269d49d95b57f2924 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f4198fd1372a1c6f051d3bd269d49d95b57f2924 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
378c2536e09594d06ca7a0d6b48cb78e3af480d5e5a96bcfdd8b83360c808ba0
|
|
| MD5 |
d6166fa160e823408dcb3c6416bc59a4
|
|
| BLAKE2b-256 |
d122661c0e01f4fc96f48f28699c509aaf0a1c15ab31c3aee838fa8fdc530d2e
|
Provenance
The following attestation bundles were made for dynamotable-0.3.0-py3-none-any.whl:
Publisher:
ci.yml on teamtomo/dynamotable
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dynamotable-0.3.0-py3-none-any.whl -
Subject digest:
378c2536e09594d06ca7a0d6b48cb78e3af480d5e5a96bcfdd8b83360c808ba0 - Sigstore transparency entry: 1210086461
- Sigstore integration time:
-
Permalink:
teamtomo/dynamotable@f4198fd1372a1c6f051d3bd269d49d95b57f2924 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/teamtomo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@f4198fd1372a1c6f051d3bd269d49d95b57f2924 -
Trigger Event:
push
-
Statement type: