Metadata-Version: 2.4
Name: biorazer
Version: 0.9.6
Summary: A platform for analyzing various biological information
License: MIT
License-File: LICENSE
Author: Fanlin Wang
Author-email: flmaximwang@icloud.com
Requires-Python: >=3.11,<4.0
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Provides-Extra: pyrosetta
Requires-Dist: biopython (>=1.80,<2.0)
Requires-Dist: biotite (>=1.6.0,<2.0.0)
Requires-Dist: hydride (>=1.2.3,<2.0.0)
Requires-Dist: matplotlib (>=3.7.2,<4.0.0)
Requires-Dist: numpy (>=2,<3)
Requires-Dist: pandas (>=2.2,<3.0)
Requires-Dist: python-codon-tables (>=0.1.18,<0.2.0)
Requires-Dist: rcsb-api (>=1.4.2,<2.0.0)
Requires-Dist: rdkit (>=2024.3.5)
Requires-Dist: scipy (>=1.16.1,<2.0.0)
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
Requires-Dist: umap-learn (>=0.5.9.post2,<0.6.0)
Project-URL: Homepage, https://github.com/flmaximwang/BioRazer
Project-URL: Issues, https://github.com/flmaximwang/BioRazer/issues
Project-URL: Repository, https://github.com/flmaximwang/BioRazer
Description-Content-Type: text/markdown

# BioRazer

A Python package for analyzing various biological information, built from practical lab experience. Install with pip and you're ready for common bioinformatics analysis work.

## Features

- **Protein sequences** — Translation, reverse translation, codon/protein dictionaries
- **Multiple Sequence Alignment (MSA)** — Generate MSA via ColabFold MMseqs2 API, visualize coverage, analyze amino acid frequencies
- **Structure analysis** — Static analysis (contacts, hydrogen bonds, surface selection), dynamic trajectory analysis (MD trajectory view, XVG/XPM plots)
- **Database access** — Query AFDB, RCSB PDB, UniProt, Ensembl
- **Rotamer libraries** — Read external side-chain rotamer databases: PyMOL's bundled Dunbrack pickles (`sc_bb_ind` / `sc_bb_dep`) and Rosetta's Dunbrack 2002 / Shapovalov 2010 text libraries
- **Protein design** — Sequence design, library generation, single test entries

## Installation

```bash
pip install biorazer
```

### Dependencies

- Python >= 3.11
- biotite, numpy, scipy, matplotlib, hydride, umap-learn, rcsb-api
- tabulate (for formatted output)

### Development

```bash
# Install with dev and test dependencies
poetry install --with dev,test

# Or using pip with test dependencies
pip install biorazer
pip install pytest pytest-cov
```

## Usage

### ColabFold MSA via MMseqs2 API

Generate protein MSA by calling the ColabFold public API — zero additional dependencies, pure stdlib:

```python
from biorazer.sequence.protein.analysis.alignment.query import run_search

# Single-chain MSA (unpaired, default)
files, _ = run_search(
    ["MTSENLYFQGAMG..."],
    out_dir="msa_out/",
)

# Multi-chain paired MSA (for AF3 multimers)
files, _ = run_search(
    ["CHAIN1_SEQUENCE", "CHAIN2_SEQUENCE"],
    out_dir="msa_out/",
    pair_mode="paired",
    pair_strategy="greedy",   # or "complete"
)
```

Output: A3M files (`uniref.a3m`, `bfd.mgnify30.*.a3m`, `pair.a3m`) ready for downstream folding pipelines. Supports template search (`--templates`) and custom MMseqs2 server URLs.

### MSA Visualization

```python
from biorazer.sequence.protein.analysis.alignment import plot_msa

fig, ax = plot_msa(
    sequences=["MTSENLYFQG", "MTSENLXFQG"],
    labels=["Wild-type", "Mutant"],
)
fig.savefig("msa_plot.png")
```

## Testing

```bash
pytest tests/ -v
```

Tests cover: FASTA parsing, sequence validation, A3M merging, and module constants. All tests are pure (no network required).

## Project Structure

```
biorazer/
├── access/         # External database APIs (AFDB, RCSB, UniProt, Ensembl)
├── database/       # Reference data & external-library readers
│   └── molecule/   #   per-molecule data
│       ├── atom/       #     vdW radii, charges
│       ├── bond/       #     bond length / angle / dihedral
│       ├── icoor/      #     internal-coordinate topology & templates
│       └── rotamer/    #     external rotamer readers, split by source
│           ├── rosetta/    #   Dunbrack 2002 / Shapovalov 2010 text libraries
│           └── pymol/      #   PyMOL's bundled Dunbrack pickles
├── design/         # Protein design tools
├── sequence/       # Sequence analysis
│   ├── nucleotide/
│   ├── protein/
│   ├── analysis/alignment/   # MSA analysis & plotting
│   │   └── scripts/          # MSA visualizer, analyzer
│   └── translation/
├── structure/      # Structure analysis & I/O
└── util/           # Utility modules (dictionaries)
```

## License

This project is licensed under the [MIT License](LICENSE).

This project is intended for academic and research use.

