Metadata-Version: 2.4
Name: dna2oiia
Version: 0.2.0
Summary: A Python package that converts DNA sequences into 'oiia' sounds.
License-File: LICENSE
Author: Chen Hsieh
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: mp3
Provides-Extra: streamlit
Provides-Extra: tui
Requires-Dist: pydub ; extra == "mp3" or extra == "streamlit"
Requires-Dist: streamlit (>=1.0) ; extra == "streamlit"
Requires-Dist: textual (>=0.40) ; extra == "tui"
Description-Content-Type: text/markdown

# DNA2oiia 🧬🎵🐱

[![Python 3.10+](https://img.shields.io/badge/python-3.10%2B-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![CI](https://github.com/ChenHsieh/dna2oiia/actions/workflows/ci.yml/badge.svg)](https://github.com/ChenHsieh/dna2oiia/actions/workflows/ci.yml)
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/ChenHsieh/dna2oiia/main?labpath=notebooks%2Fdna2oiia_demo.ipynb)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ChenHsieh/dna2oiia/blob/main/notebooks/dna2oiia_demo.ipynb)

Convert DNA/RNA sequences into sound using "oiia" phonetics. Each base maps to a sound: **A=o, T/U=ii, C=a, G=e**.

[![Try it in your browser](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://dna2oiia.streamlit.app)

![DNA2Oiia Demo](demo.gif)

## Table of Contents

- [Installation](#installation)
- [CLI Usage](#cli-usage)
- [Python API](#python-api)
- [Interactive TUI](#interactive-tui)
- [Streamlit Web App](#streamlit-web-app)
- [Acknowledgments](#acknowledgments)

## Installation

```bash
pip install dna2oiia
```

Optional extras:

```bash
pip install dna2oiia[mp3]        # MP3 export (requires pydub + ffmpeg)
pip install dna2oiia[tui]        # Interactive terminal UI
pip install dna2oiia[streamlit]  # Streamlit web app
```

## CLI Usage

```bash
dna2oiia -s ATCGGATTA -o my_dna          # Convert sequence to WAV
dna2oiia -f example.fasta -o output      # Convert FASTA file
echo "ATCGATCG" | dna2oiia --play        # Pipe from stdin and play
dna2oiia -s ATCGATCG --play              # Play audio directly
dna2oiia -s ATCGATCG --speed 2.0         # Double speed
dna2oiia -s ATCG --repeat 4              # Repeat 4 times
dna2oiia -s ATCGGATTA --reverse-complement  # Reverse complement
dna2oiia -s ATCGATCG --visualize         # Colored base-to-sound mapping
dna2oiia -s ATCGGATTA --format mp3       # MP3 output (requires pydub)
```

Try famous sequences included in the repo:

```bash
dna2oiia -f examples/data/famous_sequences.fasta --play --visualize
```

## Python API

```python
from dna2oiia import dna_to_oiia, process_fasta, reverse_complement, validate_dna_sequence

# Single sequence
dna_to_oiia({"example": "ATCGGATTA"}, "output")  # Creates output.wav

# FASTA file
sequences = process_fasta("example.fasta")
dna_to_oiia(sequences, "output")

# Stream to buffer
import io
buf = io.BytesIO()
dna_to_oiia({"seq": "ATCGGATTA"}, output_buffer=buf)

# Speed, repeat, reverse complement
dna_to_oiia({"fast": "ATCGATCG"}, "out", speed=2.0, repeat=3)
rc = reverse_complement("ATCG")  # "CGAT"
```

## Interactive TUI

```bash
pip install dna2oiia[tui]
dna2oiia-tui          # or: dna2oiia --tui
```

Keyboard shortcuts: **F5** Play | **F6** Save WAV | **F7** Reverse complement | **Q** Quit

Features: paste sequences or load FASTA files, live colored visualization, adjustable speed and repeat.

## Streamlit Web App

```bash
pip install dna2oiia[streamlit]
streamlit run st_dna2oiia.py
```

Or [try it in your browser](https://dna2oiia.streamlit.app).

## Acknowledgments

Inspired by a conversation with IOB friends Nathan and Ibukun during a hackathon. The "oiia" sound is sourced from [this YouTube video](https://www.youtube.com/watch?v=1oKZFGLn02g) under fair use. Developed with AI assistance.

## License

MIT License. Contributions welcome!

