Package: trajpy
TrajPyTrajectory analysis is a challenging task and fundamental for
understanding the movement of living organisms in various scales.We propose TrajPy as an easy pythonic solution to be applied in studies that
demand trajectory analysis. With a friendly graphic user interface (GUI) it requires little knowledge of computing
and physics to be used by nonspecialists.TrajPy is composed of three main units of code:Basic usage:The GUI: it is where you interact with trajpy and the only thing you need to know to start using itAdvancedtrajpy.py: it's the heart of trajpy, it computes theFeaturesfor characterizing the trajectoriestraj_generator.py: atrajectory generatorthat can be used to build a dataset for trajectory classificationOur dataset and Machine Learning (ML) model are available for use, as well
the generator for building your own database.InstallationWe have the package hosted at PyPi, for installing use the command line:pip3installtrajpyIf you want to test the development version, clone the repository at your local directory from your terminal:gitclonehttps://github.com/ocbe-uio/trajpyThen run the setup.py for installingpythonsetup.py--installBasic Usage ExampleUsing the Graphic User Interface (GUI)Open a terminal and execute the line bellowpython3-mtrajpy.gui1 - You can open one file at time clicking onOpen file...or process several files in the same director withOpen directory...2 - Select the features to be computed by ticking the boxes3 - Click onCompute4 - Select the directory and file name where the results will be storedThe processing is ready when the following message appears in the text box located at the bottom of the GUI:Results saved to /path/to/results/output.csvFile formatsComma separated values (CSV)Currently trajpy support CSV files organized in 4 columns: timetand 3 spatial coordinatesx,y,z:txyz1.0010.0050.0050.002.0011.0050.0050.003.0011.0050.0050.004.0012.0050.0050.005.0012.0050.0050.006.0013.0050.0050.00See thesample fileprovided in this repository as example.LAMMPS YAML dump formatLAMMPS YAML files are defined with the following structure:---time:0.0natoms:100keywords:[id,type,x,y,z,vx,vy,vz,fx,fy,fz]data:-[1,1,0.0,0.0,0.0,0.0,0.0,0.0,-nan,-nan,-nan]-[2,1,0.0,0.0,0.0,0.0,0.0,0.0,-nan,-nan,-nan]-[3,1,0.0,0.0,0.0,0.0,0.0,0.0,-nan,-nan,-nan]...We provide support for parsing this type of data files with the functionparse_lammps_dump_yaml().ScriptingFirst we import the packageimporttrajpy.trajpyastjThen we load the data sample provided in this repository, we pass the argumentsskip_header=1to skip the first line of the file anddelimiter=','to specify the file formatfilename='data/samples/sample.csv'r=tj.Trajectory(filename,skip_header=1,delimiter=',')Finally, for computing a set of features for trajectory analysis we can simple run the functionr.compute_features()r.compute_features()The features will be stored in the objectr, for instance:>>>r.asymmetry>>>0.5782095322093505>>>r.fractal_dimension>>>1.04>>>r.efficiency>>>0.29363293632936327>>>r.gyration_radius>>>array([[30.40512689,5.82735002,0.96782673],>>>[5.82735002,2.18625318,0.27296851],>>>[0.96782673,0.27296851,2.41663589]])For more examples please consult the extended documentation:https://trajpy.readthedocs.io/Requirementsnumpy >= 1.14.3scipy >= 1.7.1ttkthemes >= 2.4.0Pillow >= 8.1.0PyYAML >= 5.3.1CitationIf using the TrajPy package in academic work, please cite Moreira-Soares et al. (2020), in addition to the relevant methodological papers.@article{moreira2020adhesion,
  title={Adhesion modulates cell morphology and migration within dense fibrous networks},
  author={Moreira-Soares, Maur{\'\i}cio and Cunha, Susana P and Bordin, Jos{\'e}Rafael and Travasso, Rui DM},
  journal={Journal of Physics: Condensed Matter},
  volume={32},
  number={31},
  pages={314001},
  year={2020},
  publisher={IOP Publishing}}@software{mauricio_moreira_2020_3978699,
  author       ={Mauricio Moreira and Eduardo Mossmann},
  title        ={phydev/trajpy: TrajPy 1.3.1},
  month        = aug,
  year         = 2020,
  publisher    ={Zenodo},
  version      ={1.3.1},
  doi          ={10.5281/zenodo.3978699},
  url          ={https://doi.org/10.5281/zenodo.3978699}}ContributionThis is an open source project, and all contributions are welcome. Feel free to open an Issue, a Pull Request, or to e-mail us.Publications using trajpyEduardo Henrique Mossmann.A physics based feature engineering framework for trajectory analysis. MSc dissertation. Federal University of Pelotas 2022,  Brazil.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.FASEB J. 2021; 35:e22024. doi:10.1096/fj.202100899RMoreira-Soares, M., Pinto-Cunha, S.,  Bordin, J. R., Travasso, R. D. M.Adhesion modulates cell morphology and migration within dense fibrous networks.https://doi.org/10.1088/1361-648X/ab7c17ReferencesArkin, 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.Wagner, 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.