<img src="./docs/assets/logo.png" width=80/>

# Compressed DNA sequence representation

>[!WARNING]
>This is an experimental implementation.

`ganz` implements a simple way to store DNA sequences in a compressed format:

```python
from ganz import DnaSequence

dna = DnaSequence("ACGT")
```

It also makes getting the one-hot representation of the DNA sequence very fast:

```python
dna.unpack_bits()
# array([[1, 0, 0, 0],
#        [0, 1, 0, 0],
#        [0, 0, 1, 0],
#        [0, 0, 0, 1]], dtype=uint8)
```

[![PyPi version](https://img.shields.io/pypi/v/ganz)](https://pypi.org/project/ganz)

## Installation

```bash
pip install ganz

# or 

pip install git+https://github.com/gtca/ganz.git
```

## Building from source

To build from source, you'll need:
- Rust toolchain (install from [rustup.rs](https://rustup.rs))
- Python 3.8 or newer
- NumPy

Then:

```bash
# Clone the repository
git clone https://github.com/gtca/ganz.git
cd ganz

# Install development dependencies
pip install maturin pytest numpy

# Build and install in development mode
pip install -e .

# Run tests
pytest tests/
cargo test
```
