Logotipo de Chromatogram File Utils

Chromatogram File Utils

Comunidad
y9c

Sanger sequencing toolkit: chromatogram visualization, mutation calling, QC, base-calling, trimming, assembly and export (CLI + Python + MCP).

Editory9c
Repositoriosanger
IdiomaPython
Forks
4
Estrellas
26
Herramientas disponibles
0
Tipo de transportestdio
Categorías
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Chromatogram File Utils ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    26 estrellas y 4 forks en el repositorio enlazado.

Pypi Releases Downloads CI Python

sanger

A lightweight toolkit for Sanger sequencing data: chromatogram visualization, alignment & mutation calling, quality control, base-calling, trimming, assembly and export — usable as a CLI, a Python library, or an MCP server for LLM agents.

Quick start

bash
pip install sanger
sanger mut -q read.ab1 -s ref.fa -o out --plot
python
from sanger import Chromatogram, parse_fasta

cg = Chromatogram.from_abi("./data/B5-M13R_B07.ab1")
print(cg.length, cg.mean_quality, cg.gc_percent)   # 1141 50.2 52.0
ref = parse_fasta("./data/ref.fa")
print(cg.qc())                                    # QC metrics (CRL, SNR)
print(cg.to_vcf(ref))                             # variant calling -> VCF
cg.plot(region=(55, 90))                          # render a region

Examples

The gallery below is produced from the bundled real ABI sample (data/B5-M13R_B07.ab1 vs data/ref.fa) by python -m scripts.make_readme_examples.

Mutation calling — the SNP T61A is highlighted and annotated.

Mutation calling

Quality control — per-base Phred quality, CRL and Mott trimming.

Quality profile

Side-by-side panels — chromatogram + GC% + quality on a shared axis.

Side-by-side

Feature overlay — primers, amplicon and SNPs on the trace.

Feature overlay

Re-called bases — mixed/heterozygous sites are marked (M/W/K).

Re-called bases

Assembly — pileup depth and consensus against a reference.

Assembly

Installation

The default install pulls only numpy, click and rich-click — no C compiler and no plotting library required. Parsing, QC, alignment (a bundled Cython Smith-Waterman with a NumPy fallback), analysis and export all work out of the box.

bash
pip install sanger

Optional extras:

bash
pip install "sanger[plot]"     # matplotlib -> chromatogram figures
pip install "sanger[viewer]"   # DNA Features Viewer integration
pip install "sanger[agent]"    # MCP server for LLM agents
pip install "sanger[all]"      # everything

The bundled Cython Smith-Waterman accelerator (sanger._swalign, self-contained, no ssw dependency) is compiled automatically when a C compiler is present at build time; otherwise the NumPy fallback is used.

Free-threaded (no-GIL) Python: the [plot] features are currently skipped on free-threaded builds (e.g. cpython-3.14t) because matplotlib's tick-copy recurses there. Everything else — parsing, alignment, QC, base-calling, export — works fine; plotting tests are skipped automatically (Py_GIL_DISABLED).

From source:

bash
git clone git@github.com:y9c/sanger.git
cd sanger
make init       # install dependencies
make test       # run the test-suite

Command-line interface

Built on rich-click, with themed command groups (sanger --help):

text
sanger mut            mutation calling & reporting
sanger qc             per-read quality-control metrics
sanger track          split / join / slice chromatogram trace files
sanger edit           trim, strip primers, reverse-complement
sanger basecall       re-call bases from raw four-channel traces
sanger assemble       reference-guided pileup & consensus
sanger analyze        sequence biology (translate, motifs, restriction)
sanger export         FASTA / VCF / JSON / batch summary
sanger plot           chromatogram rendering (+ features / DNA viewer)

Examples:

