Metadata-Version: 2.1
Name: itaxotools-spart-parser
Version: 0.1.3
Summary: Parse and write SPART files
Author: Khushil Prajapati
Author-email: Stefanos Patmanidis <stefanpatman91@gmail.com>
Project-URL: Homepage, https://itaxotools.org/
Project-URL: Source, https://github.com/iTaxoTools/SpartParser
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Python: <4,>=3.10.2
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: setuptools_scm; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-qt; extra == "dev"
Requires-Dist: pytest-xvfb; extra == "dev"
Requires-Dist: pyinstaller; extra == "dev"
Requires-Dist: memory-profiler; extra == "dev"
Requires-Dist: matplotlib; extra == "dev"
Provides-Extra: gui
Requires-Dist: itaxotools-common; extra == "gui"
Requires-Dist: pyside6; extra == "gui"

# SpartParser

[![PyPI - Version](https://img.shields.io/pypi/v/itaxotools-spart-parser)](
    https://pypi.org/project/itaxotools-spart-parser)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/itaxotools-spart-parser)](
    https://pypi.org/project/itaxotools-spart-parser)
[![PyPI - License](https://img.shields.io/pypi/l/itaxotools-spart-parser)](
    https://pypi.org/project/itaxotools-spart-parser)
[![GitHub - Tests](https://img.shields.io/github/actions/workflow/status/iTaxoTools/itt-spart-parser/test.yml?label=tests)](
    https://github.com/iTaxoTools/SpartParser/actions/workflows/test.yml)
[![GitHub - Windows](https://img.shields.io/github/actions/workflow/status/iTaxoTools/SpartParser/windows.yml?logo=windows&logoColor=white&label=windows)](
    https://github.com/iTaxoTools/SpartParser/actions/workflows/windows.yml)

Parse, edit and write data in the SPART and SPART-XML file formats.

Includes a GUI for converting between the two formats.


## Installation

PyInstaller is available on PyPI. You can install it through `pip`:

```
pip install itaxotools-spart-parser
```

## Usage

Most of the functionality is included in the Spart class. Use the class methods
to open, edit and write data in the Spart file format.

```
from itaxotools.spart_parser import Spart
spart = Spart.fromXML("examples/spart.xml")

spartitions = spart.getSpartitions()
print(spartitions)
subsets = spart.getSpartitionSubsets(spartitions[0])
print(subsets)
individuals = spart.getSubsetIndividuals(spartitions[0], subsets[0])
print(individuals)

spart.addIndividual("new_specimen")
spart.addSubsetIndividual(spartitions[0], subsets[0], "new_specimen")
spart.addSubsetIndividual(spartitions[1], subsets[1], "new_specimen")
spart.toMatricial("converted_copy.spart")
```

For more details, refer to the [Spart class definition](src/itaxotools/spart_parser/main.py),
as well as the [scripts](scripts) and [examples](examples) folders.

# Demo GUI

A graphical interface is included for converting between SPART and SPART-XML.

Install with the optional GUI dependencies:
```
pip install itaxotools-spart-parser[gui]
SpartParserGui
```

Or download and run the Windows executable from the
[latest release](https://github.com/iTaxoTools/SpartParser/releases/latest).
