Metadata-Version: 2.4
Name: syntviz
Version: 0.1.0
Summary: Local genome preparation and portable synteny figures
Project-URL: Homepage, https://synviz.newlineages.com/
Author: Frederik Schulz
License-Expression: LicenseRef-LBNL-Non-Commercial
License-File: LICENSE
Keywords: bioinformatics,genome comparison,jupyter,synteny,visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.11
Requires-Dist: biopython<2,>=1.86
Requires-Dist: pydantic<3,>=2.12
Description-Content-Type: text/markdown

# Syntviz

Syntviz prepares genome comparisons locally and draws portable synteny figures:
gene neighborhoods, protein links shaded by identity, repeat arms, chromosome
comparisons, circular maps and metadata tracks. A session file holds the
evidence and the figure state; the same session opens in a notebook, in the
command line renderer and in the [web viewer](https://synviz.newlineages.com/).

## Install

```bash
pip install syntviz
```

The package needs Python 3.11 or later. The interactive notebook figure needs
only Python; without Node.js the notebook skips its static SVG preview.
Validation, edits and SVG, PNG or PDF export run the bundled renderer through
Node.js 22.12 or later, which must be on `PATH`. Sequence searches
(MMseqs2, minimap2) and gene calling (Pyrodigal) need those tools installed
separately.

## Use

Import a genome and show it in a notebook:

```python
from pathlib import Path

from syntviz.importers import ImportFile, ImportSpec, import_genome
from syntviz.notebook import Figure

session = import_genome(
    ImportSpec(
        genome_id="phage",
        name="Phage A",
        files=[ImportFile(path=Path("phage.gbk"), role="genbank")],
        organism_context="virus",
    )
)
Figure(session)  # interactive viewer in the cell output, works offline
```

Load a saved session, check it and export a figure:

```python
from pathlib import Path

from syntviz.models import Session
from syntviz.runtime import render, validate

session = Session.model_validate_json(Path("figure.syntviz.json").read_text())
validate(session)  # {"valid": True, "diagnostics": [...]}
render(session, Path("figure.svg"))
```

The `syntviz` command offers the same operations:

```bash
syntviz discover                                  # session and command schemas
syntviz edit figure.syntviz.json commands.json edited.syntviz.json
syntviz render edited.syntviz.json figure.pdf
syntviz view figure.syntviz.json                  # local viewer on loopback
```

`commands.json` holds a JSON array of commands such as `setView`, which takes a
complete view; `syntviz discover` lists every command and its schema.

## License

Lawrence Berkeley National Laboratory non-commercial use only license; see
`LICENSE`. Questions about rights to use or distribute the software go to
Berkeley Lab's Intellectual Property Office.
