Skip to content

koza

Details

GitHub monarch-initiative/koza
Language Python
Description Data transformation framework for LinkML data models

Dependencies

External Dependencies

Package Version
coverage >=7.13.0
duckdb
loguru
biolink-model >=4.3.6
mergedeep ==1.3.4
ordered-set >=4.1.0
orjson >=3.10
pydantic >=2.12.5
pyyaml >=6.0.3
requests >=2.32.5
sssom >=0.4
tqdm >=4.67.1
typer >=0.20.0
LinkML >=1.9.0

Documentation

Koza - Knowledge Graph Transformation and Operations Toolkit

Pyversions PyPi Github Action

pupa

Documentation

Overview

Koza is a Python library and CLI tool for transforming biomedical data and performing graph operations on Knowledge Graph Exchange (KGX) files. It provides two main capabilities:

๐Ÿ“Š Graph Operations (New!)

Powerful DuckDB-based operations for KGX knowledge graphs:

  • Join multiple KGX files with schema harmonization
  • Split files by field values with format conversion
  • Prune dangling edges and handle singleton nodes
  • Append new data to existing databases with schema evolution
  • Multi-format support for TSV, JSONL, and Parquet files

๐Ÿ”„ Data Transformation (Core)

Transform biomedical data sources into KGX format:

  • Transform csv, json, yaml, jsonl, and xml to target formats
  • Output in KGX format
  • Write data transforms in semi-declarative Python
  • Configure source files, columns/properties, and metadata in YAML
  • Create mapping files and translation tables between vocabularies

Installation

Koza is available on PyPi and can be installed via pip/pipx:

[pip|pipx] install koza

Usage

See the Koza documentation for complete usage information.

Key Features

๐Ÿ”ง Multi-Format Support

  • Native support for TSV, JSONL, and Parquet KGX files
  • Automatic format detection and conversion
  • Mixed-format operations in single commands

๐Ÿ›ก๏ธ Schema Flexibility

  • Automatic schema harmonization across heterogeneous files
  • Schema evolution with backward compatibility
  • Comprehensive schema reporting and validation

โšก High Performance

  • DuckDB-powered operations for fast bulk processing
  • Memory-efficient handling of large knowledge graphs
  • Parallel processing and streaming where possible

๐Ÿ” Rich CLI Experience

  • Progress indicators for long-running operations
  • Detailed statistics and operation summaries
  • Dry-run modes for safe operation preview

๐Ÿงน Data Integrity

  • Dangling edge detection and preservation
  • Duplicate detection and removal strategies
  • Non-destructive operations with data archiving