Skip to main content

Logo Buttle was developed as a lightweight collection of bioinformatics utilities for common sequence-analysis tasks, with an emphasis on convenient command-line use. It provides tools for working with DNA and protein sequences, including sequence manipulation, peptide properties, motif searching, pairwise alignment, and multiple sequence alignment.

Buttle is currently under active development.

Features

General sequence tools

  • Search for sequences and report their positions
  • Calculate sequence length
  • Calculate pairwise percent identity for sequences in a FASTA file

DNA sequences

  • Transcribe to RNA
  • Translate in three reading frames
  • Generate reverse complements
  • Calculate GC content
  • Pairwise sequence alignment from two raw sequence arguments
    • Rust backend by default, with a Python backend available
  • Multiple sequence alignment (MSA) from FASTA files or FASTA-formatted strings
    • Rust backend by default, with a Python backend available

Protein sequence tools

  • Calculate protein net charge
  • Calculate molecular weight
  • Calculate extinction coefficient
  • Identify and highlight potential N-linked glycosylation sites
  • Compare two sequences and look for conserved motifs of varying lengths
  • Pairwise sequence alignment from two raw sequence arguments
    • Rust backend by default, with a Python backend available
  • Multiple sequence alignment (MSA) from FASTA files or FASTA-formatted strings
    • Rust backend by default, with a Python backend available

Antibody tools

  • Detect an antibody sequence, if present, in a Sanger DNA read
  • Determine the inferred germline V and/or J gene for an antibody heavy or light chain
    • Supports human, mouse, and alpaca

Rendering

  • Print alignments in the terminal (when no --save argument provided)
  • Generate publication-quality PNG and TIFF alignment images
    • Pairwise DNA and Protein alignments
    • Multiple DNA and Protein sequence alignments
    • Antibody and germline alignments
    • Alignment row length can be tuned with --wrap
    • Argument --real-ruler displays residue number based on the first sequence, skipping gaps
      • Optionally add a number at which the ruler numbering will start (defaults to 1)
  • Argument --diff displays alignment differences relative to a reference sequence (first sequence in FASTA file)
  • Argument --consensus optionally adds a consensus sequence to the bottom of an MSA
  • Argument --tree displays an average-linkage clustering of pairwise sequence distances, not a phylogenetic reconstruction

Installation/Requirements

Buttle is distributed through PyPI and requires Python 3.15 or newer. Prebuilt wheels include both the Python modules and the compiled Rust extension, so Rust and Cargo are not required when installing a compatible wheel.

Command-line installation

Install Buttle as a standalone command-line tool using uv:

uv tool install buttle

Alternatively, install it with pip:

pip install buttle

Once installed, run:

buttle --help

Using Buttle in Python

To add Buttle to an existing Python project:

uv add buttle

Or install it into your active Python environment:

pip install buttle

Buttle's Python modules can also be imported and used directly.

from buttle import sequences

# Access functions from the sequences module
output = sequences.find_position(sequence, search_string)

For convenience, commonly used classes and functions are also exposed at the package's top level:

from buttle import find_position
from buttle import Protein

# Call functions directly without referencing their modules
output = find_position(sequence, search_string)

# Construct objects directly
protein = Protein(name="example", sequence="QSWERMLKQSPIYTR")

Building from source

Prebuilt wheels include the compiled Rust extension, so Rust and Cargo are not required for normal installation on supported platforms. To build Buttle from source, you'll need Python 3.15+, Rust/Cargo, and a compatible build environment. The Rust toolchain (the Rust compiler and Cargo build system) can be installed from https://rustup.rs.

To verify that Rust is installed, run

rustc --version
cargo --version

Rust is only required during installation to compile the extension; it is not required to run Buttle afterward.

Using uv to install buttle from source

Installing uv:

The following instructions use uv to install Buttle from source. Other Python build tools may also be used. If you don't already have uv installed, follow the official installation instructions at

https://docs.astral.sh/uv/getting-started/installation/

On macOS and Linux, you can install it with:

curl -LsSf https://astral.sh/uv/install.sh | sh

Verify the installation:

uv --version

Install Python 3.15:

