{"id":21310438,"url":"https://github.com/ocbe-uio/trajpy","last_synced_at":"2025-06-21T06:06:47.287Z","repository":{"id":37867867,"uuid":"194252287","full_name":"ocbe-uio/trajpy","owner":"ocbe-uio","description":"Trajpy - empowering feature engineering for trajectory analysis across domains.","archived":false,"fork":false,"pushed_at":"2024-03-23T20:59:39.000Z","size":1580,"stargazers_count":8,"open_issues_count":11,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-01T06:17:08.715Z","etag":null,"topics":["cell-migration","diffusion","python-package","repeated-measurements","time-series","trajectory-analysis"],"latest_commit_sha":null,"homepage":"https://ocbe-uio.github.io/trajpy/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ocbe-uio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-06-28T10:06:57.000Z","updated_at":"2025-03-19T16:48:42.000Z","dependencies_parsed_at":"2024-11-21T20:16:30.639Z","dependency_job_id":null,"html_url":"https://github.com/ocbe-uio/trajpy","commit_stats":{"total_commits":354,"total_committers":7,"mean_commits":50.57142857142857,"dds":0.4548022598870056,"last_synced_commit":"fc609a4fc8e2f5a3d84f8f5151de611625f160a7"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ocbe-uio/trajpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocbe-uio%2Ftrajpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocbe-uio%2Ftrajpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocbe-uio%2Ftrajpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocbe-uio%2Ftrajpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ocbe-uio","download_url":"https://codeload.github.com/ocbe-uio/trajpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ocbe-uio%2Ftrajpy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261073405,"owners_count":23105643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cell-migration","diffusion","python-package","repeated-measurements","time-series","trajectory-analysis"],"created_at":"2024-11-21T17:13:33.825Z","updated_at":"2025-06-21T06:06:42.272Z","avatar_url":"https://github.com/ocbe-uio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![PyPI version](https://badge.fury.io/py/trajpy.svg)](https://badge.fury.io/py/trajpy)\n![Build Status](https://github.com/ocbe-uio/trajpy/actions/workflows/python-app.yml/badge.svg)\n[![Documentation Status](https://readthedocs.org/projects/trajpy/badge/?version=latest)](https://trajpy.readthedocs.io/en/latest/?badge=latest)\n[![Python3](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/) \n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![DOI](https://zenodo.org/badge/194252287.svg)](https://zenodo.org/badge/latestdoi/194252287)\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ocbe-uio/trajpy/master?labpath=%2Fexamples%2Fclinical_data_analysis_tutorial.ipynb)\n\n# TrajPy\n\nTrajectory analysis is a challenging task and fundamental for\nunderstanding the movement of living organisms in various scales.\n\nWe propose TrajPy as an easy pythonic solution to be applied in studies that\ndemand trajectory analysis. With a friendly graphic user interface (GUI) it requires little knowledge of computing\nand physics to be used by nonspecialists.\n\nTrajPy is composed of three main units of code:\n\n- Basic usage:\n  - The GUI: it is where you interact with trajpy and the only thing you need to know to start using it\n- Advanced  \n  - trajpy.py: it's the heart of trajpy, it computes the **Features** for characterizing the trajectories \n  - traj_generator.py: a **trajectory generator** that can be used to build a dataset for trajectory classification\n\n\nOur dataset and Machine Learning (ML) model are available for use, as well\nthe generator for building your own database.\n\n## Installation\n\n\nWe have the package hosted at PyPi, for installing use the command line: \n```bash\npip3 install trajpy\n```\nIf you want to test the development version, clone the repository at your local directory from your terminal:\n```bash\ngit clone https://github.com/ocbe-uio/trajpy\n```\nThen run the setup.py for installing \n```bash\npython setup.py --install\n```\n\n## Basic Usage Example\n\n### Using the Graphic User Interface (GUI)\n\nOpen a terminal and execute the line bellow\n```bash\npython3 -m trajpy.gui\n```\n\n1 - You can open one file at time clicking on `Open file...` or process several files in the same director with `Open directory...`\n\n2 - Select the features to be computed by ticking the boxes\n\n3 - Click on `Compute`\n\n4 - Select the directory and file name where the results will be stored\n\nThe processing is ready when the following message appears in the text box located at the bottom of the GUI:\n\n`Results saved to /path/to/results/output.csv`\n\n### File formats\n\n#### Comma separated values (CSV)\nCurrently trajpy support CSV files organized in 4 columns: time `t` and 3 spatial coordinates `x`, `y`, `z`:\n\n|t|x|y|z|\n|---|---|---|---|\n| 1.00 | 10.00 | 50.00 | 50.00\n| 2.00 | 11.00 | 50.00 | 50.00\n| 3.00 | 11.00 | 50.00 | 50.00\n| 4.00 | 12.00 | 50.00 | 50.00\n| 5.00 | 12.00 | 50.00 | 50.00\n| 6.00 | 13.00 | 50.00 | 50.00\n\nSee the [sample file](https://github.com/ocbe-uio/trajpy/blob/a370e49444ea845becb573fd5cc835b5c899c7dc/data/samples/sample.csv) provided in this repository as example.\n\n#### LAMMPS YAML dump format\n\nLAMMPS YAML files are defined with the following structure:\n```yaml\n    ---\n    time: 0.0\n    natoms: 100\n    keywords: [id, type, x, y, z, vx, vy, vz, fx, fy, fz]\n    data:\n    - [1, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -nan, -nan, -nan]\n    - [2, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -nan, -nan, -nan]\n    - [3, 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -nan, -nan, -nan]\n    ...\n```\nWe provide support for parsing this type of data files with the function [`parse_lammps_dump_yaml()`](https://github.com/ocbe-uio/trajpy/blob/8381bedfc3f0d696072af1d66f08af497eb0cced/trajpy/auxiliar_functions.py#L5).\n\n\n### Scripting\n\nFirst we import the package \n```python\nimport trajpy.trajpy as tj\n```\nThen we load the data sample provided in this repository, we pass the arguments `skip_header=1`\n to skip the first line of the file and `delimiter=','` to specify the file format\n``` python\nfilename = 'data/samples/sample.csv'\nr = tj.Trajectory(filename,\n                  skip_header=1,\n                  delimiter=',')\n```\nFinally, for computing a set of features for trajectory analysis we can simple run the function `r.compute_features()`\n```python\n    r.compute_features()\n```\nThe features will be stored in the object `r`, for instance:\n```python\n  \u003e\u003e\u003e r.asymmetry\n  \u003e\u003e\u003e 0.5782095322093505\n  \u003e\u003e\u003e r.fractal_dimension\n  \u003e\u003e\u003e 1.04\n  \u003e\u003e\u003e r.efficiency\n  \u003e\u003e\u003e 0.29363293632936327\n  \u003e\u003e\u003e r.gyration_radius\n  \u003e\u003e\u003e array([[30.40512689,  5.82735002,  0.96782673],\n  \u003e\u003e\u003e     [ 5.82735002,  2.18625318,  0.27296851],\n  \u003e\u003e\u003e     [ 0.96782673,  0.27296851,  2.41663589]])\n```\n\nFor more examples please consult the extended documentation: https://trajpy.readthedocs.io/\n\n## Requirements\n\n- numpy \u003e= 1.14.3\n- scipy \u003e= 1.7.1\n- ttkthemes \u003e= 2.4.0\n- Pillow \u003e= 8.1.0\n- PyYAML \u003e= 5.3.1\n\n\n## How to cite?\nIf using TrajPy for academic work, please cite our [methodological paper](https://doi.org/10.1093/bioadv/vbae026) and [Software DOI](https://doi.org/10.5281/zenodo.3978699):\n\n```latex\n@article{10.1093/bioadv/vbae026,\n    author = {Moreira-Soares, Maurício and Mossmann, Eduardo and Travasso, Rui D M and Bordin, José Rafael},\n    title = \"{TrajPy: empowering feature engineering for trajectory analysis across domains}\",\n    journal = {Bioinformatics Advances},\n    volume = {4},\n    number = {1},\n    pages = {vbae026},\n    year = {2024},\n    month = {02},\n    issn = {2635-0041},\n    doi = {10.1093/bioadv/vbae026},\n    url = {https://doi.org/10.1093/bioadv/vbae026},\n    eprint = {https://academic.oup.com/bioinformaticsadvances/article-pdf/4/1/vbae026/56926570/vbae026.pdf},\n}\n\n@software{mauricio_moreira_2020_3978699,\n  author       = {Mauricio Moreira and Eduardo Mossmann},\n  title        = {phydev/trajpy: TrajPy 1.3.1},\n  month        = aug,\n  year         = 2020,\n  publisher    = {Zenodo},\n  version      = {1.3.1},\n  doi          = {10.5281/zenodo.3978699},\n  url          = {https://doi.org/10.5281/zenodo.3978699}\n}\n```\n\n## Contribution\nThis is an open source project, and all contributions are welcome. Feel free to open an Issue, a Pull Request, or to e-mail us.\n\n## Publications using trajpy\n\nMoreira-Soares M., Mossmann E., Travasso R. D. M, Bordin J. R., [TrajPy: empowering feature engineering for trajectory analysis across domains](https://doi.org/10.1093/bioadv/vbae026), Bioinformatics Advances, Volume 4, Issue 1, 2024, vbae026, doi:10.1093/bioadv/vbae026\n\nEduardo Henrique Mossmann. [A physics based feature engineering framework for trajectory analysis](https://sucupira.capes.gov.br/sucupira/public/consultas/coleta/trabalhoConclusao/viewTrabalhoConclusao.jsf?popup=true\u0026id_trabalho=11667233#). MSc dissertation. Federal University of Pelotas 2022,  Brazil.\n\n Simões, RF, Pino, R, Moreira-Soares, M, et al. [Quantitative Analysis of Neuronal Mitochondrial Movement Reveals Patterns Resulting from Neurotoxicity of Rotenone and 6-Hydroxydopamine.](https://faseb.onlinelibrary.wiley.com/doi/10.1096/fj.202100899R) FASEB J. 2021; 35:e22024. doi:10.1096/fj.202100899R\n\nMoreira-Soares, M., Pinto-Cunha, S.,  Bordin, J. R., Travasso, R. D. M. *[Adhesion modulates cell morphology and migration within dense fibrous networks](https://www.biorxiv.org/content/10.1101/838995v1)*.  https://doi.org/10.1088/1361-648X/ab7c17\n\n## References\nArkin, H. and Janke, W. 2013. Gyration tensor based analysis of the shapes of polymer chains in an attractive spherical cage. J Chem Phys 138, 054904.\n\nWagner, T., Kroll, A., Haramagatti, C.R., Lipinski, H.G. and Wiemann, M. 2017. Classification and Segmentation of Nanoparticle Diffusion Trajectories in Cellular Micro Environments. PLoS One 12, e0170165.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focbe-uio%2Ftrajpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Focbe-uio%2Ftrajpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Focbe-uio%2Ftrajpy/lists"}