Metadata-Version: 2.4
Name: bioalign
Version: 0.1.2
Summary: Homology search, multiple sequence alignment, Shannon conservation analytics, Neighbor-Joining phylogenetics, and multi-format MSA conversion
Author-email: Taner Karagöl and Alper Karagöl <karagolt@mit.edu>
License-Expression: MIT
Project-URL: Homepage, https://www.karagolresearch.com/bioalign
Project-URL: Documentation, https://www.karagolresearch.com/bioalign
Project-URL: Preprint, https://doi.org/10.1101/2024.08.01.606148
Project-URL: Platform, https://www.karagolresearch.com/tools
Keywords: bioinformatics,multiple-sequence-alignment,msa,phylo,phylogenetics,neighbor-joining,upgma,shannon-entropy,conservation,blast,clustal-omega,mafft,muscle,t-coffee,kalign,embl-ebi,fasta,phylip,stockholm,nexus
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.20.0
Dynamic: license-file

# bioalign

[![PyPI version](https://img.shields.io/pypi/v/bioalign)](https://pypi.org/project/bioalign/) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

`bioalign` is the standalone Python library and command-line interface for the [BioAlign](https://www.karagolresearch.com/bioalign) workbench developed at [Karagöl Research](https://www.karagolresearch.com). It combines local affine-gap progressive alignment (BLOSUM62 and nucleotide scoring), optional EMBL-EBI Job Dispatcher remote search and alignment (`ncbiblast`, `clustalo`, `muscle`, `mafft`, `tcoffee`, `kalign`), per-column Shannon entropy and conservation profiling, Poisson-corrected distance matrices, Neighbor-Joining and UPGMA tree reconstruction, and multi-format alignment conversion (`FASTA`, `Clustal`, `PHYLIP`, `Stockholm`, `MSF`, `NEXUS`, `Newick`, `SVG`, `CSV`, and `JSON`).

## Installation

```bash
pip install bioalign
```

## Command-Line Usage

### 1. Align Unaligned Sequences (Offline Progressive Needleman-Wunsch or Remote EMBL-EBI)

```bash
bioalign align unaligned.fasta -o aligned.fasta
bioalign align unaligned.fasta --engine clustalo --email researcher@institute.edu -o aligned.fasta
```

### 2. Compute Conservation, Shannon Entropy, Consensus, and Pairwise Identity

```bash
bioalign stats aligned.fasta -o alignment_summary.json --csv per_column_metrics.csv
```

### 3. Reconstruct Neighbor-Joining or UPGMA Trees (Newick + Publication SVG)

```bash
bioalign tree aligned.fasta --method nj -o tree.nwk --svg tree.svg
bioalign tree aligned.fasta --method upgma --cladogram --svg cladogram.svg
```

### 4. Convert Alignments Across Standard Formats

```bash
bioalign convert aligned.fasta --to clustal -o aligned.aln
bioalign convert aligned.fasta --to stockholm -o aligned.sto
bioalign convert aligned.fasta --to phylip -o aligned.phy
bioalign convert aligned.fasta --to nexus -o aligned.nex
bioalign convert aligned.fasta --to msf -o aligned.msf
```

### 5. Run Homolog Search + Alignment Pipeline via EMBL-EBI Job Dispatcher

```bash
bioalign search query.fasta --email researcher@institute.edu --align clustalo -o results_dir
```

## Python API

```python
from bioalign import (
    align_sequences,
    build_tree,
    compute_alignment_stats,
    format_alignment,
    parse_fasta,
    to_newick,
)

records = parse_fasta("unaligned.fasta")
aligned = align_sequences(records)
stats = compute_alignment_stats(aligned)
tree = build_tree(
    [r.id for r in aligned],
    stats["identity_matrix"],
    method="nj",
)
print("Consensus:", stats["consensus"])
print("Newick:", to_newick(tree))
print(format_alignment(aligned, fmt="clustal"))
```

## Authors & Credits

Developed by **Taner Karagöl, M.D.** ([tanerkaragol.com](https://www.tanerkaragol.com), ORCID: [0009-0005-1011-7661](https://orcid.org/0009-0005-1011-7661), `karagolt@mit.edu`) and **Alper Karagöl, M.D.** ([alperkaragol.com](https://www.alperkaragol.com), ORCID: [0009-0001-7864-0732](https://orcid.org/0009-0001-7864-0732), `akaragol@mit.edu`) as part of [Karagöl Research](https://www.karagolresearch.com).

## Citation

- Karagöl, A., Karagöl, T. (2026). BioAlign: An Integrated Web Workbench and REST API for Protein Homology Search, Multiple Sequence Alignment, Conservation Analysis, and Phylogenetic Visualization.
- Karagöl, A., Karagöl, T. (2024). An Evolutionary Statistics Toolkit for Simplified Sequence Analysis on Web with Client-Side Processing. *bioRxiv*. https://doi.org/10.1101/2024.08.01.606148

## License

Released under the MIT License.
