Metadata-Version: 2.5
Name: pepkio-hypothesis-canvas
Version: 0.1.0
Summary: Python client for Pepkio hypothesis-canvas tool
Author-email: Pepkio Team <support@pepkio.com>
License-File: LICENSE
Requires-Python: >=3.10
Requires-Dist: click>=8.1.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Description-Content-Type: text/markdown

# Pepkio Hypothesis Canvas

A Python client and workflow tool for structured scientific ideation, mapping observations, hypotheses, and experiments into connected reasoning graphs with automated layout and Markdown export.

# What It Does

Scientific inquiry requires rigorous formulation of hypotheses connecting empirical observations to falsifiable experiments and predicted outcomes. Without formal visual or graph representations, research reasoning can become ambiguous, overlook rival hypotheses, or fail to define concrete validation criteria.

The **Pepkio Hypothesis Canvas** provides an interactive and programmatic canvas for structured scientific ideation. It models scientific reasoning using typed nodes—observations, hypotheses, experiments, predicted results, and alternative explanations—linked by semantic relationships ("suggests", "tested by", "expects", "challenged by").

This Python package provides a typed client and CLI to interact with the Pepkio Hypothesis Canvas API. Researchers can validate canvas JSON structures, compute automated hierarchical graph layouts, generate Markdown outlines of scientific arguments, and export research briefs for lab meetings, grant applications, or electronic lab notebooks (ELNs).

Programmatic runs process through the Pepkio Tools API and require network access and a valid API key.

# Features

- **Typed Scientific Graph**: Models research reasoning with 5 dedicated node types (`observation`, `hypothesis`, `experiment`, `predicted_result`, `alternative_explanation`).
- **Semantic Relationship Edges**: Connects evidence and reasoning with directed semantic relations (`suggests`, `tested by`, `expects`, `challenged by`).
- **Automated Graph Layout**: Algorithmic rank-based column positioning (`auto_layout`) organized by node hierarchy and experimental flow.
- **Hypothesis Validation Tracking**: Assign and track validation status badges (`untested`, `supported`, `disproven`) across hypotheses and alternative explanations.
- **Markdown & JSON Export**: Export structured graphs to publication-ready Markdown outlines (`outline` or `export`) and portable JSON schemas.
- **Schema Validation**: Built-in verification (`validate_json`) for portable canvas backup files and pipeline integration.
- **Python Client & CLI**: Fully typed `PepkioClient` with context manager support, alongside command-line tools (`pepkio-hypothesis-canvas`).

# Installation

```bash
pip install pepkio-hypothesis-canvas
```

Set an API key with **tools:run** scope before executing actions:

```bash
export PEPKIO_API_KEY="your-key"
```

