Skip to main content

Python client for Mendelian cross / Punnett square solving via the Pepkio API

Project description

Pepkio Mendelian Cross Solver

Call the Pepkio mendelian-cross-solver REST API from Python to generate Punnett squares, offspring ratios, and step-by-step walkthroughs for Mendelian and non-Mendelian crosses.

What It Does

Genetics teaching and homework verification need Punnett grids for complete dominance, incomplete dominance, codominance, ABO blood types, and X-linked traits—each with different notation and ratio rules. Rebuilding gamete tables and phenotype mapping in a notebook for every cross is tedious and easy to get wrong.

This package submits parent genotypes and a dominance_mode to the same Pepkio Tools engine as the hosted Mendelian Cross Solver web calculator. It returns filled grids, genotype and phenotype ratios, walkthrough steps, warnings, and shareable run permalinks.

Programmatic runs require a network connection and a Pepkio API key. Calculations are not bundled for offline use.

Features

  • Five dominance modes: complete, incomplete, codominant, multiple_alleles (ABO only in MVP), sex_linked
  • Custom phenotype labels; ABO allele hierarchy; sex-linked recessive or dominant trait labeling
  • Manifest examples: complete_monohybrid, incomplete_snapdragon, abo_cross, sex_linked_hemophilia, codominant_roan, dihybrid_pea, sex_linked_dominant
  • CLI: pepkio-mendelian-cross-solver manifest and run
  • Configuration via PEPKIO_API_KEY, LOCAL_PEPKIO_API_KEY, and PEPKIO_API_BASE_URL

Installation

pip install pepkio-mendelian-cross-solver

Set an API key with tools:run scope before calling run():

export PEPKIO_API_KEY="your-key"

Create a key in your Pepkio account API keys settings.

Quick Example

from pepkio_mendelian_cross_solver import PepkioClient

with PepkioClient() as client:
    inp = client.get_example_input("abo_cross")
    result = client.run(inp)
    print(result.permalink)
    print("phenotype ratio:", result.result["phenotype_ratios"]["ratio"])

CLI:

pepkio-mendelian-cross-solver run --example complete_monohybrid

Manifest inspection does not require an API key.

Typical Use Cases

  • Verify monohybrid Aa × Aa (3:1) and dihybrid AaBb × AaBb (9:3:3:1) ratios
  • Model ABO blood type crosses (I^A i × I^B i)
  • Set up X-linked recessive or dominant Punnett squares with standard notation
  • Incomplete dominance (snapdragon) and codominance (roan cattle) homework checks
  • Automated genetics problem sets in notebooks or CI

Scientific Background

Monohybrid crosses under complete dominance yield a 3:1 phenotype ratio (Aa × Aa). Incomplete dominance and codominance both give 1:2:1 phenotype ratios when heterozygotes differ from homozygotes. ABO crosses use multiple alleles with I^A, I^B, and i. Sex-linked traits use X-chromosome notation with Parent 1 female and Parent 2 male.

Web Application

For researchers who prefer a graphical interface, an interactive Mendelian Cross Solver is available in the browser.

The web interface adds a live grid, 28 curated textbook presets, collapsible walkthroughs, PNG/SVG export, copy-grid-as-table, shareable permalinks, and print-friendly display.

Documentation and Resources

Source code and issue tracking: github.com/pepkio/pepkio-mendelian-cross-solver

Web calculator: pepkio.com/tools/mendelian-cross-solver

About Pepkio

Pepkio develops software tools and provides bioinformatics analysis services for life science research. See pepkio.com for additional calculators and analysis services.

Keywords

Punnett square, Mendelian cross, monohybrid cross, dihybrid cross, incomplete dominance, codominance, ABO blood type cross, X-linked inheritance, sex-linked Punnett square, genetics ratio calculator, hemophilia cross, snapdragon flower color, pepkio-mendelian-cross-solver, Python Punnett square API, REST API genetics, phenotype ratio 3:1, dihybrid 9:3:3:1, how to cross Aa x Aa Python, ABO I^A i x I^B i offspring ratio, X-linked carrier female Punnett square API, incomplete dominance Rr x Rr check homework, export Punnett square from script, automate genetics teaching examples, Mendelian cross walkthrough API, five inheritance modes one client

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pepkio_mendelian_cross_solver-0.1.0.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pepkio_mendelian_cross_solver-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pepkio_mendelian_cross_solver-0.1.0.tar.gz.

File metadata

  • Download URL: pepkio_mendelian_cross_solver-0.1.0.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pepkio_mendelian_cross_solver-0.1.0.tar.gz
Algorithm Hash digest
SHA256 471c367df3a504140cc4c51ac470752feb4ba25188172df27305f430326de3da
MD5 d64708aa2754848fe6836e4add2ae990
BLAKE2b-256 494f3f0789515ec186adb53de94a4a00555b427c789e450c5faf0052892ca14d

See more details on using hashes here.

File details

Details for the file pepkio_mendelian_cross_solver-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pepkio_mendelian_cross_solver-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for pepkio_mendelian_cross_solver-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9cb792bc7bce4c50fdc56cc9a19b2f2df435174d98bef186e9f5410fef85b8f5
MD5 919cd9987e7f3e78a58ccc8a39c50b31
BLAKE2b-256 4d2b9bf1ccc60a5efc9722fc5205b0f387f849b6f450b2d404dad4a4ce6aba98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page