| Crates.io | seqtui |
| lib.rs | seqtui |
| version | 0.1.1 |
| created_at | 2025-12-29 22:33:02.035851+00 |
| updated_at | 2026-01-15 08:19:32.470369+00 |
| description | Fast TUI toolkit for viewing, translating, and manipulating biological sequences. |
| homepage | |
| repository | https://github.com/ranwez-search/SeqTUI/ |
| max_upload_size | |
| id | 2011594 |
| size | 1,284,675 |
A fast terminal-based viewer and command-line toolkit for sequences. View, translate, convert (to FASTA), and combine sequences aligned or not — all from the terminal.
Author: Vincent Ranwez
/ and ?# View an alignment interactively
seqtui LOC_01790.nex
# Translate to amino acids
seqtui alignment.fasta -t -o out_AA.fasta
If you find SeqTUI useful, please consider starring the repository.
terminal requirements: SeqTUI requires a terminal that supports ANSI colors and cursor movement (most modern terminals do). By default, SeqTUI uses an ASCII-safe interface for maximum compatibility. Optional Unicode glyphs can be enabled using the --fancy option. While Unicode glyphs provide a nicer visual rendering, they may cause display issues on some terminal configurations, especially on Windows.
SeqTUI has been tested on macOS using WezTerm, including remote use over SSH to Linux systems, and on Windows 11 using Windows Terminal.
macOS note: on first launch, macOS may block the application. In this case, allow it via
System Settings → Privacy & Security, then run it again.
Precompiled binaries are available from the Releases section of the GitHub repository: https://github.com/ranwez-search/SeqTUI/releases
SeqTUI is also distributed as a Rust crate and can be installed (or build from source) using Cargo (https://www.rust-lang.org/tools/install)
install from crate.io (recommanded)
cargo install seqtui
recompiled from source
git clone https://github.com/ranwez-search/SeqTUI.git
cd SeqTUI
cargo install --path .
SeqTUI works in two modes:
-o): Batch processing for scripts and pipelinesSmall test data files are available in the test_data/ directory of the repository.
Use -o to output to a file (or - for stdout) instead of opening the interactive viewer.
Single-line FASTA output makes sequences easy to process with standard Unix tools.
# Convert to single-line FASTA
seqtui sequences.fasta -o sequences_1L.fasta
# Translate to amino acids
seqtui sequences.fasta -t -o sequences_AA.fasta
# Translate with specific genetic code and reading frame
seqtui sequences.fasta -t -g 2 -r 1 -o sequences_AA.fasta
# Check for internal stop codons in coding sequences
seqtui sequences.fasta -t -o - | grep "\*."
# Create a small test set (first 10 sequences, 500 bp each)
seqtui large_alignment.nex -o - | head -20 | cut -c1-500 > test_seq.fasta
# Extract subset of sequences by ID
seqtui sequences.nex -o - | grep -A1 -w -f seq_ids.txt > subset.fasta
# Count sequences
seqtui alignment.phy -o - | grep -c "^>"
# Batch translate all files in a directory
for f in *.fasta; do seqtui "$f" -t -o "${f%.fasta}_AA.fasta"; done
Concatenate multiple alignment files by matching sequence IDs:
# Basic concatenation (sequences matched by ID)
seqtui gene1.fasta gene2.fasta gene3.fasta -o concatenated.fasta
# Mix different formats (FASTA, PHYLIP, NEXUS) - auto-detected!
seqtui gene1.fasta gene2.phy gene3.nex -o concatenated.fasta
# Supermatrix: fill missing sequences with gaps
seqtui gene*.fasta -s -o supermatrix.fasta
# Translate all genes and build AA supermatrix
seqtui gene*.fasta -s -t -o supermatrix_AA.fasta
# With partition file for phylogenetic analysis
seqtui examples/LOC* -s -t -p partitions.nex -o supermatrix.fasta
# Creates NEXUS partition file compatible with IQtree:
# #nexus
# begin sets;
# charset LOC_01790 = 1-286;
# charset LOC_11070 = 287-636;
# charset LOC_39310 = 637-951;
# end;
Sequence ID matching with delimiter — when sequence names have prefixes/suffixes:
# Files have: Human_ENS001, Human_LOC789, Mouse_ENS002, Mouse_LOC456...
# Match on species name (first field before "_")
seqtui gene1.fasta gene2.fasta -d "_" -s -o supermatrix.fasta
# Output sequences: Human, Mouse, ... (matched across files)
# Keep multiple fields: Ae_bicornis_contig257 → Ae_bicornis
seqtui gene*.fasta -f 1,2 -d "_" -s -o supermatrix.fasta
Extract isolated biallelic SNPs from alignments using a minimum flanking monomorphic distance filter:
# Extract SNPs with at least 300 monomorphic sites on each side
seqtui alignment.fasta -v 300 -o snps.vcf
# Process multiple alignments (each becomes a separate CHROM)
seqtui gene*.fasta -v 100 -o all_snps.vcf
# With sequence ID matching via delimiter
seqtui gene*.fasta -v 100 -d "_" -o snps.vcf
VCF output features:
0 (ref), 1 (alt), . (missing)DL and DR in INFO: distance to nearest polymorphic site (for filtering)| Option | Long | Description |
|---|---|---|
-o |
--output |
Output file in sorted FASTA (triggers CLI mode). Use - for stdout |
--format |
Force input format (fasta, phylip, nexus). Default: auto-detect | |
--force |
Proceed despite warnings (ID mismatches, suspect sequences) | |
-d |
--delimiter |
Delimiter for splitting sequence IDs (default: _ when -f is used) |
-f |
--fields |
Fields to keep from IDs (1-based, comma-separated). Ex: -f 1,2 |
-s |
--supermatrix |
Fill missing sequences with a character (default: -) |
-p |
--partitions |
Write partition file in NEXUS format (IQtree-compatible) |
-t |
--translate |
Translate nucleotides to amino acids |
-g |
--genetic-code |
Genetic code (1-33, default: 1 = Standard) |
-r |
--reading-frame |
Reading frame (1-3, default: 1) |
-v |
--vcf |
Extract isolated biallelic SNPs to VCF (value = min flanking distance) |
--fancy |
Enable fancy Unicode glyphs in the interactive TUI (may cause issues on some terminals, especially on Windows) |
On Unix-like systems (Linux, macOS), you may prefer to always use the fancy Unicode interface. In this case, you can define a shell alias:
alias seqtui='seqtui --fancy'
This keeps the default behavior safe and portable while allowing a richer interface when explicitly requested.
By default, SeqTUI opens a full-screen terminal interface for exploring alignments.
# Launch file browser (no arguments)
seqtui
# View an alignment (format auto-detected from extension)
seqtui sequences.fasta
seqtui alignment.phy
seqtui data.nex
# Force a specific format
seqtui --format nexus myfile.txt
seqtui --format phylip alignment.dat
# Preset translation settings
seqtui sequences.fasta -g 2 -r 1 # Open with genetic code 2 preset
| Key | Action |
|---|---|
←↑↓→ |
Move one position |
Shift+←→ |
Half page left/right |
Shift+↑↓ |
Full page up/down |
Home / End |
First / last column |
PgUp / PgDn |
Full page up/down |
| Key | Action |
|---|---|
h / j / k / l |
Move left/down/up/right |
Ctrl+U / Ctrl+D |
Half page up/down |
zH / zL |
Half page left/right |
0 / $ |
First / last column |
g0 / gm / g$ |
First/middle/last visible column |
<num>| |
Go to column (e.g., 50|) |
w / b / e |
Next/previous/end of word |
| Key | Action |
|---|---|
/pattern |
Search forward |
?pattern |
Search backward |
n |
Next match |
N |
Previous match |
| Command | Action |
|---|---|
:q |
Quit |
:h |
Toggle help overlay |
:<number> |
Go to sequence/row |
:e |
Open file browser |
:w file.fa |
Save current view to FASTA |
:asAA |
Translate nucleotides to amino acids |
:asNT |
Switch back to nucleotide view |
:setcode |
Change genetic code and reading frame |
Use :asAA to translate nucleotides to amino acids:
j/k to browse codes, h/l to change frameEnter to translate, Esc to cancelUse :asNT to switch back to the nucleotide view.
Use :w filename.fasta to save the current view:
:w Loc256_AA.fasta| Format | Extensions | Features |
|---|---|---|
| FASTA | .fasta, .fa, .fna, .faa, .fas |
Multi-line sequences |
| PHYLIP | .phy, .phylip |
Sequential and interleaved |
| NEXUS | .nex, .nexus, .nxs |
DATA/CHARACTERS blocks, MATCHCHAR support |
The application follows an event-driven MVC architecture. The internal architecture is shown below for developers interested in extending or modifying SeqTUI:
src/
├── main.rs # Entry point and CLI argument parsing
├── lib.rs # Module exports
├── model.rs # Data structures (Sequence, Alignment, Viewport, AppState)
├── formats/ # Multi-format support
│ ├── mod.rs # Format detection and unified parsing
│ ├── fasta.rs # FASTA format parser
│ ├── nexus.rs # NEXUS format parser (token-based)
│ └── phylip.rs # PHYLIP format parser
├── event.rs # Keyboard event handling
├── ui.rs # TUI rendering with ratatui
├── controller.rs # Main application loop
└── genetic_code.rs # Genetic code tables and translation
# Run tests (96 tests covering all formats and SNP extraction functionality)
cargo test
# Run with test data
cargo run -- test_data/alignment.fasta
cargo run -- test_data/LOC_01790.nex
# Build release version
cargo build --release
# On Linux or cross-compile
cargo build --release --target x86_64-unknown-linux-gnu
⚠️ This is a side project developed with use of AI assistants (Claude Opus 4.5 via GitHub Copilot). SeqTUI has been thoroughly tested on real data with a strong focus on functionality and user experience. Please report any issues or suggestions.
SeqTUI was inspired by several great tools:
SeqTUI handles frameshifts consistently with MACSE
Alternatives to SeqTUI include:
MIT