Create an API key in your [Pepkio account settings](https://www.pepkio.com/account/api-keys).

# Quick Example

```python
from pepkio_hypothesis_canvas import PepkioClient

with PepkioClient() as client:
    # 1. Inspect manifest capabilities
    manifest = client.get_manifest()
    print("Tool Title:", manifest["title"])

    # 2. Run export action to generate a structured Markdown outline
    result = client.run({
        "action": "export",
        "format": "markdown",
        "canvas": {
            "name": "Synthetic Lethality Project",
            "nodes": [
                {
                    "id": "n1",
                    "type": "observation",
                    "title": "BRCA1-deficient tumors show marked hypersensitivity to PARP inhibitors",
                    "notes": "Validated across multiple patient-derived xenograft lines.",
                    "status": "untested"
                },
                {
                    "id": "n2",
                    "type": "hypothesis",
                    "title": "Replication fork collapse in HR-deficient cells creates synthetic lethality",
                    "status": "supported"
                },
                {
                    "id": "n3",
                    "type": "experiment",
                    "title": "Neutral comet assay and DNA fiber analysis post-olaparib exposure",
                    "status": "untested"
                }
            ],
            "edges": [
                {"id": "e1", "fromId": "n1", "toId": "n2", "label": "suggests"},
                {"id": "e2", "fromId": "n2", "toId": "n3", "label": "tested by"}
            ]
        }
    })

    print("Status:", result.status)
    print("Exported Markdown:\n", result.result["content"])
```

CLI:

```bash
pepkio-hypothesis-canvas manifest
pepkio-hypothesis-canvas run --example export_markdown_example
```

Manifest inspection (`get_manifest()`, `list_examples()`) does not require an API key.

# Typical Use Cases

- **Experimental Project Scoping**: Map raw observations into structured hypotheses and validation experiments before allocating bench resources.
- **Grant & Manuscript Outlining**: Formalize specific aims and mechanistic rationale into structured, reviewable Markdown reasoning trees.
- **Lab Meeting & Journal Club Discussion**: Clearly visualize evidence flow, tested assumptions, and alternative explanations during group critiques.
- **Falsification & Negative Control Design**: Systematically introduce rival explanations (`alternative_explanation`) and define counter-experiments.
- **ELN & Computational Pipeline Documentation**: Programmatically export reproducible hypothesis graphs into electronic laboratory notebooks.

# Scientific Background

Structured hypothesis formulation formalizes the hypothetico-deductive framework as a directed reasoning network $G = (V, E)$.

The node set $V$ categorizes epistemic components into disjoint subsets:
$$V = V_{\text{obs}} \cup V_{\text{hyp}} \cup V_{\text{exp}} \cup V_{\text{pred}} \cup V_{\text{alt}}$$

Directed edges $e = (u, v) \in E$ establish causal and epistemic links:
- $(v_{\text{obs}}, v_{\text{hyp}}) \to \text{suggests}$ (inductive abduction)
- $(v_{\text{hyp}}, v_{\text{exp}}) \to \text{tested by}$ (operational deduction)
- $(v_{\text{exp}}, v_{\text{pred}}) \to \text{expects}$ (predictive consequence)
- $(v_{\text{exp}}, v_{\text{alt}}) \to \text{challenged by}$ (falsification / rival hypothesis)

Algorithmic layout arranges vertices into ranked topological columns according to inferential stage, highlighting critical inferential paths and ensuring transparent peer review.

# Web Application

For researchers who prefer a graphical interface, an interactive web version is available.

Web Application: https://www.pepkio.com/tools/hypothesis-canvas

The web version provides interactive node dragging, auto-layout, color-coded status badges, localStorage auto-save, and client-side PNG/SVG rendering.

# Documentation and Resources

GitHub Repository: https://github.com/pepkio/pepkio-hypothesis-canvas

Web Application: https://www.pepkio.com/tools/hypothesis-canvas

# About Pepkio

Pepkio (https://www.pepkio.com/) develops software tools and bioinformatics solutions for life science researchers, including laboratory calculators and analysis services (https://www.pepkio.com/cro). See https://www.pepkio.com for additional tools and services.

# Keywords

scientific ideation, hypothesis canvas, experiment design, hypothesis mapping, scientific reasoning graph, lab meeting ideation, observation hypothesis experiment, falsification planning, rival hypothesis, alternative explanations, research reasoning tree, electronic lab notebook outline, grant specific aims planning, auto layout scientific graph, markdown experiment outline, structured hypothesis formulation, research concept map, lab operations tool, scientific methodology mapping, causal reasoning network, pepkio-hypothesis-canvas, Python hypothesis client, ideation canvas API, export hypothesis graph markdown, automated rank layout experiment nodes, validate hypothesis canvas json, design falsifiable biological experiments, map observations to testable hypotheses, grant proposal aim structure generator, lab notebook hypothesis tracking Python

A semantic, AI-native version of this document in the K2F format is available at https://k2f.dev (https://k2f.dev/v/9510225d174523f58c65143dbf122dca9cc35e9515a7f1f63b6a9185863d64e0)
