Skip to content

fastdpplot.server — Panel Server Entry Point

Source: fastdpplot/server.py

This module provides convenience wrappers that load data and immediately start the Panel interactive server in one call.


run(path, port, title, **load_kwargs)

Load a Parquet or text file and start the Panel server.

Parameters

Parameter Type Default Description
path str Path to a .parquet or delimited text file.
port int 5006 TCP port for the Panel server.
title str "fastdpplot" Browser tab title.
**load_kwargs Extra keyword arguments forwarded to fastdpplot.io.load() (e.g. sep, x_col, …).

Example

from fastdpplot.server import run

run("hits.parquet", port=8080, title="My alignment")

# Text file with custom separator and column mapping
run("blast.txt", sep="\t", x_col=6, y_col=8, val_col=2)

Command-line equivalent

fastdpplot plot --input hits.parquet --serve --port 8080

run_bin(matrix_path, fasta_a, fasta_b, port)

Load a binary DP matrix + FASTA files and start the Panel server. The browser title is derived automatically from the FASTA sequence IDs.

Parameters

Parameter Type Default Description
matrix_path str Path to the raw binary .bin matrix.
fasta_a str Query FASTA file (rows).
fasta_b str Subject FASTA file (columns).
port int 5006 TCP port for the Panel server.

Example

from fastdpplot.server import run_bin

run_bin(
    "data/dp_matrix.bin",
    "data/query.fasta",
    "data/subject.fasta",
    port=5006,
)

Auto-derived window title

The browser tab will be named "<query_id> vs <subject_id>" where the IDs are extracted from the FASTA headers. The short ID (everything before the first |) is used.


/range HTTP endpoint

When the Panel server is running it exposes a lightweight HTTP endpoint that the GUI polls before exporting a static image:

GET http://localhost:<port>/range

Response (JSON):

{"x_range": [120.0, 850.0], "y_range": [0.0, 600.0]}

The values reflect the current pan/zoom state of the interactive viewer. The GUI reads this and passes --xlim/--ylim to the CLI so the exported PNG/SVG matches exactly what is visible on screen.

The endpoint is registered via pn.serve(extra_patterns=[("/range", handler)]). It is read-only and has no side effects.