uv python install 3.15

Clone the repository:

git clone https://github.com/DJV512/buttle/
cd buttle

Finally, install Buttle using uv:

uv tool install --python 3.15 .

After installation:

buttle -h

Development

Rebuilding the Rust extension

After modifying Rust source code, rebuild and reinstall Buttle from the repository root:

uv tool install --reinstall -e .

This recompiles the Rust extension and updates the globally installed buttle command.

Usage

Buttle provides a command-line interface:

buttle <command> [options]

For a list of available commands:

buttle -h

For help with an individual command:

buttle msa -h

Examples

Translate DNA in all three forward reading frames.

$ buttle translate acttactggtcgtagtca
Frame 1: TYWS*S
Frame 2: LTGRS
Frame 3: LLVVV

GC Content

$ buttle gc atgacggtagctagtagctacgtatcattcatctatccgcgcgtagtagtacgt
Total bases: 54
A: 13
C: 12
G: 13
T: 16
AT Content: 53.70
GC Content: 46.30

Display protein charge, molecular weight, and extinction coefficient together with props, or calculate each individually.

$ buttle props adlsykfehyaskgascwedasdkflsdad
Charge = -4
Molecular Weight = 3357.6
Extinction Coefficient = 8370

Pairwise Alignment of DNA or Protein

$ buttle dna_align atctcatgcgtcgtacgtacgt tgcatgcgtacgtagtcgatgtc --diff

Pairwise DNA Alignment

Multiple Sequence Alignment

Buttle implements a custom progressive multiple sequence alignment algorithm using an average-linkage guide tree with tunable affine gap open and extension penalties. For Proteins, Buttle uses BLOSUM62-based scoring. Optionally, "|" can be used as an alignment anchor. For DNA, Buttle uses fixed base match and mismatch scoring. Computationally intensive operations are accelerated using a Rust extension.

$ buttle msa docs/examples/synthetic_example_proteins.fasta --save docs/images/synthetic_alignment_protein.png --diff --wrap 100

Multiple Protein Sequence Alignment

Conservative substitutions are shown in purple, non-conservative substitutions in red, and gaps as black dashes. When --diff is enabled, identities to the reference sequence are shown as dots. For DNA, conservative substitutions are disabled.

The Protein sequences used in this example are available in synthetic_example_proteins.fasta. A similar set of synthetic DNA sequences is available in synthetic_example_dna.fasta.

If the --tree argument is supplied, the average-linkage guide tree that was used to construct the multiple sequence alignment is printed to the terminal in a readable, hierarchical format. * represents internal Cluster nodes.

root
├── *
│   ├── *
│   │   ├── *
│   │   │   ├── Synthetic_Alpha
│   │   │   └── Synthetic_Beta
│   │   └── Synthetic_Delta
│   └── Synthetic_Gamma
└── Synthetic_Epsilon

Antibody Sequence Detection

Sanger DNA Sequence reads of a suspected antibody sequence (heavy or light) can be automatically detected. Input a folder with many Sanger files, or a single Sanger file. The DNA will be translated in all six frames and matched against a pre-compiled Profile of Heavy, Kappa, or Lambda antibody sequences. If an antibody sequence is present, it will be reported in an output file.

$ buttle detect FOLDER output.txt

Inferred Antibody Germline

A given antibody heavy or light sequence will be matched against all relevant germlines, and the top five matches will be reported. Supports V and J genes from human, mouse, and alpaca. Note: only supply the Variable region, with no C-terminal tags or constant region.

$ buttle germline QVQ.... human H

Germline gene         percent_identity    identities
----------------------------------------------------
IGHV1-69*04                     98.98%            97
IGHV1-69*09                     98.98%            97
IGHV1-69*02                     97.96%            96
IGHV1-69*10                     97.96%            96
IGHV1-69*20                     97.96%            96


Germline gene         percent_identity    identities
----------------------------------------------------
IGHJ5*02                        93.75%            15
IGHJ5*01                        87.50%            14
IGHJ5*03                        87.50%            14
IGHJ5*04                        87.50%            14
IGHJ4*01                        86.67%            13

