Source code for modalysis.server.gff

"""FastAPI routes for GFF operations."""

import logging

from fastapi import APIRouter

from modalysis.core import gff as core_gff
from modalysis.server.models import GffAnnotateRequest, GffFormatRequest

logger = logging.getLogger(__name__)

router = APIRouter(prefix="/gff")


[docs] @router.post("/format") def gff_format(request: GffFormatRequest) -> dict[str, str]: """Handle POST `/gff/format` and run core GFF formatting.""" logger.info("Server received GFF format request: %s", request) core_gff.format( input_path=request.input_path, output_path=request.output_path, output_name=request.output_name, allowed_chromosomes=request.allowed_chromosomes, ) return {"status": "success"}
[docs] @router.post("/annotate") def gff_annotate(request: GffAnnotateRequest) -> dict[str, str]: """Handle POST `/gff/annotate` and run core GFF annotation.""" logger.info("Server received GFF annotate request: %s", request) core_gff.annotate( gff_path=request.gff_path, expression_paths=request.expression_paths, expression_labels=request.expression_labels, output_path=request.output_path, output_name=request.output_name, ) return {"status": "success"}