# tbl2star
A tool converting DYNAMO table files(.tbl) to RELION star files(.star)
Can be used together with [Membrane_Associated_Picking](https://github.com/EuanPyle/Membrane_Associated_Picking) by [EuanPyle](https://github.com/EuanPyle), which helps to pick membrane associated particles in cryo-ET.
Based on [dynamotable](https://github.com/teamtomo/dynamotable), [starfile](https://github.com/teamtomo/starfile), [eulerangles](https://github.com/alisterburt/eulerangles) by [alisterburt](https://github.com/alisterburt).
## Features
- Convert one or more dynamo tables to one relion star file
- Transfer all particle information including position, angle, related object and tomogram and so on
- Strictly follow the relion format for coordinates importing in tomogram workflow
- Recognize the personalized naming pattern of tomograms flexibly and precisely
## Installation
You can install this package by:
```
pip install tbl2star
```
## Usage
You can refer to the instructions via:
```
tbl2star --help
```
### Preparation
The dictionary containing tilt series and dynamo tables must look like this:
```
.
├── tomograms
│ └──***[pattern]_[number1]***
│ └──***[pattern]_[number1]***.st
│ └──etc...
│ └──***[pattern]_[number2]***
│ └──***[pattern]_[number2]***.st
│ └──etc...
│ └──***[pattern]_[number3]***
│ └──***[pattern]_[number3]***.st
│ └──etc...
│ └──etc...
├── dynamotables
│ └──***.tbl
│ └──etc...
```
Pay attention to the following points:
1. The file dictionary for storing tilt series is consistent with the rules of RELION software.
2. Tomogram is distinguished by numbers in DYNAMO tables, so please ensure that the number1, number2, number3, etc. in this naming pattern are different.
3. This tool will determine the number corresponding to each tomogram based on a specific pattern defined by you, and will look up the coordinates information for each tomogram in the DYNAMO tables based on this number. Therefore, please strictly follow the naming conventions mentioned above. `***` represents any symbol, and you can input your customized pattern `[pattern]`, so that the tool can read the subsequent number `[number]`.
4. You also need to place the `.tbl` file that stores all coordinates information in the same folder. After specifying the target directory, this tool will read all `.tbl` files in the directory, so please pay attention to the correspondence with tomograms, especially the numbers corresponding to the tomogram names.
### Parameters
- `tiltseries_path`: `-ts`. Path to dictionary containing tiltseries/tomograms in RELION pattern. For example, path/to/your/tomograms.
- `dynamotable_path`: `-tbl`. Path to dictionary containing all of your dynamotables. Default is to use the current folder. All of these coordinates will be used, so please ensure that they correspond to the tomograms.
- `binning`: `-b`. Binning in DYNAMO table. Default is 1.
- `pattern`: `-p`. Pattern to recognize tomogram names. Default is TS/ts.You can input a string so that the first set of numbers after the string is recognized and used as a criterion to distinguish the tomogram. For instance, if your tomogram folder names are 'Rubisco_30_A_001_XX', 'Rubisco_30_A_002_XX'..., you can set the pattern to A so the program can recognize them as 1,2,...Note that strings and numbers must be separated by "_".
- `relionstarfile_name`: `-s`. Name of relion star file. Default is "AllCoordinates.star". For example, you can input 'GCBcoordinates.star'. Do not forget the file suffix .star.
- `relionstarfile_path`: `-sp`. Path of relion star file. Default is the current folder. For example, Path/to/your/save/dictionary.
### Example
You can just simply using:
```
tbl2star
```
```
Please enter your path to dictionary containing tiltseries/tomograms: /Users/hzvictor/tomograms
Please enter your path to dictionary containing all dynamo tables. [.]: /Users/hzvictor
Binning in DYNAMO table [1]: 6
Pattern to recognize tomogram names: ts
Please enter the name of relion star file: Allcoordinates.star
Please enter the save path of relion star file: /Users/hzvictor/test
/Users/hzvictor/GCB_004_object_1.tbl has been read
/Users/hzvictor/GCB_003_object_2.tbl has been read
rlnTomoName rlnTomoParticleId rlnTomoManifoldIndex ... rlnAnglePsi rlnClassNumber rlnRandomSubset
0 GCB_ts_003 1 2 ... -135.000 1 1
1 GCB_ts_003 2 2 ... 153.435 1 1
2 GCB_ts_003 3 2 ... 135.000 1 2
3 GCB_ts_003 4 2 ... 141.340 1 2
4 GCB_ts_003 5 2 ... -90.000 1 2
... ... ... ... ... ... ... ...
5826 GCB_ts_004 11658 1 ... 168.690 1 1
5827 GCB_ts_004 11659 1 ... 45.000 1 1
5828 GCB_ts_004 11660 1 ... 0.000 1 1
5829 GCB_ts_004 11661 1 ... 161.570 1 2
5830 GCB_ts_004 11662 1 ... -26.565 1 2
[11662 rows x 14 columns]
Saving relion .star file Allcoordinates.star to /Users/hzvictor/test/ ...
```
Or you can input:
```
tbl2star -ts /Users/hzvictor/tomograms -tbl /Users/hzvictor -b 6 -p ts -s Allcoordinates.star -sp /Users/hzvictor/test
```
## License
The project is released under the BSD 3-Clause License
Raw data
{
"_id": null,
"home_page": "https://github.com/ZhenHuangLab/tbl2star.git",
"name": "tbl2star",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4.0",
"maintainer_email": "",
"keywords": "",
"author": "Zhen Huang",
"author_email": "hzvictor@zju.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/65/e1/584ace60969f738d43650f837f56894b8987fec3bdf3305050fde76652b3/tbl2star-1.0.1.tar.gz",
"platform": null,
"description": "# tbl2star\n\n\n\nA tool converting DYNAMO table files(.tbl) to RELION star files(.star)\n\n\n\nCan be used together with [Membrane_Associated_Picking](https://github.com/EuanPyle/Membrane_Associated_Picking) by [EuanPyle](https://github.com/EuanPyle), which helps to pick membrane associated particles in cryo-ET.\n\n\n\nBased on [dynamotable](https://github.com/teamtomo/dynamotable), [starfile](https://github.com/teamtomo/starfile), [eulerangles](https://github.com/alisterburt/eulerangles) by [alisterburt](https://github.com/alisterburt).\n\n\n\n## Features\n\n\n\n- Convert one or more dynamo tables to one relion star file\n- Transfer all particle information including position, angle, related object and tomogram and so on\n- Strictly follow the relion format for coordinates importing in tomogram workflow\n- Recognize the personalized naming pattern of tomograms flexibly and precisely\n\n\n\n## Installation\n\n\n\nYou can install this package by:\n\n```\npip install tbl2star\n```\n\n\n\n## Usage\n\n\n\nYou can refer to the instructions via:\n\n```\ntbl2star --help\n```\n\n\n\n### Preparation\n\nThe dictionary containing tilt series and dynamo tables must look like this:\n\n```\n.\n\u251c\u2500\u2500 tomograms\n\u2502 \u2514\u2500\u2500***[pattern]_[number1]***\n\u2502 \u2514\u2500\u2500***[pattern]_[number1]***.st\n\u2502 \u2514\u2500\u2500etc...\n\u2502 \u2514\u2500\u2500***[pattern]_[number2]***\n\u2502 \u2514\u2500\u2500***[pattern]_[number2]***.st\n\u2502 \u2514\u2500\u2500etc...\n\u2502 \u2514\u2500\u2500***[pattern]_[number3]***\n\u2502 \u2514\u2500\u2500***[pattern]_[number3]***.st\n\u2502 \u2514\u2500\u2500etc...\n\u2502 \u2514\u2500\u2500etc...\n\u251c\u2500\u2500 dynamotables\n\u2502 \u2514\u2500\u2500***.tbl\n\u2502 \u2514\u2500\u2500etc...\n```\n\nPay attention to the following points:\n\n1. The file dictionary for storing tilt series is consistent with the rules of RELION software.\n2. Tomogram is distinguished by numbers in DYNAMO tables, so please ensure that the number1, number2, number3, etc. in this naming pattern are different.\n3. This tool will determine the number corresponding to each tomogram based on a specific pattern defined by you, and will look up the coordinates information for each tomogram in the DYNAMO tables based on this number. Therefore, please strictly follow the naming conventions mentioned above. `***` represents any symbol, and you can input your customized pattern `[pattern]`, so that the tool can read the subsequent number `[number]`.\n4. You also need to place the `.tbl` file that stores all coordinates information in the same folder. After specifying the target directory, this tool will read all `.tbl` files in the directory, so please pay attention to the correspondence with tomograms, especially the numbers corresponding to the tomogram names.\n\n\n\n### Parameters\n\n- `tiltseries_path`: `-ts`. Path to dictionary containing tiltseries/tomograms in RELION pattern. For example, path/to/your/tomograms.\n- `dynamotable_path`: `-tbl`. Path to dictionary containing all of your dynamotables. Default is to use the current folder. All of these coordinates will be used, so please ensure that they correspond to the tomograms.\n- `binning`: `-b`. Binning in DYNAMO table. Default is 1.\n- `pattern`: `-p`. Pattern to recognize tomogram names. Default is TS/ts.You can input a string so that the first set of numbers after the string is recognized and used as a criterion to distinguish the tomogram. For instance, if your tomogram folder names are 'Rubisco_30_A_001_XX', 'Rubisco_30_A_002_XX'..., you can set the pattern to A so the program can recognize them as 1,2,...Note that strings and numbers must be separated by \"_\".\n- `relionstarfile_name`: `-s`. Name of relion star file. Default is \"AllCoordinates.star\". For example, you can input 'GCBcoordinates.star'. Do not forget the file suffix .star.\n- `relionstarfile_path`: `-sp`. Path of relion star file. Default is the current folder. For example, Path/to/your/save/dictionary.\n\n\n\n### Example\n\nYou can just simply using:\n\n```\ntbl2star\n```\n\n```\nPlease enter your path to dictionary containing tiltseries/tomograms: /Users/hzvictor/tomograms\nPlease enter your path to dictionary containing all dynamo tables. [.]: /Users/hzvictor\nBinning in DYNAMO table [1]: 6\nPattern to recognize tomogram names: ts\nPlease enter the name of relion star file: Allcoordinates.star\nPlease enter the save path of relion star file: /Users/hzvictor/test\n/Users/hzvictor/GCB_004_object_1.tbl has been read\n/Users/hzvictor/GCB_003_object_2.tbl has been read\n rlnTomoName rlnTomoParticleId rlnTomoManifoldIndex ... rlnAnglePsi rlnClassNumber rlnRandomSubset\n0 GCB_ts_003 1 2 ... -135.000 1 1\n1 GCB_ts_003 2 2 ... 153.435 1 1\n2 GCB_ts_003 3 2 ... 135.000 1 2\n3 GCB_ts_003 4 2 ... 141.340 1 2\n4 GCB_ts_003 5 2 ... -90.000 1 2\n... ... ... ... ... ... ... ...\n5826 GCB_ts_004 11658 1 ... 168.690 1 1\n5827 GCB_ts_004 11659 1 ... 45.000 1 1\n5828 GCB_ts_004 11660 1 ... 0.000 1 1\n5829 GCB_ts_004 11661 1 ... 161.570 1 2\n5830 GCB_ts_004 11662 1 ... -26.565 1 2\n\n[11662 rows x 14 columns]\nSaving relion .star file Allcoordinates.star to /Users/hzvictor/test/ ...\n```\n\nOr you can input:\n\n```\ntbl2star -ts /Users/hzvictor/tomograms -tbl /Users/hzvictor -b 6 -p ts -s Allcoordinates.star -sp /Users/hzvictor/test\n```\n\n\n\n## License\n\nThe project is released under the BSD 3-Clause License\n",
"bugtrack_url": null,
"license": "",
"summary": "A tool converting DYNAMO table files(.tbl) to RELION star files(.star)",
"version": "1.0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "522de1b95f114d363223950d30840bce0da54f63c8a98a2b080eed7e1e4e3e52",
"md5": "7058da4c719394334091606b0fbf3819",
"sha256": "99b2303f1dde1715b7470a4bbafe17a663b15d9b8a48c5d739bb357eee50e3a8"
},
"downloads": -1,
"filename": "tbl2star-1.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7058da4c719394334091606b0fbf3819",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4.0",
"size": 6638,
"upload_time": "2023-04-04T17:39:16",
"upload_time_iso_8601": "2023-04-04T17:39:16.074093Z",
"url": "https://files.pythonhosted.org/packages/52/2d/e1b95f114d363223950d30840bce0da54f63c8a98a2b080eed7e1e4e3e52/tbl2star-1.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "65e1584ace60969f738d43650f837f56894b8987fec3bdf3305050fde76652b3",
"md5": "30d29320cca4f3d34aa00f83b4c4b2dd",
"sha256": "bf8bb2a2d9dc949bf777cb362460c348be943bd065a348ff580c9f3b3ab33856"
},
"downloads": -1,
"filename": "tbl2star-1.0.1.tar.gz",
"has_sig": false,
"md5_digest": "30d29320cca4f3d34aa00f83b4c4b2dd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4.0",
"size": 5231,
"upload_time": "2023-04-04T17:39:17",
"upload_time_iso_8601": "2023-04-04T17:39:17.562892Z",
"url": "https://files.pythonhosted.org/packages/65/e1/584ace60969f738d43650f837f56894b8987fec3bdf3305050fde76652b3/tbl2star-1.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-04 17:39:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "ZhenHuangLab",
"github_project": "tbl2star.git",
"lcname": "tbl2star"
}