monadomics 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. monadomics-0.2.3/LICENSE +202 -0
  2. monadomics-0.2.3/MANIFEST.in +6 -0
  3. monadomics-0.2.3/PKG-INFO +180 -0
  4. monadomics-0.2.3/README.md +164 -0
  5. monadomics-0.2.3/docs/RELEASE.md +108 -0
  6. monadomics-0.2.3/docs/plans/2026-07-25-p0-p2-repair-design.md +35 -0
  7. monadomics-0.2.3/docs/plans/2026-09-14-workbuddy-kit-design.md +14 -0
  8. monadomics-0.2.3/docs/plans/2026-09-19-statistical-correctness-design.md +24 -0
  9. monadomics-0.2.3/docs/plans/2026-09-20-lightweight-checkpoints-design.md +21 -0
  10. monadomics-0.2.3/install.py +160 -0
  11. monadomics-0.2.3/pyproject.toml +31 -0
  12. monadomics-0.2.3/scripts/build_workbuddy_connector.py +80 -0
  13. monadomics-0.2.3/setup.cfg +4 -0
  14. monadomics-0.2.3/src/monadomics/__init__.py +1 -0
  15. monadomics-0.2.3/src/monadomics/__main__.py +3 -0
  16. monadomics-0.2.3/src/monadomics/backend.py +391 -0
  17. monadomics-0.2.3/src/monadomics/cli.py +80 -0
  18. monadomics-0.2.3/src/monadomics/r/bootstrap.R +119 -0
  19. monadomics-0.2.3/src/monadomics/r/deg.R +303 -0
  20. monadomics-0.2.3/src/monadomics/r/enrich.R +337 -0
  21. monadomics-0.2.3/src/monadomics/r/lib/annotation.R +34 -0
  22. monadomics-0.2.3/src/monadomics/r/lib/common.R +221 -0
  23. monadomics-0.2.3/src/monadomics/r/plots.R +320 -0
  24. monadomics-0.2.3/src/monadomics/r/survival.R +437 -0
  25. monadomics-0.2.3/src/monadomics.egg-info/PKG-INFO +180 -0
  26. monadomics-0.2.3/src/monadomics.egg-info/SOURCES.txt +49 -0
  27. monadomics-0.2.3/src/monadomics.egg-info/dependency_links.txt +1 -0
  28. monadomics-0.2.3/src/monadomics.egg-info/entry_points.txt +2 -0
  29. monadomics-0.2.3/src/monadomics.egg-info/top_level.txt +1 -0
  30. monadomics-0.2.3/tests/checkpoint_regression.R +121 -0
  31. monadomics-0.2.3/tests/fixtures/coldata.csv +13 -0
  32. monadomics-0.2.3/tests/fixtures/counts.csv +51 -0
  33. monadomics-0.2.3/tests/fixtures/logged.csv +51 -0
  34. monadomics-0.2.3/tests/fixtures/survival.csv +201 -0
  35. monadomics-0.2.3/tests/make_fixtures.py +99 -0
  36. monadomics-0.2.3/tests/run_acceptance.py +92 -0
  37. monadomics-0.2.3/tests/smoke_cli.sh +7 -0
  38. monadomics-0.2.3/tests/statistical_regression.R +132 -0
  39. monadomics-0.2.3/tests/test_backend.py +391 -0
  40. monadomics-0.2.3/tests/test_cli.py +119 -0
  41. monadomics-0.2.3/tests/test_install.py +127 -0
  42. monadomics-0.2.3/tests/test_statistical_regression.py +25 -0
  43. monadomics-0.2.3/workbuddy-connector/cli.json +8 -0
  44. monadomics-0.2.3/workbuddy-connector/connector-meta.json +24 -0
  45. monadomics-0.2.3/workbuddy-connector/icon.svg +7 -0
  46. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/SKILL.md +60 -0
  47. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/references/analysis.md +41 -0
  48. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/references/commands.md +127 -0
  49. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/references/data-preparation.md +48 -0
  50. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/references/examples.md +82 -0
  51. monadomics-0.2.3/workbuddy-connector/skills/monadomics-analysis/references/installation.md +51 -0
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,6 @@
1
+ recursive-include src/monadomics/r *.R
2
+ recursive-include workbuddy-connector *.json *.md *.svg
3
+ recursive-include tests *.py *.sh *.csv *.R
4
+ recursive-include docs *.md
5
+ include scripts/build_workbuddy_connector.py
6
+ include install.py
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: monadomics
3
+ Version: 0.2.3
4
+ Summary: Local R-backed bioinformatics workflows for WorkBuddy
5
+ Author: MonadOmics
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/daisyluvr42/monad_omicskit
8
+ Keywords: bioinformatics,omics,workbuddy,bioconductor
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
12
+ Requires-Python: >=3.11
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Dynamic: license-file
16
+
17
+ # MonadOmics 生信工具箱
18
+
19
+ MonadOmics 0.2.3 把原 Omics Skill + MCP 整理为 **一个本地 CLI + 一个主 Skill**,另附 WorkBuddy 市场连接器包。本机 Python CLI 调用 R,保留差异表达、功能富集、组学作图和预后建模等 21 项能力;数值和图来自实际计算。
20
+
21
+ **支持 GitHub 安装和 PyPI CLI 安装。** GitHub 安装器直接部署 CLI 运行文件和主 Skill;PyPI 提供 `monadomics` 命令,WorkBuddy 市场连接器另附主 Skill。市场安装仍需通过腾讯审核。
22
+
23
+ ## 能做什么
24
+
25
+ | 工作 | 实现 |
26
+ |---|---|
27
+ | 矩阵与样本检查 | 数据类型、样本注释、PCA |
28
+ | 差异表达 | DESeq2、edgeR、limma、limma-voom、协变量、多重校正 |
29
+ | 功能富集 | GO、KEGG、Reactome、GSEA、GSVA/ssGSEA |
30
+ | 组学图 | PCA、火山图、热图、2–4 组 Venn 与区域成员表 |
31
+ | 预后模型 | LASSO-Cox、风险评分、KM、时间依赖 ROC、列线图、校准、DCA |
32
+
33
+ 用户可以提供检测公司的结果文件夹、压缩包或完整数据表,附已有报告和样本分组说明。主 Skill 先扫描材料与已有对话,集中询问影响当前分析的必要信息缺口,再指导模型使用宿主工具提取规范表格,保存后与原表及报告校验,通过后调用分析。用户补充与来源记入 `input-check.md`,后续复用;仅暂停受缺失信息影响的步骤。这里只统一文件和字段格式,不改变表达量单位或做统计归一化;详见 [输入整理规范](https://github.com/daisyluvr42/monad_omicskit/blob/main/workbuddy-connector/skills/monadomics-analysis/references/data-preparation.md)。CLI 本身仍接收整理后的数据,不新增厂商导入命令。
34
+
35
+ 这不是完整的 GEO/TCGA 下载器或 Seurat 单细胞流水线。单细胞 pseudobulk count 可以进入差异分析。
36
+
37
+ ## GitHub 安装和第一次运行
38
+
39
+ 需要 Python 3.11+;实际分析还需要 R 4.2+ 和对应 R 包。使用 GitHub CLI 克隆仓库并安装:
40
+
41
+ ```bash
42
+ gh repo clone https://github.com/daisyluvr42/monad_omicskit.git
43
+ cd monad_omicskit
44
+ python3 install.py install
45
+ python3 install.py run --version
46
+ python3 install.py run doctor --group deg
47
+ ```
48
+
49
+ 没有 `gh` 时,第一步使用 `git clone https://github.com/daisyluvr42/monad_omicskit.git`。Windows 将 `python3` 换为 `py -3.12`。安装器只使用 Python 标准库,不下载 Python 依赖,也不自动安装 R/Bioconductor。
50
+
51
+ 安装位置为 `~/.workbuddy/skills/monadomics-analysis`,包含主 Skill、输入校验规范和 Python/R 运行文件。安装后的 Skill 会注明本机解释器与 CLI 的完整路径,WorkBuddy 无需依赖终端 PATH 或激活虚拟环境。安装时使用的 Python 解释器需继续保留。安装后刷新技能或重启 WorkBuddy,再用自然语言提交分析任务。
52
+
53
+ ### 从旧 MCP 版升级
54
+
55
+ 在原仓库目录执行下面的命令,不再使用旧的 `mcp/omics.py update workbuddy`:
56
+
57
+ ```bash
58
+ git pull --ff-only
59
+ python3 install.py install
60
+ ```
61
+
62
+ 安装器会备份原 `omics-analysis` Skill,并停用配置中指向旧 `mcp/omics_mcp.py` 的 `omics` MCP;其他连接器保持不变。旧配置和 Skill 保存在 `~/.workbuddy/monadomics-backups/`,分析数据与 R 包保留。重启 WorkBuddy 使旧 MCP 停用生效。
63
+
64
+ ### 更新与卸载
65
+
66
+ ```bash
67
+ python3 install.py update
68
+ python3 install.py uninstall
69
+ ```
70
+
71
+ `update` 先检查仓库没有未保存的改动,再执行 `git pull --ff-only`,使用拉取后的新安装器刷新 CLI 与 Skill。下载源码压缩包的用户应下载新包后执行 `install`。卸载将本 kit 的 Skill 和运行文件移入备份目录,不删除 R 包、分析输出,也不会自动重新启用旧 MCP。
72
+
73
+ 如需隔离安装位置,使用 `python3 install.py --workbuddy-dir <目录> install`,之后的 `run`/`update`/`uninstall` 使用同一选项;默认位置无需指定。
74
+
75
+ ### 准备分析环境
76
+
77
+ R 本体从 [CRAN](https://cran.r-project.org/) 或对应系统渠道准备。R 不在 PATH 时,将 `OMICS_RSCRIPT` 设为实际 Rscript/Rscript.exe 的绝对路径。macOS 会额外识别官方 R 和常见 Homebrew 安装位置。
78
+
79
+ R 包与连接器初始化分开:
80
+
81
+ ```bash
82
+ python3 install.py run setup-r deg
83
+ python3 install.py run doctor --group deg
84
+ ```
85
+
86
+ 模块:`core`、`deg`、`enrich`、`plot`、`survival`、`all`。setup-r 把缺失依赖安装到 R 的个人库 `R_LIBS_USER`,安装日志在 stderr;doctor 不安装任何东西。首次 Bioconductor 安装可能较久,不放进 WorkBuddy init。系统编译库仍由操作系统准备;未安装完不能进行相应分析。
87
+
88
+ ## 调用分析
89
+
90
+ 将参数保存为 `deg.json`,例如:
91
+
92
+ ```json
93
+ {
94
+ "method": "deseq2",
95
+ "matrix_type": "counts",
96
+ "matrix_path": "counts.csv",
97
+ "coldata_path": "samples.csv",
98
+ "group_column": "group",
99
+ "treat": "disease",
100
+ "control": "control",
101
+ "output_name": "disease_vs_control"
102
+ }
103
+ ```
104
+
105
+ ```bash
106
+ python3 install.py run deg --params deg.json --output-dir analysis-results
107
+ python3 install.py run schema enrich
108
+ python3 install.py run capabilities
109
+ ```
110
+
111
+ - `deg`、`enrich`、`plot`、`survival` 均读取 `--params` 指定的 JSON 对象;`--params -` 读取标准输入。
112
+ - 相对输入路径以命令工作目录为准;矩阵为基因×样本,首列基因 ID;样本表首列样本 ID。支持 CSV/TSV 或 schema 说明的内联记录,不直接读取 XLSX。
113
+ - 分析成功:退出 0,stdout 为 `ok: true` 的 JSON,含结果与文件路径。分析失败:退出 1,JSON 含 `ok: false` 与错误信息。命令用法错误:退出 2。
114
+ - `--output-dir` 控制产物目录;默认 `~/.workbuddy/workspace/omics`,也支持 `OMICS_OUTPUT_DIR`。
115
+ - 分析默认超时 900 秒,作图 600 秒;可按需要传 `--timeout`。长任务使用宿主命令进程的等待能力,不反复重跑同一分析。
116
+
117
+ 参数和场景例子见 [主 Skill](https://github.com/daisyluvr42/monad_omicskit/blob/main/workbuddy-connector/skills/monadomics-analysis/SKILL.md) 及其 references。
118
+
119
+ Skill 在分析前、工具返回后、交付前三个节点核对语义和依据,复用现有参数与结果记录,不要求逐步审批。工具自动拒绝重复/空 ID、缺失样本注释及不可估计的设计;DEG 返回实际两组拟合范围,显式提供 `species`/`id_type` 时附数据库注释。富集区分 ID 映射数与有效注释分母,零显著结果可以正常交付。矩阵重复基因不会再静默求和或择一,需在数据清洗时有依据地处理。
120
+
121
+ ## PyPI 安装与 WorkBuddy 市场包
122
+
123
+ 在 Python 3.11+ 虚拟环境中安装固定版本,获得 PATH 中的 `monadomics` 命令;其参数与 `python3 install.py run` 一致。GitHub 安装不需要这一步。
124
+
125
+ ```bash
126
+ python -m pip install --upgrade monadomics==0.2.3
127
+ monadomics --version
128
+ monadomics doctor --group deg
129
+ ```
130
+
131
+ PyPI 包包含 Python CLI 和 R 分析脚本,不会自动安装 WorkBuddy Skill、R 本体或 Bioconductor 依赖。需要在 WorkBuddy 中使用时,选择上面的 GitHub 安装方式或经审核上架的市场连接器。R 包可在 R 就绪后执行 `monadomics setup-r deg` 安装。
132
+
133
+ ```text
134
+ workbuddy-connector/
135
+ ├── connector-meta.json
136
+ ├── cli.json
137
+ ├── icon.svg
138
+ └── skills/monadomics-analysis/
139
+ ├── SKILL.md
140
+ └── references/
141
+ ```
142
+
143
+ `cli.json` 声明 WorkBuddy 托管 Python 3.12,最低 WorkBuddy 5.0.0;macOS/Linux/Windows 都使用固定版本的 pip 安装命令。无登录和 API Key,不配置虚构的 auth/status/unAuth。连接器只声明 CLI,不混入 MCP。
144
+
145
+ ```bash
146
+ python -m pip install build
147
+ python -m build
148
+ python scripts/build_workbuddy_connector.py
149
+ ```
150
+
151
+ 生成 Python wheel、sdist,以及 `dist/monadomics-workbuddy-0.2.3.zip`。ZIP 根目录直接包含 connector-meta.json 等文件,符合 [WorkBuddy 连接器规范](https://open.workbuddy.cn/en/docs/connector) 和 [Skill 规范](https://open.workbuddy.cn/en/docs/skill)。
152
+
153
+ **市场连接器锁定 PyPI 上的 `monadomics==0.2.3`,并需通过 WorkBuddy 审核。** PyPI 发布、本地 wheel 安装和 ZIP 校验均不代表已经在 WorkBuddy 市场上架;当前验证范围见 [RELEASE.md](https://github.com/daisyluvr42/monad_omicskit/blob/main/docs/RELEASE.md)。提交 WorkBuddy 的是连接器 ZIP,Python 包由 init 从 PyPI 安装。GitHub 路线直接部署源码,不依赖该市场初始化命令。
154
+
155
+ 旧 0.1 MCP 代码在 Git 历史中保留。0.2 使用新 Skill `monadomics-analysis`,旧版迁移由上述 GitHub 安装器完成。
156
+
157
+ ## 科学与数据边界
158
+
159
+ - 原始 count 与标准化/log2 表达必须区分;`normalized` 不代表已采用适当 log2 尺度。DESeq2/edgeR 拒绝非原始 count。
160
+ - 富集需确认物种、ID 类型和背景。GSEA 需要完整排序列表;GSVA/ssGSEA 需要提供来源明确的 `gene_sets`,不会自动下载默认基因集。
161
+ - 基因、通路、P 值、系数不能由模型编造。报告未映射 ID、校正方法和工具警告;富集是关联证据。
162
+ - 生存时间单位、事件编码、候选变量来源须明确。训练集 C-index/AUC 不代表外部验证或临床有效性。
163
+ - 本地计算不上传表达/生存表至另一分析服务器;R 安装、KEGG 等网络功能会访问公共资源。宿主读取的对话和工具输出按 WorkBuddy 自身规则处理。
164
+
165
+ ## 验证
166
+
167
+ ```bash
168
+ python -m pip install -e .
169
+ OMICS_OUTPUT_DIR="$PWD/test-output" python -m unittest discover -s tests -v
170
+ bash tests/smoke_cli.sh
171
+ python tests/run_acceptance.py --output-dir test-output/acceptance
172
+ ```
173
+
174
+ 测试数据均为固定种子的合成数据,不是公开患者数据或生物学发现。完整测试需要对应 R 包;缺包时后端测试会明确 skip,不能把 skip 当作分析通过。独立 wheel 验收应使用新环境安装 wheel,从源码目录之外运行 `tests/run_acceptance.py`,并检查生成的表和图。
175
+
176
+ ## 许可证
177
+
178
+ Copyright 2026 MonadOmics contributors.
179
+
180
+ MonadOmics 的项目代码、主 Skill 和随附文档采用 [Apache License 2.0](https://github.com/daisyluvr42/monad_omicskit/blob/main/LICENSE)。完整许可证随 Python wheel、源码包和 WorkBuddy 连接器 ZIP 分发;GitHub 安装器也会保留许可证。R、Bioconductor 及其他外部依赖和数据仍遵循各自的许可证。
@@ -0,0 +1,164 @@
1
+ # MonadOmics 生信工具箱
2
+
3
+ MonadOmics 0.2.3 把原 Omics Skill + MCP 整理为 **一个本地 CLI + 一个主 Skill**,另附 WorkBuddy 市场连接器包。本机 Python CLI 调用 R,保留差异表达、功能富集、组学作图和预后建模等 21 项能力;数值和图来自实际计算。
4
+
5
+ **支持 GitHub 安装和 PyPI CLI 安装。** GitHub 安装器直接部署 CLI 运行文件和主 Skill;PyPI 提供 `monadomics` 命令,WorkBuddy 市场连接器另附主 Skill。市场安装仍需通过腾讯审核。
6
+
7
+ ## 能做什么
8
+
9
+ | 工作 | 实现 |
10
+ |---|---|
11
+ | 矩阵与样本检查 | 数据类型、样本注释、PCA |
12
+ | 差异表达 | DESeq2、edgeR、limma、limma-voom、协变量、多重校正 |
13
+ | 功能富集 | GO、KEGG、Reactome、GSEA、GSVA/ssGSEA |
14
+ | 组学图 | PCA、火山图、热图、2–4 组 Venn 与区域成员表 |
15
+ | 预后模型 | LASSO-Cox、风险评分、KM、时间依赖 ROC、列线图、校准、DCA |
16
+
17
+ 用户可以提供检测公司的结果文件夹、压缩包或完整数据表,附已有报告和样本分组说明。主 Skill 先扫描材料与已有对话,集中询问影响当前分析的必要信息缺口,再指导模型使用宿主工具提取规范表格,保存后与原表及报告校验,通过后调用分析。用户补充与来源记入 `input-check.md`,后续复用;仅暂停受缺失信息影响的步骤。这里只统一文件和字段格式,不改变表达量单位或做统计归一化;详见 [输入整理规范](https://github.com/daisyluvr42/monad_omicskit/blob/main/workbuddy-connector/skills/monadomics-analysis/references/data-preparation.md)。CLI 本身仍接收整理后的数据,不新增厂商导入命令。
18
+
19
+ 这不是完整的 GEO/TCGA 下载器或 Seurat 单细胞流水线。单细胞 pseudobulk count 可以进入差异分析。
20
+
21
+ ## GitHub 安装和第一次运行
22
+
23
+ 需要 Python 3.11+;实际分析还需要 R 4.2+ 和对应 R 包。使用 GitHub CLI 克隆仓库并安装:
24
+
25
+ ```bash
26
+ gh repo clone https://github.com/daisyluvr42/monad_omicskit.git
27
+ cd monad_omicskit
28
+ python3 install.py install
29
+ python3 install.py run --version
30
+ python3 install.py run doctor --group deg
31
+ ```
32
+
33
+ 没有 `gh` 时,第一步使用 `git clone https://github.com/daisyluvr42/monad_omicskit.git`。Windows 将 `python3` 换为 `py -3.12`。安装器只使用 Python 标准库,不下载 Python 依赖,也不自动安装 R/Bioconductor。
34
+
35
+ 安装位置为 `~/.workbuddy/skills/monadomics-analysis`,包含主 Skill、输入校验规范和 Python/R 运行文件。安装后的 Skill 会注明本机解释器与 CLI 的完整路径,WorkBuddy 无需依赖终端 PATH 或激活虚拟环境。安装时使用的 Python 解释器需继续保留。安装后刷新技能或重启 WorkBuddy,再用自然语言提交分析任务。
36
+
37
+ ### 从旧 MCP 版升级
38
+
39
+ 在原仓库目录执行下面的命令,不再使用旧的 `mcp/omics.py update workbuddy`:
40
+
41
+ ```bash
42
+ git pull --ff-only
43
+ python3 install.py install
44
+ ```
45
+
46
+ 安装器会备份原 `omics-analysis` Skill,并停用配置中指向旧 `mcp/omics_mcp.py` 的 `omics` MCP;其他连接器保持不变。旧配置和 Skill 保存在 `~/.workbuddy/monadomics-backups/`,分析数据与 R 包保留。重启 WorkBuddy 使旧 MCP 停用生效。
47
+
48
+ ### 更新与卸载
49
+
50
+ ```bash
51
+ python3 install.py update
52
+ python3 install.py uninstall
53
+ ```
54
+
55
+ `update` 先检查仓库没有未保存的改动,再执行 `git pull --ff-only`,使用拉取后的新安装器刷新 CLI 与 Skill。下载源码压缩包的用户应下载新包后执行 `install`。卸载将本 kit 的 Skill 和运行文件移入备份目录,不删除 R 包、分析输出,也不会自动重新启用旧 MCP。
56
+
57
+ 如需隔离安装位置,使用 `python3 install.py --workbuddy-dir <目录> install`,之后的 `run`/`update`/`uninstall` 使用同一选项;默认位置无需指定。
58
+
59
+ ### 准备分析环境
60
+
61
+ R 本体从 [CRAN](https://cran.r-project.org/) 或对应系统渠道准备。R 不在 PATH 时,将 `OMICS_RSCRIPT` 设为实际 Rscript/Rscript.exe 的绝对路径。macOS 会额外识别官方 R 和常见 Homebrew 安装位置。
62
+
63
+ R 包与连接器初始化分开:
64
+
65
+ ```bash
66
+ python3 install.py run setup-r deg
67
+ python3 install.py run doctor --group deg
68
+ ```
69
+
70
+ 模块:`core`、`deg`、`enrich`、`plot`、`survival`、`all`。setup-r 把缺失依赖安装到 R 的个人库 `R_LIBS_USER`,安装日志在 stderr;doctor 不安装任何东西。首次 Bioconductor 安装可能较久,不放进 WorkBuddy init。系统编译库仍由操作系统准备;未安装完不能进行相应分析。
71
+
72
+ ## 调用分析
73
+
74
+ 将参数保存为 `deg.json`,例如:
75
+
76
+ ```json
77
+ {
78
+ "method": "deseq2",
79
+ "matrix_type": "counts",
80
+ "matrix_path": "counts.csv",
81
+ "coldata_path": "samples.csv",
82
+ "group_column": "group",
83
+ "treat": "disease",
84
+ "control": "control",
85
+ "output_name": "disease_vs_control"
86
+ }
87
+ ```
88
+
89
+ ```bash
90
+ python3 install.py run deg --params deg.json --output-dir analysis-results
91
+ python3 install.py run schema enrich
92
+ python3 install.py run capabilities
93
+ ```
94
+
95
+ - `deg`、`enrich`、`plot`、`survival` 均读取 `--params` 指定的 JSON 对象;`--params -` 读取标准输入。
96
+ - 相对输入路径以命令工作目录为准;矩阵为基因×样本,首列基因 ID;样本表首列样本 ID。支持 CSV/TSV 或 schema 说明的内联记录,不直接读取 XLSX。
97
+ - 分析成功:退出 0,stdout 为 `ok: true` 的 JSON,含结果与文件路径。分析失败:退出 1,JSON 含 `ok: false` 与错误信息。命令用法错误:退出 2。
98
+ - `--output-dir` 控制产物目录;默认 `~/.workbuddy/workspace/omics`,也支持 `OMICS_OUTPUT_DIR`。
99
+ - 分析默认超时 900 秒,作图 600 秒;可按需要传 `--timeout`。长任务使用宿主命令进程的等待能力,不反复重跑同一分析。
100
+
101
+ 参数和场景例子见 [主 Skill](https://github.com/daisyluvr42/monad_omicskit/blob/main/workbuddy-connector/skills/monadomics-analysis/SKILL.md) 及其 references。
102
+
103
+ Skill 在分析前、工具返回后、交付前三个节点核对语义和依据,复用现有参数与结果记录,不要求逐步审批。工具自动拒绝重复/空 ID、缺失样本注释及不可估计的设计;DEG 返回实际两组拟合范围,显式提供 `species`/`id_type` 时附数据库注释。富集区分 ID 映射数与有效注释分母,零显著结果可以正常交付。矩阵重复基因不会再静默求和或择一,需在数据清洗时有依据地处理。
104
+
105
+ ## PyPI 安装与 WorkBuddy 市场包
106
+
107
+ 在 Python 3.11+ 虚拟环境中安装固定版本,获得 PATH 中的 `monadomics` 命令;其参数与 `python3 install.py run` 一致。GitHub 安装不需要这一步。
108
+
109
+ ```bash
110
+ python -m pip install --upgrade monadomics==0.2.3
111
+ monadomics --version
112
+ monadomics doctor --group deg
113
+ ```
114
+
115
+ PyPI 包包含 Python CLI 和 R 分析脚本,不会自动安装 WorkBuddy Skill、R 本体或 Bioconductor 依赖。需要在 WorkBuddy 中使用时,选择上面的 GitHub 安装方式或经审核上架的市场连接器。R 包可在 R 就绪后执行 `monadomics setup-r deg` 安装。
116
+
117
+ ```text
118
+ workbuddy-connector/
119
+ ├── connector-meta.json
120
+ ├── cli.json
121
+ ├── icon.svg
122
+ └── skills/monadomics-analysis/
123
+ ├── SKILL.md
124
+ └── references/
125
+ ```
126
+
127
+ `cli.json` 声明 WorkBuddy 托管 Python 3.12,最低 WorkBuddy 5.0.0;macOS/Linux/Windows 都使用固定版本的 pip 安装命令。无登录和 API Key,不配置虚构的 auth/status/unAuth。连接器只声明 CLI,不混入 MCP。
128
+
129
+ ```bash
130
+ python -m pip install build
131
+ python -m build
132
+ python scripts/build_workbuddy_connector.py
133
+ ```
134
+
135
+ 生成 Python wheel、sdist,以及 `dist/monadomics-workbuddy-0.2.3.zip`。ZIP 根目录直接包含 connector-meta.json 等文件,符合 [WorkBuddy 连接器规范](https://open.workbuddy.cn/en/docs/connector) 和 [Skill 规范](https://open.workbuddy.cn/en/docs/skill)。
136
+
137
+ **市场连接器锁定 PyPI 上的 `monadomics==0.2.3`,并需通过 WorkBuddy 审核。** PyPI 发布、本地 wheel 安装和 ZIP 校验均不代表已经在 WorkBuddy 市场上架;当前验证范围见 [RELEASE.md](https://github.com/daisyluvr42/monad_omicskit/blob/main/docs/RELEASE.md)。提交 WorkBuddy 的是连接器 ZIP,Python 包由 init 从 PyPI 安装。GitHub 路线直接部署源码,不依赖该市场初始化命令。
138
+
139
+ 旧 0.1 MCP 代码在 Git 历史中保留。0.2 使用新 Skill `monadomics-analysis`,旧版迁移由上述 GitHub 安装器完成。
140
+
141
+ ## 科学与数据边界
142
+
143
+ - 原始 count 与标准化/log2 表达必须区分;`normalized` 不代表已采用适当 log2 尺度。DESeq2/edgeR 拒绝非原始 count。
144
+ - 富集需确认物种、ID 类型和背景。GSEA 需要完整排序列表;GSVA/ssGSEA 需要提供来源明确的 `gene_sets`,不会自动下载默认基因集。
145
+ - 基因、通路、P 值、系数不能由模型编造。报告未映射 ID、校正方法和工具警告;富集是关联证据。
146
+ - 生存时间单位、事件编码、候选变量来源须明确。训练集 C-index/AUC 不代表外部验证或临床有效性。
147
+ - 本地计算不上传表达/生存表至另一分析服务器;R 安装、KEGG 等网络功能会访问公共资源。宿主读取的对话和工具输出按 WorkBuddy 自身规则处理。
148
+
149
+ ## 验证
150
+
151
+ ```bash
152
+ python -m pip install -e .
153
+ OMICS_OUTPUT_DIR="$PWD/test-output" python -m unittest discover -s tests -v
154
+ bash tests/smoke_cli.sh
155
+ python tests/run_acceptance.py --output-dir test-output/acceptance
156
+ ```
157
+
158
+ 测试数据均为固定种子的合成数据,不是公开患者数据或生物学发现。完整测试需要对应 R 包;缺包时后端测试会明确 skip,不能把 skip 当作分析通过。独立 wheel 验收应使用新环境安装 wheel,从源码目录之外运行 `tests/run_acceptance.py`,并检查生成的表和图。
159
+
160
+ ## 许可证
161
+
162
+ Copyright 2026 MonadOmics contributors.
163
+
164
+ MonadOmics 的项目代码、主 Skill 和随附文档采用 [Apache License 2.0](https://github.com/daisyluvr42/monad_omicskit/blob/main/LICENSE)。完整许可证随 Python wheel、源码包和 WorkBuddy 连接器 ZIP 分发;GitHub 安装器也会保留许可证。R、Bioconductor 及其他外部依赖和数据仍遵循各自的许可证。