bash
sanger mut -q read.ab1 -s ref.fa -o out --plot        # mutation report + figure
sanger qc r1.ab1 r2.ab1                               # QC table
sanger track split read.ab1 -c 20,40 -f tsv           # split traces
sanger edit trim read.ab1 -c 0.05 -o out              # Mott quality trim
sanger edit strip-primers read.ab1 -f AAAA -r CCCA    # primer removal
sanger basecall call read.ab1 -r 0.45                 # re-call bases
sanger basecall hetero read.ab1                       # mixed/heterozygous sites
sanger assemble consensus a.ab1 b.ab1 -r ref.fa       # reference-guided consensus
sanger analyze rest read.ab1                          # restriction sites
sanger analyze translate read.ab1 -f 1                # protein translation
sanger export vcf -q read.ab1 -s ref.fa               # VCF of variants
sanger export batch *.ab1 -o out -f csv               # batch QC table
sanger plot dnaviewer read.ab1 --start 50 --end 100   # with DNA Features Viewer

Python API

The high-level Chromatogram object is the easiest way to work with the toolkit; the low-level modules remain available for custom work.

python
from sanger import Chromatogram, parse_fasta

cg = Chromatogram.from_abi("./data/B5-M13R_B07.ab1")
ref = parse_fasta("./data/ref.fa")

Mutation calling & quality filtering

python
from sanger.quality import QualityFilter

snps = cg.call_mutations(ref)
confident = QualityFilter(min_base_qual=20, min_local_qual=20).filter(snps)
print([f"{s.ref_base}{s.ref_pos}{s.cf_base}" for s in confident])

QC metrics (incl. continuous read length)

python
m = cg.qc()
print(m["mean_qual"], m["trim_start"], m["trim_end"], m["crl"], m["snr"])

Re-call bases from raw traces + mixed/heterozygous sites

python
res = cg.basecall()
print(res.sequence)
for pos, major, minor, frac in res.heterozygotes(min_ratio=0.2):
    print(pos, major, minor, frac)

Trim / reverse-complement / orientation

python
trimmed = cg.trim().trim_leading_ns()     # Mott trim then drop leading Ns
rc      = cg.reverse_complement()
ori     = cg.detect_orientation(ref)      # +1 forward, -1 reverse-complement

Sequence-level analysis

python
print(cg.analyze("translate", frame=1))            # protein translation
print(cg.analyze("restriction"))                    # {'EcoRI': [27], ...}
print(cg.analyze("motif", motif="AATT"))            # motif positions

Export

python
print(cg.to_fasta())
print(cg.to_vcf(ref))
cg.export("out")                                    # write FASTA to disk

Feature overlay (for external tools)

python
from sanger import ChromatogramFeature
from sanger.features import plot_features

feat = ChromatogramFeature(start=90, end=130, strand=+1, label="primer F")
fig, ax = cg.plot(region=(80, 140))
plot_features(cg.to_record, ax, features=[feat])

Side-by-side with another tool's output (shared x-axis)

python
from sanger.composite import side_by_side

def my_panel(ax, trace_x, peaks, seq, record, start=None):
    ax.bar(range(len(seq)), [1.0] * len(seq), color="0.66")
    ax.set_ylabel("my tool signal")

fig, (ax_chrom, ax_panel) = side_by_side(cg.to_record, my_panel, region=(10, 40))

Consensus / assembly from many reads

python
from sanger import parse_abi
from sanger.assembly import pileup, consensus

reads = [parse_abi(f) for f in ["a.ab1", "b.ab1", "c.ab1"]]
table = pileup(reads, ref, quality_threshold=20)
print(consensus(table))

Plot together with DNA Features Viewer (needs sanger[viewer])

python
from sanger import ChromatogramFeature
from sanger.dnalink import plot_combined

feats = [ChromatogramFeature(start=90, end=130, strand=+1, label="primer F")]
fig, (ax_feat, ax_chrom) = plot_combined(cg.to_record, features=feats, region=(55, 90))

Chromatogram object

A terse, idiomatic workflow in one object:

python
from sanger import Chromatogram

cg = Chromatogram.from_abi("./data/B5-M13R_B07.ab1")
cg.length, cg.mean_quality, cg.gc_percent, cg.channels   # 1141 50.2 52.0 GATC
cg.qc()                            # QC metrics (CRL, SNR)
cg.basecall()                      # re-call bases from raw traces
cg.call_mutations(ref)             # variant calling
cg.trim().trim_leading_ns()        # quality trimming
cg.reverse_complement()            # reverse-strand view
cg.analyze("restriction")          # restriction-site scan
cg.plot(region=(55, 90))           # render a region
cg.to_fasta(), cg.to_vcf(ref)      # export
cg.export("out")                   # write to disk

