Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions plugins/Presisitence/rnaseq-plot/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Presisitence

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
39 changes: 39 additions & 0 deletions plugins/Presisitence/rnaseq-plot/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# rnaseq-plot

RNA-seq **downstream plotting** for MiniMax Code (formerly published as `rgraph`).
Parameterized R scripts (ggplot2, pheatmap, clusterProfiler, edgeR, limma, WGCNA, …)
are exposed as MCP tools and rendered by the user's local **Rscript** to png + pdf.

The Plugin consumes the user's own count/FPKM tables. It does not ship genomes or experimental matrices.
`tests/data/` is a tiny synthetic `g1`–`g10` table for smoke tests.

MCP **tool names remain `rgraph_*`** (for example `rgraph_volcano`) so existing prompts keep working.

## Try it

```text
I have gene_count.csv and sample_group.csv. Run DESeq2 for treatment vs control, then draw a
volcano plot (label top 8 genes, padj < 0.05, |log2FC| > 1) and a clustered heatmap of DEGs.
```

Expected result: the agent calls `rgraph_env`, then `rgraph_diff(method="deseq2")` and
`rgraph_volcano` / `rgraph_heatmap`. Output png+pdf paths are returned. DEG calls use **padj**
by default. If R or a package is missing, the tool returns install commands instead of crashing.

## Requirements

- Python 3.10+ and [uv](https://docs.astral.sh/uv/) on PATH.
- R with `Rscript` on PATH, or set `RGRAPH_RSCRIPT` to the Rscript executable.
- Common R packages: ggplot2, pheatmap, edgeR or DESeq2 or limma, clusterProfiler as needed.
Missing packages are reported with CRAN/Bioconductor install lines.
- Windows, macOS, and Linux.

## Data and network

- Default analyses are local: user CSVs in, png/pdf out. No telemetry.
- `rgraph_ppi` may contact STRING (`string-db.org`) when the user asks for a PPI edge table.
- No credentials in the package.

## License

MIT. See [LICENSE](LICENSE). Source: https://github.com/Presisitence/rnaseq-plot-mcp
11 changes: 11 additions & 0 deletions plugins/Presisitence/rnaseq-plot/mcp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
"mcpServers": {
"rnaseq-plot": {
"type": "stdio",
"command": "uv",
"args": ["run", "server.py"],
"cwd": "${PLUGIN_ROOT}"
}
}
}
24 changes: 24 additions & 0 deletions plugins/Presisitence/rnaseq-plot/plugin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
"name": "rnaseq-plot",
"version": "0.1.1",
"description": "RNA-seq downstream plotting via local Rscript: DESeq2/edgeR/limma, volcano, heatmap, GSEA, WGCNA (png+pdf).",
"author": {
"name": "Presisitence",
"url": "https://github.com/Presisitence"
},
"homepage": "https://github.com/Presisitence/rnaseq-plot-mcp",
"repository": "https://github.com/Presisitence/rnaseq-plot-mcp",
"license": "MIT",
"keywords": [
"minimax-code",
"plugin",
"mcp",
"rnaseq",
"deseq2",
"volcano",
"heatmap",
"ggplot2",
"wgcna"
]
}
23 changes: 23 additions & 0 deletions plugins/Presisitence/rnaseq-plot/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[project]
name = "rnaseq-plot-mcp"
version = "0.1.1"
description = "RNA-seq 下游出图 MCP:把一套 R (ggplot2/pheatmap/clusterProfiler/WGCNA...) 脚本封装为工具,由本机 Rscript 渲染 png+pdf"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
dependencies = [
"mcp[cli]>=1.2.0",
]

[project.scripts]
rgraph-cli = "rgraph_toolkit.cli:main"

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["rgraph_toolkit"]

[tool.hatch.build.targets.wheel.force-include]
"rscripts" = "rgraph_toolkit/rscripts"
6 changes: 6 additions & 0 deletions plugins/Presisitence/rnaseq-plot/rgraph_toolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""rgraph_toolkit: 把一套 RNAseq 下游 R 出图脚本参数化封装为 MCP 工具。"""
from __future__ import annotations

from . import runner

__all__ = ["runner"]
34 changes: 34 additions & 0 deletions plugins/Presisitence/rnaseq-plot/rgraph_toolkit/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"""命令行自检入口:`rgraph-cli` 检查 R 引擎与关键包是否就绪。"""
from __future__ import annotations

import sys

from . import runner

_KEY_PKGS = [
"ggplot2", "dplyr", "tidyr", "stringr", "pheatmap", "ggrepel",
"DESeq2", "edgeR", "limma", "clusterProfiler", "enrichplot",
"pathview", "circlize", "ComplexHeatmap", "WGCNA", "VennDiagram",
"GSVA", "fgsea", "ggpubr", "patchwork", "reshape2",
]


def main() -> int:
rscript = runner.find_rscript()
print(f"Rscript: {rscript or '未找到 (设置 RGRAPH_RSCRIPT 或安装 R)'}")
print(f"rscripts 目录: {runner.rscripts_dir()}")
if not rscript:
return 1
status = runner.check_packages(_KEY_PKGS, rscript=rscript)
print("\nR 包状态:")
for pkg, ok in status.items():
print(f" [{'x' if ok else ' '}] {pkg}")
missing = [p for p, ok in status.items() if not ok]
if missing:
print("\n缺失包安装建议:")
print(" " + runner._install_hint(missing))
return 0


if __name__ == "__main__":
sys.exit(main())
Loading