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/microbe/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/microbe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# microbe

Downstream **16S / ITS** microbiome analysis for MiniMax Code. vegan, DESeq2, edgeR, igraph,
Hmisc, randomForest, and ggtree scripts are wrapped as MCP tools and rendered by local **Rscript**.

Figure types follow two public papers for layout (the Plugin does not include their data):

- Liu et al. 2023, *Nature Microbiology*
- Zhou et al. 2022, *Nature Communications*

Does not run DADA2/QIIME2. Start from a feature table.

## Try it

```text
I have feature_table.csv, taxonomy.csv, and metadata.csv (groups DP vs DSP). Draw alpha and beta
diversity, a genus stacked bar, DESeq2 differential abundance, and a co-occurrence network.
```

Expected result: the agent calls `microbe_env`, then `microbe_alpha`, `microbe_beta`,
`microbe_composition`, `microbe_diff`, and `microbe_network`. png+pdf paths and key statistics
are returned. Synthetic tables can be generated with `python tests/prep_test.py` for a dry run.

## Requirements

- Python 3.10+ and [uv](https://docs.astral.sh/uv/) on PATH.
- R with `Rscript` on PATH, or set `MICROBE_RSCRIPT`.
- R packages such as vegan, ggplot2, igraph; DESeq2/edgeR optional (tools degrade with install hints).
- Windows, macOS, and Linux.

## Data and network

- Analyses are local on user CSVs. No telemetry.
- No credentials in the package.
- `tests/prep_test.py` writes synthetic OTU-like tables only.

## License

MIT. See [LICENSE](LICENSE).
11 changes: 11 additions & 0 deletions plugins/Presisitence/microbe/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": {
"microbe": {
"type": "stdio",
"command": "uv",
"args": ["run", "server.py"],
"cwd": "${PLUGIN_ROOT}"
}
}
}
6 changes: 6 additions & 0 deletions plugins/Presisitence/microbe/microbe_toolkit/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""microbe_toolkit: 把一套下游微生物组/扩增子分析 R 脚本参数化封装为 MCP 工具。"""
from __future__ import annotations

from . import runner

__all__ = ["runner"]
33 changes: 33 additions & 0 deletions plugins/Presisitence/microbe/microbe_toolkit/cli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""命令行自检入口:`microbe-cli` 检查 R 引擎与关键微生物组分析包是否就绪。"""
from __future__ import annotations

import sys

from . import runner

_KEY_PKGS = [
"vegan", "ggplot2", "ggpubr", "dplyr", "tidyr", "reshape2", "pheatmap",
"ggrepel", "igraph", "Hmisc", "randomForest", "ape", "scales", "circlize",
"ggalluvial", "edgeR", "DESeq2", "ggtree", "phyloseq", "SpiecEasi",
]


def main() -> int:
rscript = runner.find_rscript()
print(f"Rscript: {rscript or '未找到 (设置 MICROBE_RSCRIPT 或安装 R)'}")
print(f"mscripts 目录: {runner.mscripts_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