Rust vs Python

The computationally intensive sequence alignment algorithms in Buttle were originally implemented in Python and subsequently ported to Rust to improve performance. The Rust implementations are used by default, but the original Python implementations remain available for comparison, testing, and experimentation. When Buttle is installed, you can select the Python implementation for supported alignment commands using:

buttle msa sequences.fasta --backend python

Omitting --backend uses the Rust implementation.

Installation note: Buttle includes a compiled Rust extension, even when using the Python alignment backend. Python-only installation is not currently supported.

Development status

Buttle is currently in development. Interfaces and command-line options may change before version 1.0. If you find any issues, please report them here.

License

Buttle is licensed under the BSD 3-Clause License.

Metadata

Release files for buttle 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for buttle 0.5.0
File Size Uploaded Provenance Actions
buttle-0.5.0.tar.gz 287.3 kB With provenance Details for buttle-0.5.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for buttle 0.5.0
File Actions
buttle-0.5.0-cp315-cp315-win_amd64.whl CPython 3.15 CPython 3.15 Windows x86-64 Details for buttle-0.5.0-cp315-cp315-win_amd64.whl
buttle-0.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.15 CPython 3.15 Linux glibc 2.17+ x86-64 Details for buttle-0.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
buttle-0.5.0-cp315-cp315-macosx_11_0_arm64.whl CPython 3.15 CPython 3.15 macOS 11.0+ ARM64 Details for buttle-0.5.0-cp315-cp315-macosx_11_0_arm64.whl
buttle-0.5.0-cp315-cp315-macosx_10_12_x86_64.whl CPython 3.15 CPython 3.15 macOS 10.12+ x86-64 Details for buttle-0.5.0-cp315-cp315-macosx_10_12_x86_64.whl

Total release size: 2.3 MB

Release files / buttle-0.5.0.tar.gz

Download URL buttle-0.5.0.tar.gz
Size 287.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0f3f3da5753497bf301b35d3dcb1169629a2425cdb888a8dc0e375100fd7f32e
BLAKE2b-256 checksum
How to use checksums
d89f5b959929268ba8d1245a293e852e14a30425f9720572e87791e06a3477b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / buttle-0.5.0-cp315-cp315-win_amd64.whl

Download URL buttle-0.5.0-cp315-cp315-win_amd64.whl
Size 419.5 kB
Tags CPython 3.15 Windows x86-64
SHA-256 checksum
How to use checksums
a55a3bc3404614d5c54ac452237b21fbe9473e07f5bc8929a61264dae86f0b48
BLAKE2b-256 checksum
How to use checksums
63d29867bf7e4604ee977a372cd43b3fa6d71f866a2c9f4a549884f913bc78d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / buttle-0.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL buttle-0.5.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 551.5 kB
Tags CPython 3.15 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
e988a68edf78324cfd139140f9604cab6b4e7e1f2d17792729d91b29e97f3e39
BLAKE2b-256 checksum
How to use checksums
72492a655b35d92cb570b199eaf54d9fd8c62aa4890ba194caee876ddcadc2cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / buttle-0.5.0-cp315-cp315-macosx_11_0_arm64.whl

Download URL buttle-0.5.0-cp315-cp315-macosx_11_0_arm64.whl
Size 520.8 kB
Tags CPython 3.15 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
812d8e706040adea2fcc6503eeb6c7ca7ece73145eef2ba0d844ead5e909f0ec
BLAKE2b-256 checksum
How to use checksums
1bddf7c00154b1fd076e721e11a30a48a27cebf994f4c4c8caab1cb16752a447
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Release files / buttle-0.5.0-cp315-cp315-macosx_10_12_x86_64.whl

Download URL buttle-0.5.0-cp315-cp315-macosx_10_12_x86_64.whl
Size 520.2 kB
Tags CPython 3.15 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
8085283cc717fe4cf535c2877d4a713322ae30c23a7be0998849fb8efd4eabe3
BLAKE2b-256 checksum
How to use checksums
f256716530c54993401d5b094d2bacac063d30519c72ce562a6edc4000043219
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

Security for buttle 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for buttle-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page