Agent / MCP

sanger ships a Model Context Protocol server so LLM agents and MCP clients can call the toolkit as tools:

bash
pip install "sanger[agent]"     # adds mcp>=2
sanger-mcp                        # run the MCP server over stdio
python -m sanger.mcp_server       # identical
ToolPurpose
read_chromatogram(path)parse an ABI → summary (length, GC%, quality, CRL)
qc_metrics(path)full per-read QC metrics (incl. CRL, signal, SNR)
call_mutations(query ab1, subject fa)variants vs a reference (SNPs/indels)
re_call_bases(path)re-call bases from raw traces + heterozygotes
analyze_sequence(path, kind)translate / motifs / restriction / GC
trim_read(path, mode)quality-trim a read
export_sequence(path, outdir)write FASTA or VCF
plot_chromatogram(path, out, start, end)render a chromatogram PNG

Register it in an MCP client's config, e.g.:

json
{ "mcpServers": { "sanger": { "command": "sanger-mcp" } } }

ChangeLog

  • Fix rescaled peak-axis drift: peaks[0] now aligns to 0 (in step with trace_x) instead of being shifted right by peaks[0]/step.
  • Fix reverse_complement_record axis: traces/peaks are now both mirrored and reversed so each RC base sits over the correct dye signal.
  • Fix 1-based region=(start, end) in plot_chromatograph so the requested bases are shown and composite.side_by_side / dnalink.plot_combined panels line up exactly with the chromatogram.
  • Make Chromatogram.export(fmt=...) actually write fasta / json / vcf (previously fmt was ignored); unknown formats now raise ValueError.
  • Harden abi_iterator against files missing SMPL1 / PBAS2 / PCON2 tags.
  • Skip matplotlib plotting tests on free-threaded (Py_GIL_DISABLED) builds, where matplotlib's tick-copy deep-copy recurses.
  • Replace the external ssw aligner with a bundled Cython Smith-Waterman (+ NumPy fallback) — no external alignment dependency.
  • Reverse-complement the chromatogram file (inspired by Snapgene).
  • Add per-base quality filtering, continuous read length (CRL), signal/SNR QC.
  • Add base-calling from raw four-channel traces + heterozygote (mixed-base) calling.
  • Add feature overlay API and DNA Features Viewer integration.
  • Add split / join / slice trace operations with provenance (offset).
  • Add reference-guided pileup & consensus (assembly module).
  • Add FASTA / VCF / JSON / batch export.
  • Fix false-positive mutations from lowercase reference bases (case-insensitive).
  • Build the CLI with rich-click (themed groups, short options, --version).

TODO

  • call mutation by alignment and plot Chromatogram graphic
  • add a doc
  • change x-axis by peak location
  • fix bug that chromatogram switches position after trim
  • wrap as a CLI app
  • return quality score in output (quality module + report)
  • fix selected base not being centred (center_region)
  • fix plot_chromatograph rendering bug (full-region bounds, channels)
  • add projection/assembly (assembly module)
  • preserve trimmed-origin positions when slicing/joining (offset provenance)

Instalación

TypingMind
{
  "mcpServers": {
    "sanger": {
      "command": "sanger-mcp",
      "args": []
    }
  }
}

Usa el MCP de Chromatogram File Utils con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Chromatogram File Utils, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Chromatogram File Utils como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Chromatogram File Utils.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "sanger": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Chromatogram File Utils y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Chromatogram File Utils.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Chromatogram File Utils para ayudarme con esta tarea?
Chromatogram File Utils
Claro. Lo he leído.
Esto he encontrado usando Chromatogram File Utils.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Chromatogram File Utils?

Chromatogram File Utils es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Chromatogram File Utils con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Chromatogram File Utils con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Chromatogram File Utils con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Chromatogram File Utils conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Chromatogram File Utils a TypingMind?

Chromatogram File Utils funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Chromatogram File Utils en TypingMind?

Chromatogram File Utils ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Chromatogram File Utils?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Chromatogram File Utils requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