starfile


Namestarfile JSON
Version 0.5.10 PyPI version JSON
download
home_pageNone
SummarySTAR file I/O in Python
upload_time2024-11-18 22:46:03
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # starfile
[![License](https://img.shields.io/pypi/l/starfile.svg?color=green)](https://github.com/teamtomo/starfile/raw/main/LICENSE)
[![PyPI](https://img.shields.io/pypi/v/starfile.svg?color=green)](https://pypi.org/project/starfile)
[![Python Version](https://img.shields.io/pypi/pyversions/starfile.svg?color=green)](https://python.org)
[![CI](https://github.com/teamtomo/starfile/actions/workflows/ci.yml/badge.svg)](https://github.com/teamtomo/starfile/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/teamtomo/starfile/branch/main/graph/badge.svg)](https://codecov.io/gh/teamtomo/starfile)


*starfile* is a package for reading and writing
[STAR files](https://en.wikipedia.org/wiki/Self-defining_Text_Archive_and_Retrieval) in Python.

<p align="center" width="100%">
    <img width="70%" src="https://user-images.githubusercontent.com/7307488/204108873-c2175153-fb5b-4b22-892a-0a1274616057.png"> 
</p>

*starfile* can be used interactively to inspect/explore files or in 
scripts and larger software packages to provide basic STAR file I/O functions.
Data is exposed as simple python dictionaries or
[pandas dataframes](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe).

This package was designed principally for compatibility with files generated by
[RELION](https://www3.mrc-lmb.cam.ac.uk/relion/index.php/Main_Page).

For more information on working with dataframes, please see the
[pandas docs](https://pandas.pydata.org/docs/user_guide/10min.html).

For *starfile* specific documentation, see [teamtomo.org/starfile](https://teamtomo.org/starfile)


---
# Quickstart
For the following file `particles.star` with a single data block

```txt
data_particles

loop_
_rlnCoordinateX #1
_rlnCoordinateY #2
_rlnCoordinateZ #3
_rlnAngleRot #4
_rlnAngleTilt #5
_rlnAnglePsi #6
_rlnMicrographName #7
91.798700	83.622600	203.341030	-51.740000	173.930000	32.971000	01_10.00Apx.mrc
97.635800	80.437000	203.136160	141.500000	171.760000	-134.680000	01_10.00Apx.mrc
92.415200	88.842700	210.663900	-78.750000	173.930000	87.263200	01_10.00Apx.mrc
94.607830	93.135410	205.425960	-85.215000	167.170000	85.632200	01_10.00Apx.mrc
86.187800	80.125400	204.558750	14.910000	163.260000	-16.030000	01_10.00Apx.mrc
91.824240	76.738300	203.794280	39.740000	168.410000	-57.250000	01_10.00Apx.mrc
98.253300	73.530100	203.856030	73.950000	166.380000	-84.640000	01_10.00Apx.mrc
101.303500	80.290800	194.790400	-178.878000	166.090000	73.181000	01_10.00Apx.mrc
```

Read the file

```python

import starfile

df = starfile.read('particles.star')
```

Interact with the data

```python
df['rlnCoordinateX'] += 10
df.head()
```
```txt
   rlnCoordinateX  rlnCoordinateY  rlnCoordinateZ  rlnAngleRot  rlnAngleTilt  rlnAnglePsi rlnMicrographName
0       101.79870        83.62260       203.34103      -51.740        173.93      32.9710   01_10.00Apx.mrc
1       107.63580        80.43700       203.13616      141.500        171.76    -134.6800   01_10.00Apx.mrc
2       102.41520        88.84270       210.66390      -78.750        173.93      87.2632   01_10.00Apx.mrc
3       104.60783        93.13541       205.42596      -85.215        167.17      85.6322   01_10.00Apx.mrc
4        96.18780        80.12540       204.55875       14.910        163.26     -16.0300   01_10.00Apx.mrc
```

Save the (modified) data to file

```python
starfile.write(df, 'modified_particles.star')
```

For more advanced usage please check out the examples.

---

# Installation

```shell
pip install starfile
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "starfile",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Alister Burt <alisterburt@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/49/5a/5e9f714259702a0995043acc2557e4932cf7f79dc1e761f9921e999e743c/starfile-0.5.10.tar.gz",
    "platform": null,
    "description": "# starfile\n[![License](https://img.shields.io/pypi/l/starfile.svg?color=green)](https://github.com/teamtomo/starfile/raw/main/LICENSE)\n[![PyPI](https://img.shields.io/pypi/v/starfile.svg?color=green)](https://pypi.org/project/starfile)\n[![Python Version](https://img.shields.io/pypi/pyversions/starfile.svg?color=green)](https://python.org)\n[![CI](https://github.com/teamtomo/starfile/actions/workflows/ci.yml/badge.svg)](https://github.com/teamtomo/starfile/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/teamtomo/starfile/branch/main/graph/badge.svg)](https://codecov.io/gh/teamtomo/starfile)\n\n\n*starfile* is a package for reading and writing\n[STAR files](https://en.wikipedia.org/wiki/Self-defining_Text_Archive_and_Retrieval) in Python.\n\n<p align=\"center\" width=\"100%\">\n    <img width=\"70%\" src=\"https://user-images.githubusercontent.com/7307488/204108873-c2175153-fb5b-4b22-892a-0a1274616057.png\"> \n</p>\n\n*starfile* can be used interactively to inspect/explore files or in \nscripts and larger software packages to provide basic STAR file I/O functions.\nData is exposed as simple python dictionaries or\n[pandas dataframes](https://pandas.pydata.org/docs/user_guide/dsintro.html#dataframe).\n\nThis package was designed principally for compatibility with files generated by\n[RELION](https://www3.mrc-lmb.cam.ac.uk/relion/index.php/Main_Page).\n\nFor more information on working with dataframes, please see the\n[pandas docs](https://pandas.pydata.org/docs/user_guide/10min.html).\n\nFor *starfile* specific documentation, see [teamtomo.org/starfile](https://teamtomo.org/starfile)\n\n\n---\n# Quickstart\nFor the following file `particles.star` with a single data block\n\n```txt\ndata_particles\n\nloop_\n_rlnCoordinateX #1\n_rlnCoordinateY #2\n_rlnCoordinateZ #3\n_rlnAngleRot #4\n_rlnAngleTilt #5\n_rlnAnglePsi #6\n_rlnMicrographName #7\n91.798700\t83.622600\t203.341030\t-51.740000\t173.930000\t32.971000\t01_10.00Apx.mrc\n97.635800\t80.437000\t203.136160\t141.500000\t171.760000\t-134.680000\t01_10.00Apx.mrc\n92.415200\t88.842700\t210.663900\t-78.750000\t173.930000\t87.263200\t01_10.00Apx.mrc\n94.607830\t93.135410\t205.425960\t-85.215000\t167.170000\t85.632200\t01_10.00Apx.mrc\n86.187800\t80.125400\t204.558750\t14.910000\t163.260000\t-16.030000\t01_10.00Apx.mrc\n91.824240\t76.738300\t203.794280\t39.740000\t168.410000\t-57.250000\t01_10.00Apx.mrc\n98.253300\t73.530100\t203.856030\t73.950000\t166.380000\t-84.640000\t01_10.00Apx.mrc\n101.303500\t80.290800\t194.790400\t-178.878000\t166.090000\t73.181000\t01_10.00Apx.mrc\n```\n\nRead the file\n\n```python\n\nimport starfile\n\ndf = starfile.read('particles.star')\n```\n\nInteract with the data\n\n```python\ndf['rlnCoordinateX'] += 10\ndf.head()\n```\n```txt\n   rlnCoordinateX  rlnCoordinateY  rlnCoordinateZ  rlnAngleRot  rlnAngleTilt  rlnAnglePsi rlnMicrographName\n0       101.79870        83.62260       203.34103      -51.740        173.93      32.9710   01_10.00Apx.mrc\n1       107.63580        80.43700       203.13616      141.500        171.76    -134.6800   01_10.00Apx.mrc\n2       102.41520        88.84270       210.66390      -78.750        173.93      87.2632   01_10.00Apx.mrc\n3       104.60783        93.13541       205.42596      -85.215        167.17      85.6322   01_10.00Apx.mrc\n4        96.18780        80.12540       204.55875       14.910        163.26     -16.0300   01_10.00Apx.mrc\n```\n\nSave the (modified) data to file\n\n```python\nstarfile.write(df, 'modified_particles.star')\n```\n\nFor more advanced usage please check out the examples.\n\n---\n\n# Installation\n\n```shell\npip install starfile\n```\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "STAR file I/O in Python",
    "version": "0.5.10",
    "project_urls": {
        "homepage": "https://github.com/teamtomo/starfile",
        "repository": "https://github.com/teamtomo/starfile"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2d80d9bc5d4af14fa80251992a2d2ee80be45b660b1962c7ecff6e3fda043e05",
                "md5": "5953873690b498fc611173b3ffd920c3",
                "sha256": "79f229568b2fbac677224af88872f0e284e3a091ef138c445480bf4348e209ee"
            },
            "downloads": -1,
            "filename": "starfile-0.5.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5953873690b498fc611173b3ffd920c3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10509,
            "upload_time": "2024-11-18T22:46:01",
            "upload_time_iso_8601": "2024-11-18T22:46:01.913392Z",
            "url": "https://files.pythonhosted.org/packages/2d/80/d9bc5d4af14fa80251992a2d2ee80be45b660b1962c7ecff6e3fda043e05/starfile-0.5.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "495a5e9f714259702a0995043acc2557e4932cf7f79dc1e761f9921e999e743c",
                "md5": "85e83a5f14d6ebb07e002efd00e9c513",
                "sha256": "b9065776ffe088f0d4c11d7edeaa2bf0388253f9c20e47efcad30457cf6924f0"
            },
            "downloads": -1,
            "filename": "starfile-0.5.10.tar.gz",
            "has_sig": false,
            "md5_digest": "85e83a5f14d6ebb07e002efd00e9c513",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 28329,
            "upload_time": "2024-11-18T22:46:03",
            "upload_time_iso_8601": "2024-11-18T22:46:03.987921Z",
            "url": "https://files.pythonhosted.org/packages/49/5a/5e9f714259702a0995043acc2557e4932cf7f79dc1e761f9921e999e743c/starfile-0.5.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-18 22:46:03",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "teamtomo",
    "github_project": "starfile",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "starfile"
}
        
Elapsed time: 0.52246s