phasepred 0.9.0__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.
- phasepred-0.9.0/LICENSE +35 -0
- phasepred-0.9.0/PKG-INFO +283 -0
- phasepred-0.9.0/README.md +246 -0
- phasepred-0.9.0/pyproject.toml +113 -0
- phasepred-0.9.0/setup.cfg +4 -0
- phasepred-0.9.0/src/phasepred/__init__.py +3 -0
- phasepred-0.9.0/src/phasepred/cli.py +1053 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_0.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_1.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_2.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_3.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_4.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_5.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_6.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_7.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_8.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/8f_model_9.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/PdPS/manifest.json +25 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_0.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_1.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_2.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_3.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_4.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_5.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_6.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_7.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_8.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/8f_model_9.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/SaPS/manifest.json +25 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_0.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_1.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_2.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_3.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_4.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_5.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_6.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_7.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_8.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/8f_model_9.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hPdPS/manifest.json +27 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_0.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_1.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_2.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_3.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_4.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_5.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_6.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_7.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_8.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/8f_model_9.joblib +0 -0
- phasepred-0.9.0/src/phasepred/data/models/hSaPS/manifest.json +27 -0
- phasepred-0.9.0/src/phasepred/data.py +65 -0
- phasepred-0.9.0/src/phasepred/espritz.py +192 -0
- phasepred-0.9.0/src/phasepred/features.py +158 -0
- phasepred-0.9.0/src/phasepred/legacy_features.py +224 -0
- phasepred-0.9.0/src/phasepred/models.py +141 -0
- phasepred-0.9.0/src/phasepred/paper.py +160 -0
- phasepred-0.9.0/src/phasepred/predictor.py +215 -0
- phasepred-0.9.0/src/phasepred/sequences.py +220 -0
- phasepred-0.9.0/src/phasepred/tool_features.py +218 -0
- phasepred-0.9.0/src/phasepred/tool_paths.py +429 -0
- phasepred-0.9.0/src/phasepred/tools.py +602 -0
- phasepred-0.9.0/src/phasepred/updated_data.py +349 -0
- phasepred-0.9.0/src/phasepred.egg-info/PKG-INFO +283 -0
- phasepred-0.9.0/src/phasepred.egg-info/SOURCES.txt +77 -0
- phasepred-0.9.0/src/phasepred.egg-info/dependency_links.txt +1 -0
- phasepred-0.9.0/src/phasepred.egg-info/entry_points.txt +2 -0
- phasepred-0.9.0/src/phasepred.egg-info/requires.txt +18 -0
- phasepred-0.9.0/src/phasepred.egg-info/top_level.txt +1 -0
- phasepred-0.9.0/tests/test_cli.py +536 -0
- phasepred-0.9.0/tests/test_cwd.py +109 -0
- phasepred-0.9.0/tests/test_features.py +64 -0
- phasepred-0.9.0/tests/test_legacy_features.py +47 -0
- phasepred-0.9.0/tests/test_models.py +121 -0
- phasepred-0.9.0/tests/test_paper.py +127 -0
- phasepred-0.9.0/tests/test_sequences.py +100 -0
- phasepred-0.9.0/tests/test_tool_features.py +100 -0
- phasepred-0.9.0/tests/test_tool_packages.py +412 -0
- phasepred-0.9.0/tests/test_v2022.py +165 -0
phasepred-0.9.0/LICENSE
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tingting Li Lab, Department of Biochemistry and
|
|
4
|
+
Molecular Biology, School of Basic Medical Sciences, Peking University
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Third-party vendored components retain their original licenses, located next
|
|
27
|
+
to the source under tools/per-tool/<TOOL>/:
|
|
28
|
+
|
|
29
|
+
- PLAAC MIT (Whitehead Institute, BBRI, UMass) — tools/per-tool/PLAAC/plaac-master/LICENSE.TXT
|
|
30
|
+
- PScore CC-BY 4.0 (Vernon et al. eLife 2018) — see docs/THIRD_PARTY_LICENSES.md
|
|
31
|
+
- SEG NCBI public-domain convention — see docs/THIRD_PARTY_LICENSES.md
|
|
32
|
+
|
|
33
|
+
External feature tools that users install themselves (ESpritz, IUPred3,
|
|
34
|
+
DeepCoil) are governed by their own upstream licenses. See
|
|
35
|
+
docs/THIRD_PARTY_LICENSES.md for the full audit.
|
phasepred-0.9.0/PKG-INFO
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: phasepred
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Paper-faithful re-implementation of the PhaSePred phase-separation predictor (Chen et al. 2022, PNAS).
|
|
5
|
+
Author: Tingting Li Lab, Department of Biochemistry and Molecular Biology, School of Basic Medical Sciences, Peking University
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://www.pnas.org/doi/10.1073/pnas.2115369119
|
|
8
|
+
Project-URL: Documentation, https://github.com/NotWhiteBlank/PhaSePred
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Intended Audience :: Science/Research
|
|
11
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
15
|
+
Requires-Python: <3.13,>=3.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: biopython>=1.85
|
|
19
|
+
Requires-Dist: catgranule<2,>=1.0
|
|
20
|
+
Requires-Dist: joblib>=1.5
|
|
21
|
+
Requires-Dist: localcider>=0.1.21
|
|
22
|
+
Requires-Dist: matplotlib>=3.8
|
|
23
|
+
Requires-Dist: numpy<3,>=1.26
|
|
24
|
+
Requires-Dist: openpyxl>=3.1
|
|
25
|
+
Requires-Dist: pandas>=2.2
|
|
26
|
+
Requires-Dist: pydantic>=2.11
|
|
27
|
+
Requires-Dist: pyarrow>=20.0
|
|
28
|
+
Requires-Dist: python-calamine>=0.3
|
|
29
|
+
Requires-Dist: requests>=2.32
|
|
30
|
+
Requires-Dist: scikit-learn>=1.5
|
|
31
|
+
Requires-Dist: scipy>=1.13
|
|
32
|
+
Requires-Dist: shap>=0.46
|
|
33
|
+
Requires-Dist: tqdm>=4.67
|
|
34
|
+
Requires-Dist: typer>=0.15
|
|
35
|
+
Requires-Dist: xgboost<4,>=3.2
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# PhaSePred
|
|
39
|
+
|
|
40
|
+
> 输入蛋白质氨基酸序列,预测其相分离倾向。
|
|
41
|
+
> 本仓库由北京大学李婷婷实验室(Tingting Li Lab)维护,是 [Chen et al. 2022 *PNAS*](https://doi.org/10.1073/pnas.2115369119)(本实验室前期工作)的**论文忠实重建**——`v2022` 特征定义 + 单一产物(Product A)。
|
|
42
|
+
|
|
43
|
+
[English](README-en.md)
|
|
44
|
+
|
|
45
|
+
## 背景
|
|
46
|
+
|
|
47
|
+
**相分离(phase separation)** 是蛋白质在细胞内自发凝聚成液滴状区室的过程——像油滴在水中形成。这些"无膜细胞器"(应激颗粒、核仁、Cajal小体等)无需膜结构就能组织细胞内的生化反应。相分离失调与神经退行性疾病(ALS、阿尔茨海默病)和癌症密切相关。
|
|
48
|
+
|
|
49
|
+
本工具预测蛋白质参与相分离的倾向,区分两种机制:
|
|
50
|
+
|
|
51
|
+
| 模式 | 含义 | 适用物种 |
|
|
52
|
+
|------|------|---------|
|
|
53
|
+
| **SaPS** | 自驱动相分离——蛋白自己就能凝聚 | 任意物种(8 个特征) |
|
|
54
|
+
| **PdPS** | 伴侣依赖相分离——需要结合伙伴蛋白 | 任意物种(8 个特征) |
|
|
55
|
+
| **hSaPS** | 人类自驱动相分离 | 人类蛋白(10 个特征) |
|
|
56
|
+
| **hPdPS** | 人类伴侣依赖相分离 | 人类蛋白(10 个特征) |
|
|
57
|
+
|
|
58
|
+
输出是 0 到 1 之间的分数。分数不是校准概率,而是该模式内的相对排序(分数越高,蛋白属于该模式的可能性越大)。
|
|
59
|
+
|
|
60
|
+
## 单一产物(Product A)
|
|
61
|
+
|
|
62
|
+
仓库只提供 **一套模型**:**Product A**(`products/A_paper_split_recomputed/`)——按论文 S2/S3 划分、以论文协议(XGBoost 10 模型集成、2:1 负样本子抽样)训练。Product B(扩充数据重训)已按重建决策 D8 删除。
|
|
63
|
+
|
|
64
|
+
**特征定义**统一按 `docs/FEATURES.md` 的 **v2022 权威定义**逐项落地,关键判定(S1 审计结论):
|
|
65
|
+
|
|
66
|
+
- **DeepCoil**:0.82 阈值**二值化**(`max(raw_cc) ≥ 0.82 → 1 else 0`),不再是连续均值。
|
|
67
|
+
- **ESpritz IDR**:DisProt 模型 `D`、`sw 0`(5% FPR),只统计两列残基行(横幅/许可行不计入)。
|
|
68
|
+
- **catGRANULE**:独立 `catgranule` 包提供(论文公式 + mmc1 Table S4 尺度表 + Z 归一),旧权重原样标记 `provenance: legacy-unaudited`。
|
|
69
|
+
- **IUPred3**:论文不用,已移除(D17);IDR 一律用 ESpritz。
|
|
70
|
+
- Hydropathy、FCR、PLAAC(NLLR)、PScore、Phos、DeepPhase 判定"一致",数值逻辑保留。
|
|
71
|
+
|
|
72
|
+
> **stale 警告**:当前 Product A 工件训练时未绑定 `feature_definitions_version`(v2022),因此 `predict` 会输出显著的 stale 警告并在 CSV 附 `stale=True` 列。S5 按论文协议重训后该警告自动消失(机制保留)。
|
|
73
|
+
|
|
74
|
+
## 快速开始
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# 1. 克隆并准备 Python 环境
|
|
78
|
+
git clone https://github.com/notwhiteblank/PhaSePred.git && cd PhaSePred
|
|
79
|
+
pixi install
|
|
80
|
+
|
|
81
|
+
# 2. 安装外部特征工具(详见下一节)
|
|
82
|
+
bash tools/SEG/install.sh # 或按各工具自带的 install.sh
|
|
83
|
+
bash tools/PLAAC/install.sh
|
|
84
|
+
bash tools/PScore/install.sh
|
|
85
|
+
bash tools/ESpritz/install.sh # 交互式(学术许可,需自行下载)
|
|
86
|
+
bash tools/DeepCoil/install.sh
|
|
87
|
+
bash tools/LocalCIDER/install.sh
|
|
88
|
+
|
|
89
|
+
# 3. 校验所有工具就绪
|
|
90
|
+
pixi run phasepred check-tools
|
|
91
|
+
|
|
92
|
+
# 4. 预测
|
|
93
|
+
pixi run phasepred predict --fasta my.fasta --mode SaPS --output scores.csv
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
输出 CSV 包含 `UniprotEntry, score, length, Hydropathy, FCR, IDR, LCR, PScore, PLAAC, catGRANULE, DeepCoil[, Phos freq, DeepPhase], stale`,所有特征数值都有,便于核查。
|
|
97
|
+
|
|
98
|
+
## 工具安装(必读)
|
|
99
|
+
|
|
100
|
+
PhaSePred 调用 **5 个外部特征工具 + LocalCIDER 库**(catGRANULE 由 `catgranule` 包提供,作为 Python 依赖安装)。从 S3 起,每个工具是一个**自包含工具包契约** `tools/<TOOL>/`(统一入口 `run` + 机器可读 `manifest.toml` + 幂等 `install.sh` + `README.md`)。phasepred 经 `src/phasepred/tool_paths.py` 的 manifest 注册表定位工具,按 `PHASEPRED_<TOOL>_DIR → tools/<TOOL>/ → PATH` 级联解析。安装后请执行 `phasepred check-tools` 验证。
|
|
101
|
+
|
|
102
|
+
| 工具 | License | 安装方式 | 可再分发 |
|
|
103
|
+
|---|---|---|---|
|
|
104
|
+
| **SEG** | NCBI 公共域惯例 | `bash tools/SEG/install.sh`(源码已 vendored,本地编译) | 是 |
|
|
105
|
+
| **PScore** | CC-BY 4.0 | 代码已 vendored;`DBS/` 数据 gitignored,`bash tools/PScore/install.sh` | 代码是(需署名) |
|
|
106
|
+
| **PLAAC** | MIT | 预编译 jar 已 vendored;需要 Java 11+ | 是 |
|
|
107
|
+
| **ESpritz** | 学术许可 | `bash tools/ESpritz/install.sh`(交互式,自行下载) | **否** |
|
|
108
|
+
| **DeepCoil** | 上游无 LICENSE | `bash tools/DeepCoil/install.sh`(隔离 Python 3.8 conda env) | **否** |
|
|
109
|
+
| **LocalCIDER** | GPL-2.0 | `bash tools/LocalCIDER/install.sh`(pip 安装,不 vendored) | 是(经 PyPI) |
|
|
110
|
+
| **catGRANULE** | MIT(独立包) | `pixi install` 自动安装 `catgranule`(`packages/catgranule/`) | 是 |
|
|
111
|
+
|
|
112
|
+
> 历史工具 **IUPred3**(ELTE 学术许可,论文不用,D17)已归档至 `tools/_archive/IUPred3/`,不在 predict 路径,不入契约清单。catGRANULE v2 归档至 `tools/_archive/catGRANULE_v2/`(53/82 scales 缺陷,仅实验)。
|
|
113
|
+
|
|
114
|
+
第三方的授权限制部分必须本地下载,license 审计明细见 [docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md)。
|
|
115
|
+
|
|
116
|
+
### 路径解析器如何工作
|
|
117
|
+
|
|
118
|
+
源码里**没有任何 `Tools/<X>/<bin>` 形式的硬编码路径**。每个工具契约的 `manifest.toml` 声明 `name/kind/entry/license/redistributable/runtime/install` 等字段;`src/phasepred/tool_paths.py` 扫描 `tools/*/manifest.toml` 建注册表,按三级级联解析:
|
|
119
|
+
|
|
120
|
+
1. **环境变量**:`PHASEPRED_<TOOL>_DIR=/path/to/tools/ESpritz`(目录须含该契约的 `run`)
|
|
121
|
+
2. **仓库内契约包**:`tools/<TOOL>/run`
|
|
122
|
+
3. **PATH**:`shutil.which`(仅 manifest `path_executables` 声明的工具,如 SEG→`seg`、DeepCoil→`deepcoil`)
|
|
123
|
+
4. **报错**:抛出 `PhaSePredToolNotFound`,并附该工具的 `install.sh` 指引
|
|
124
|
+
|
|
125
|
+
工具执行统一走 `src/phasepred/tools.py` 的 Runner(定位 → 执行 → 解析 → 降级;工具缺失时对应特征列退化为 NaN,predict 在读取输入前通过 `assert_predict_requirements` 预先失败)。`check-tools` 会额外调用每个契约的 `./run --check`,反映"运行时是否可用"(二进制已编译 / 数据已解压 / 环境已安装)。
|
|
126
|
+
|
|
127
|
+
### check-tools 检查表
|
|
128
|
+
|
|
129
|
+
安装完成后跑:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pixi run phasepred check-tools
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
输出示例(S3 起含 LICENSE / REDISTRIBUTABLE 两列):
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
TOOL STATUS REQUIRED SOURCE PATH LICENSE REDISTRIBUTABLE
|
|
139
|
+
---------- ------ -------- -------- ----------------------------------- ----------------------------- ---------------
|
|
140
|
+
SEG OK yes vendored /repo/tools/SEG/run ncbi-public-domain-convention yes
|
|
141
|
+
PLAAC OK yes vendored /repo/tools/PLAAC/run MIT yes
|
|
142
|
+
PScore OK yes vendored /repo/tools/PScore/run CC-BY-4.0 yes
|
|
143
|
+
ESpritz OK yes vendored /repo/tools/ESpritz/run Tosatto-academic-1.1 no
|
|
144
|
+
DeepCoil OK yes vendored /repo/tools/DeepCoil/run none no
|
|
145
|
+
LocalCIDER OK yes vendored /repo/tools/LocalCIDER/run GPL-2.0 yes
|
|
146
|
+
catGRANULE OK yes package /repo/packages/catgranule/src/catgranule MIT yes
|
|
147
|
+
|
|
148
|
+
7 OK · 0 MISSING · 0 required-but-missing
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
任何 `required-but-missing > 0`,`phasepred predict` 会在读 FASTA **之前** 就退出并提示具体安装命令。
|
|
152
|
+
|
|
153
|
+
### 工具故障排查
|
|
154
|
+
|
|
155
|
+
| 症状 | 通常原因 | 修复 |
|
|
156
|
+
|---|---|---|
|
|
157
|
+
| `SEG not found` | 没编译 SEG | `bash tools/SEG/install.sh` |
|
|
158
|
+
| `PLAAC not found` | 没装 Java 运行时 | `sudo apt install openjdk-11-jre-headless` 或 `brew install openjdk` |
|
|
159
|
+
| `ESpritz not found` | 没解压学术许可归档 | `bash tools/ESpritz/install.sh`;或 `PHASEPRED_ESPRITZ_DIR` 指到含 `run` 的契约目录 |
|
|
160
|
+
| `DeepCoil env not found` | 没装隔离 conda env | `bash tools/DeepCoil/install.sh` |
|
|
161
|
+
| `LocalCIDER not found` | 环境内没 pip 装 localcider | `bash tools/LocalCIDER/install.sh`;或用 `PHASEPRED_PYTHON` 指向含 localcider 的解释器 |
|
|
162
|
+
|
|
163
|
+
## 可选:人类模型额外数据(hSaPS / hPdPS 需要)
|
|
164
|
+
|
|
165
|
+
`SaPS` 和 `PdPS` 用 8 个特征,完全从序列计算,不需要额外文件。
|
|
166
|
+
|
|
167
|
+
`hSaPS` 和 `hPdPS` 多用 2 个特征——`Phos freq`(磷酸化位点密度)和 `DeepPhase`(显微图像评分)。这两个不是可以"装一个工具跑出来"的特征:它们来自上游论文/数据库提供的**查找表**,因此 PhaSePred **不能从序列重新算**。两份数据必须由用户自己下载:
|
|
168
|
+
|
|
169
|
+
| 特征 | 数据来源 | License | 期望路径 |
|
|
170
|
+
|---|---|---|---|
|
|
171
|
+
| Phos freq | [PhosphoSitePlus](https://www.phosphosite.org/) `Phosphorylation_site_dataset.gz` | 需要注册下载,禁止再分发 | `data/raw/external/phosphositeplus/Phosphorylation_site_dataset.gz` |
|
|
172
|
+
| DeepPhase | [DeepPhase 论文 supplement](https://github.com/PEILab/DeepPhase) `tableS3.xlsx` | 学术使用,参见上游 | `data/raw/external/deepphase/extracted/tableS3.xlsx` |
|
|
173
|
+
|
|
174
|
+
**没有这两个文件会怎样?** `phasepred predict --mode hSaPS|hPdPS` **仍然能跑**,但会在 stderr 输出 `PhaSePredMissingDataWarning`,明确告诉你哪几个蛋白用了中位数填充(即"分数仅供参考,不是基于完整特征的判断")。
|
|
175
|
+
|
|
176
|
+
## 使用
|
|
177
|
+
|
|
178
|
+
### 预测(FASTA → 分数)
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# 8 特征模型(任意物种)
|
|
182
|
+
pixi run phasepred predict --fasta proteins.fasta --mode SaPS --output scores.csv
|
|
183
|
+
pixi run phasepred predict --fasta proteins.fasta --mode PdPS --output scores.csv
|
|
184
|
+
|
|
185
|
+
# 10 特征模型(人类蛋白)
|
|
186
|
+
pixi run phasepred predict --fasta proteins.fasta --mode hSaPS --output scores.csv
|
|
187
|
+
pixi run phasepred predict --fasta proteins.fasta --mode hPdPS --output scores.csv
|
|
188
|
+
|
|
189
|
+
# 用 UniProt ID 直接预测(三种输入形式都支持)
|
|
190
|
+
pixi run phasepred predict --ids "P35637,Q9Y2W1" --mode SaPS --output scores.csv # 内联
|
|
191
|
+
pixi run phasepred predict --ids my_ids.txt --mode SaPS --output scores.csv # 文件(每行一个 ID)
|
|
192
|
+
cat my_ids.txt | pixi run phasepred predict --ids - --mode SaPS --output scores.csv # stdin
|
|
193
|
+
|
|
194
|
+
# FASTA 和 IDs 可以混用(去重后合并)
|
|
195
|
+
pixi run phasepred predict --fasta my.fasta --ids "P35637" --mode SaPS --output scores.csv
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
> `--models-dir` 可覆盖模型目录;`--product` 已随 Product B 一起移除。
|
|
199
|
+
|
|
200
|
+
ID 输入会调 `https://rest.uniprot.org` 拉序列,结果缓存到 `data/interim/uniprot_cache.jsonl`,下次同样的 ID 不再请求网络。用 `--cache PATH` 可以指定别的缓存位置。
|
|
201
|
+
|
|
202
|
+
### v2022 特征计算
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# 只算 8/10 个特征(FASTA → 特征表)
|
|
206
|
+
pixi run phasepred features-from-fasta --input my.fasta --output features.csv
|
|
207
|
+
# 输出含 native 特征 + espritz-idr-fraction(ESpritz 域 IDR)+ lcr-fraction(SEG 域)
|
|
208
|
+
|
|
209
|
+
# 完整 8/10 特征重算(requires --deepcoil-features;catGRANULE 走 catgranule 包)
|
|
210
|
+
pixi run phasepred features-recomputed \
|
|
211
|
+
--sequences data/interim/sequences.csv \
|
|
212
|
+
--output data/interim/recomputed_features_full.csv \
|
|
213
|
+
--espritz-cache data/interim/espritz_idr_cache.jsonl \
|
|
214
|
+
--deepcoil-features data/interim/deepcoil_features.csv
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### 复现 Product A
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# 按论文协议重训 Product A(默认 XGBoost,5-fold×10 负集×2:1,SEED=42)
|
|
221
|
+
pixi run retrain
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 仓库结构
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
src/phasepred/ 共享库 + CLI(模块边界:features/tools/models/cli/data)
|
|
228
|
+
cli.py predict / check-tools / features-from-fasta / ...
|
|
229
|
+
predictor.py FASTA → 特征 → 预测全流程(单产物,stale 检测)
|
|
230
|
+
tools.py 外部工具 Runner(定位→执行→解析→降级)
|
|
231
|
+
features.py 纯计算:native 特征 + v2022 残基对齐工具
|
|
232
|
+
models.py 训练/加载/预测 + feature_definitions_version 机制
|
|
233
|
+
data.py REPO_ROOT / PHASEPRED_DATA_ROOT 解析
|
|
234
|
+
tool_paths.py manifest 注册表路径解析(PHASEPRED_<TOOL>_DIR → tools/<TOOL>/ → PATH)
|
|
235
|
+
|
|
236
|
+
packages/catgranule/ 独立 catgranule 包(0.1.0,由 phasepred path 依赖)
|
|
237
|
+
src/catgranule/ scoring / weights / cli(catgranule CLI)
|
|
238
|
+
weights/ catgranule_v1_weights.json(含 provenance: legacy-unaudited)
|
|
239
|
+
|
|
240
|
+
products/
|
|
241
|
+
A_paper_split_recomputed/ 论文划分 + Optuna 调优 XGBoost(唯一产物)
|
|
242
|
+
models/<task>/8f_model_{0..9}.joblib (10 模型集成 × 4 任务)
|
|
243
|
+
|
|
244
|
+
tools/ 外部工具包契约(S3 标准工具包,每工具一个目录)
|
|
245
|
+
<TOOL>/run 统一入口:./run <in.fasta> [原生参数] → stdout 标准格式
|
|
246
|
+
<TOOL>/manifest.toml 机器可读契约:name/kind/license/redistributable/runtime/install/...
|
|
247
|
+
<TOOL>/install.sh 幂等安装(含 --check);README.md 用法/出处/许可/署名
|
|
248
|
+
SEG/ PLAAC/ PScore/ ESpritz/ DeepCoil/ LocalCIDER/ 六契约
|
|
249
|
+
_archive/ catGRANULE_v2/(实验) + IUPred3/(D17 归档)
|
|
250
|
+
|
|
251
|
+
docs/ FEATURES.md / RETRAIN_PROTOCOL.md / CATGRANULE_SPEC.md
|
|
252
|
+
/ TOOL_LICENSES.md / ENVIRONMENT.md / migration/
|
|
253
|
+
tests/ pytest 测试套件(含 packages/catgranule/ 独立测试)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## 探索过程与关键结论
|
|
257
|
+
|
|
258
|
+
项目从重建实验室 2022 年发表的 PhaSePred 起步(Chen et al. 2022, *PNAS*)。重建中最重要的审计结论已经落在 `docs/FEATURES.md`(v2022 特征定义权威对照):**唯一重大定义偏差是 DeepCoil 二值化**(论文 = 0.82 阈值 0/1,早期重建误用均值),已在 S2 修复;ESpritz 横幅行解析小瑕疵也已修复。详细实施记录见 `docs/migration/PLAN.md` 与 `docs/migration/work-log/`。
|
|
259
|
+
|
|
260
|
+
性能历史数字(0.x 重建版,Optuna 调优 + S3 测试集)见旧版 README 与 `products/A_paper_split_recomputed/metrics.json`;S5 将按论文默认参数重训并记录论文层 AUC 对照。
|
|
261
|
+
|
|
262
|
+
## 引用
|
|
263
|
+
|
|
264
|
+
如使用本工具,请引用原始论文:
|
|
265
|
+
|
|
266
|
+
> Chen, Z., Hou, C., Wang, L., Yu, C., Chen, T., Shen, B., Hou, Y.,
|
|
267
|
+
> Li, P., Li, T. (2022). Screening membraneless organelle participants
|
|
268
|
+
> with machine-learning models that integrate multimodal features.
|
|
269
|
+
> *Proceedings of the National Academy of Sciences* 119(24), e2115369119.
|
|
270
|
+
> https://doi.org/10.1073/pnas.2115369119
|
|
271
|
+
|
|
272
|
+
catGRANULE 打分实现源自 Bolognesi et al. 2016(*Cell Reports* 16:222-231)。外部特征工具的引用见 [docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md)。
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
PhaSePred 本仓库(代码、模型、文档)采用 **MIT License** 发布。详见根目录 [LICENSE](LICENSE)。
|
|
277
|
+
|
|
278
|
+
> Copyright (c) 2026 Tingting Li Lab, Department of Biochemistry and Molecular Biology,
|
|
279
|
+
> School of Basic Medical Sciences, Peking University.
|
|
280
|
+
|
|
281
|
+
仓库内 vendored 的第三方组件(PLAAC、PScore、SEG)保留各自的上游 license——见
|
|
282
|
+
[docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md) 的完整审计。用户自行安装的工具
|
|
283
|
+
(ESpritz、DeepCoil)遵循各自上游条款。
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# PhaSePred
|
|
2
|
+
|
|
3
|
+
> 输入蛋白质氨基酸序列,预测其相分离倾向。
|
|
4
|
+
> 本仓库由北京大学李婷婷实验室(Tingting Li Lab)维护,是 [Chen et al. 2022 *PNAS*](https://doi.org/10.1073/pnas.2115369119)(本实验室前期工作)的**论文忠实重建**——`v2022` 特征定义 + 单一产物(Product A)。
|
|
5
|
+
|
|
6
|
+
[English](README-en.md)
|
|
7
|
+
|
|
8
|
+
## 背景
|
|
9
|
+
|
|
10
|
+
**相分离(phase separation)** 是蛋白质在细胞内自发凝聚成液滴状区室的过程——像油滴在水中形成。这些"无膜细胞器"(应激颗粒、核仁、Cajal小体等)无需膜结构就能组织细胞内的生化反应。相分离失调与神经退行性疾病(ALS、阿尔茨海默病)和癌症密切相关。
|
|
11
|
+
|
|
12
|
+
本工具预测蛋白质参与相分离的倾向,区分两种机制:
|
|
13
|
+
|
|
14
|
+
| 模式 | 含义 | 适用物种 |
|
|
15
|
+
|------|------|---------|
|
|
16
|
+
| **SaPS** | 自驱动相分离——蛋白自己就能凝聚 | 任意物种(8 个特征) |
|
|
17
|
+
| **PdPS** | 伴侣依赖相分离——需要结合伙伴蛋白 | 任意物种(8 个特征) |
|
|
18
|
+
| **hSaPS** | 人类自驱动相分离 | 人类蛋白(10 个特征) |
|
|
19
|
+
| **hPdPS** | 人类伴侣依赖相分离 | 人类蛋白(10 个特征) |
|
|
20
|
+
|
|
21
|
+
输出是 0 到 1 之间的分数。分数不是校准概率,而是该模式内的相对排序(分数越高,蛋白属于该模式的可能性越大)。
|
|
22
|
+
|
|
23
|
+
## 单一产物(Product A)
|
|
24
|
+
|
|
25
|
+
仓库只提供 **一套模型**:**Product A**(`products/A_paper_split_recomputed/`)——按论文 S2/S3 划分、以论文协议(XGBoost 10 模型集成、2:1 负样本子抽样)训练。Product B(扩充数据重训)已按重建决策 D8 删除。
|
|
26
|
+
|
|
27
|
+
**特征定义**统一按 `docs/FEATURES.md` 的 **v2022 权威定义**逐项落地,关键判定(S1 审计结论):
|
|
28
|
+
|
|
29
|
+
- **DeepCoil**:0.82 阈值**二值化**(`max(raw_cc) ≥ 0.82 → 1 else 0`),不再是连续均值。
|
|
30
|
+
- **ESpritz IDR**:DisProt 模型 `D`、`sw 0`(5% FPR),只统计两列残基行(横幅/许可行不计入)。
|
|
31
|
+
- **catGRANULE**:独立 `catgranule` 包提供(论文公式 + mmc1 Table S4 尺度表 + Z 归一),旧权重原样标记 `provenance: legacy-unaudited`。
|
|
32
|
+
- **IUPred3**:论文不用,已移除(D17);IDR 一律用 ESpritz。
|
|
33
|
+
- Hydropathy、FCR、PLAAC(NLLR)、PScore、Phos、DeepPhase 判定"一致",数值逻辑保留。
|
|
34
|
+
|
|
35
|
+
> **stale 警告**:当前 Product A 工件训练时未绑定 `feature_definitions_version`(v2022),因此 `predict` 会输出显著的 stale 警告并在 CSV 附 `stale=True` 列。S5 按论文协议重训后该警告自动消失(机制保留)。
|
|
36
|
+
|
|
37
|
+
## 快速开始
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# 1. 克隆并准备 Python 环境
|
|
41
|
+
git clone https://github.com/notwhiteblank/PhaSePred.git && cd PhaSePred
|
|
42
|
+
pixi install
|
|
43
|
+
|
|
44
|
+
# 2. 安装外部特征工具(详见下一节)
|
|
45
|
+
bash tools/SEG/install.sh # 或按各工具自带的 install.sh
|
|
46
|
+
bash tools/PLAAC/install.sh
|
|
47
|
+
bash tools/PScore/install.sh
|
|
48
|
+
bash tools/ESpritz/install.sh # 交互式(学术许可,需自行下载)
|
|
49
|
+
bash tools/DeepCoil/install.sh
|
|
50
|
+
bash tools/LocalCIDER/install.sh
|
|
51
|
+
|
|
52
|
+
# 3. 校验所有工具就绪
|
|
53
|
+
pixi run phasepred check-tools
|
|
54
|
+
|
|
55
|
+
# 4. 预测
|
|
56
|
+
pixi run phasepred predict --fasta my.fasta --mode SaPS --output scores.csv
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
输出 CSV 包含 `UniprotEntry, score, length, Hydropathy, FCR, IDR, LCR, PScore, PLAAC, catGRANULE, DeepCoil[, Phos freq, DeepPhase], stale`,所有特征数值都有,便于核查。
|
|
60
|
+
|
|
61
|
+
## 工具安装(必读)
|
|
62
|
+
|
|
63
|
+
PhaSePred 调用 **5 个外部特征工具 + LocalCIDER 库**(catGRANULE 由 `catgranule` 包提供,作为 Python 依赖安装)。从 S3 起,每个工具是一个**自包含工具包契约** `tools/<TOOL>/`(统一入口 `run` + 机器可读 `manifest.toml` + 幂等 `install.sh` + `README.md`)。phasepred 经 `src/phasepred/tool_paths.py` 的 manifest 注册表定位工具,按 `PHASEPRED_<TOOL>_DIR → tools/<TOOL>/ → PATH` 级联解析。安装后请执行 `phasepred check-tools` 验证。
|
|
64
|
+
|
|
65
|
+
| 工具 | License | 安装方式 | 可再分发 |
|
|
66
|
+
|---|---|---|---|
|
|
67
|
+
| **SEG** | NCBI 公共域惯例 | `bash tools/SEG/install.sh`(源码已 vendored,本地编译) | 是 |
|
|
68
|
+
| **PScore** | CC-BY 4.0 | 代码已 vendored;`DBS/` 数据 gitignored,`bash tools/PScore/install.sh` | 代码是(需署名) |
|
|
69
|
+
| **PLAAC** | MIT | 预编译 jar 已 vendored;需要 Java 11+ | 是 |
|
|
70
|
+
| **ESpritz** | 学术许可 | `bash tools/ESpritz/install.sh`(交互式,自行下载) | **否** |
|
|
71
|
+
| **DeepCoil** | 上游无 LICENSE | `bash tools/DeepCoil/install.sh`(隔离 Python 3.8 conda env) | **否** |
|
|
72
|
+
| **LocalCIDER** | GPL-2.0 | `bash tools/LocalCIDER/install.sh`(pip 安装,不 vendored) | 是(经 PyPI) |
|
|
73
|
+
| **catGRANULE** | MIT(独立包) | `pixi install` 自动安装 `catgranule`(`packages/catgranule/`) | 是 |
|
|
74
|
+
|
|
75
|
+
> 历史工具 **IUPred3**(ELTE 学术许可,论文不用,D17)已归档至 `tools/_archive/IUPred3/`,不在 predict 路径,不入契约清单。catGRANULE v2 归档至 `tools/_archive/catGRANULE_v2/`(53/82 scales 缺陷,仅实验)。
|
|
76
|
+
|
|
77
|
+
第三方的授权限制部分必须本地下载,license 审计明细见 [docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md)。
|
|
78
|
+
|
|
79
|
+
### 路径解析器如何工作
|
|
80
|
+
|
|
81
|
+
源码里**没有任何 `Tools/<X>/<bin>` 形式的硬编码路径**。每个工具契约的 `manifest.toml` 声明 `name/kind/entry/license/redistributable/runtime/install` 等字段;`src/phasepred/tool_paths.py` 扫描 `tools/*/manifest.toml` 建注册表,按三级级联解析:
|
|
82
|
+
|
|
83
|
+
1. **环境变量**:`PHASEPRED_<TOOL>_DIR=/path/to/tools/ESpritz`(目录须含该契约的 `run`)
|
|
84
|
+
2. **仓库内契约包**:`tools/<TOOL>/run`
|
|
85
|
+
3. **PATH**:`shutil.which`(仅 manifest `path_executables` 声明的工具,如 SEG→`seg`、DeepCoil→`deepcoil`)
|
|
86
|
+
4. **报错**:抛出 `PhaSePredToolNotFound`,并附该工具的 `install.sh` 指引
|
|
87
|
+
|
|
88
|
+
工具执行统一走 `src/phasepred/tools.py` 的 Runner(定位 → 执行 → 解析 → 降级;工具缺失时对应特征列退化为 NaN,predict 在读取输入前通过 `assert_predict_requirements` 预先失败)。`check-tools` 会额外调用每个契约的 `./run --check`,反映"运行时是否可用"(二进制已编译 / 数据已解压 / 环境已安装)。
|
|
89
|
+
|
|
90
|
+
### check-tools 检查表
|
|
91
|
+
|
|
92
|
+
安装完成后跑:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
pixi run phasepred check-tools
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
输出示例(S3 起含 LICENSE / REDISTRIBUTABLE 两列):
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
TOOL STATUS REQUIRED SOURCE PATH LICENSE REDISTRIBUTABLE
|
|
102
|
+
---------- ------ -------- -------- ----------------------------------- ----------------------------- ---------------
|
|
103
|
+
SEG OK yes vendored /repo/tools/SEG/run ncbi-public-domain-convention yes
|
|
104
|
+
PLAAC OK yes vendored /repo/tools/PLAAC/run MIT yes
|
|
105
|
+
PScore OK yes vendored /repo/tools/PScore/run CC-BY-4.0 yes
|
|
106
|
+
ESpritz OK yes vendored /repo/tools/ESpritz/run Tosatto-academic-1.1 no
|
|
107
|
+
DeepCoil OK yes vendored /repo/tools/DeepCoil/run none no
|
|
108
|
+
LocalCIDER OK yes vendored /repo/tools/LocalCIDER/run GPL-2.0 yes
|
|
109
|
+
catGRANULE OK yes package /repo/packages/catgranule/src/catgranule MIT yes
|
|
110
|
+
|
|
111
|
+
7 OK · 0 MISSING · 0 required-but-missing
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
任何 `required-but-missing > 0`,`phasepred predict` 会在读 FASTA **之前** 就退出并提示具体安装命令。
|
|
115
|
+
|
|
116
|
+
### 工具故障排查
|
|
117
|
+
|
|
118
|
+
| 症状 | 通常原因 | 修复 |
|
|
119
|
+
|---|---|---|
|
|
120
|
+
| `SEG not found` | 没编译 SEG | `bash tools/SEG/install.sh` |
|
|
121
|
+
| `PLAAC not found` | 没装 Java 运行时 | `sudo apt install openjdk-11-jre-headless` 或 `brew install openjdk` |
|
|
122
|
+
| `ESpritz not found` | 没解压学术许可归档 | `bash tools/ESpritz/install.sh`;或 `PHASEPRED_ESPRITZ_DIR` 指到含 `run` 的契约目录 |
|
|
123
|
+
| `DeepCoil env not found` | 没装隔离 conda env | `bash tools/DeepCoil/install.sh` |
|
|
124
|
+
| `LocalCIDER not found` | 环境内没 pip 装 localcider | `bash tools/LocalCIDER/install.sh`;或用 `PHASEPRED_PYTHON` 指向含 localcider 的解释器 |
|
|
125
|
+
|
|
126
|
+
## 可选:人类模型额外数据(hSaPS / hPdPS 需要)
|
|
127
|
+
|
|
128
|
+
`SaPS` 和 `PdPS` 用 8 个特征,完全从序列计算,不需要额外文件。
|
|
129
|
+
|
|
130
|
+
`hSaPS` 和 `hPdPS` 多用 2 个特征——`Phos freq`(磷酸化位点密度)和 `DeepPhase`(显微图像评分)。这两个不是可以"装一个工具跑出来"的特征:它们来自上游论文/数据库提供的**查找表**,因此 PhaSePred **不能从序列重新算**。两份数据必须由用户自己下载:
|
|
131
|
+
|
|
132
|
+
| 特征 | 数据来源 | License | 期望路径 |
|
|
133
|
+
|---|---|---|---|
|
|
134
|
+
| Phos freq | [PhosphoSitePlus](https://www.phosphosite.org/) `Phosphorylation_site_dataset.gz` | 需要注册下载,禁止再分发 | `data/raw/external/phosphositeplus/Phosphorylation_site_dataset.gz` |
|
|
135
|
+
| DeepPhase | [DeepPhase 论文 supplement](https://github.com/PEILab/DeepPhase) `tableS3.xlsx` | 学术使用,参见上游 | `data/raw/external/deepphase/extracted/tableS3.xlsx` |
|
|
136
|
+
|
|
137
|
+
**没有这两个文件会怎样?** `phasepred predict --mode hSaPS|hPdPS` **仍然能跑**,但会在 stderr 输出 `PhaSePredMissingDataWarning`,明确告诉你哪几个蛋白用了中位数填充(即"分数仅供参考,不是基于完整特征的判断")。
|
|
138
|
+
|
|
139
|
+
## 使用
|
|
140
|
+
|
|
141
|
+
### 预测(FASTA → 分数)
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# 8 特征模型(任意物种)
|
|
145
|
+
pixi run phasepred predict --fasta proteins.fasta --mode SaPS --output scores.csv
|
|
146
|
+
pixi run phasepred predict --fasta proteins.fasta --mode PdPS --output scores.csv
|
|
147
|
+
|
|
148
|
+
# 10 特征模型(人类蛋白)
|
|
149
|
+
pixi run phasepred predict --fasta proteins.fasta --mode hSaPS --output scores.csv
|
|
150
|
+
pixi run phasepred predict --fasta proteins.fasta --mode hPdPS --output scores.csv
|
|
151
|
+
|
|
152
|
+
# 用 UniProt ID 直接预测(三种输入形式都支持)
|
|
153
|
+
pixi run phasepred predict --ids "P35637,Q9Y2W1" --mode SaPS --output scores.csv # 内联
|
|
154
|
+
pixi run phasepred predict --ids my_ids.txt --mode SaPS --output scores.csv # 文件(每行一个 ID)
|
|
155
|
+
cat my_ids.txt | pixi run phasepred predict --ids - --mode SaPS --output scores.csv # stdin
|
|
156
|
+
|
|
157
|
+
# FASTA 和 IDs 可以混用(去重后合并)
|
|
158
|
+
pixi run phasepred predict --fasta my.fasta --ids "P35637" --mode SaPS --output scores.csv
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
> `--models-dir` 可覆盖模型目录;`--product` 已随 Product B 一起移除。
|
|
162
|
+
|
|
163
|
+
ID 输入会调 `https://rest.uniprot.org` 拉序列,结果缓存到 `data/interim/uniprot_cache.jsonl`,下次同样的 ID 不再请求网络。用 `--cache PATH` 可以指定别的缓存位置。
|
|
164
|
+
|
|
165
|
+
### v2022 特征计算
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
# 只算 8/10 个特征(FASTA → 特征表)
|
|
169
|
+
pixi run phasepred features-from-fasta --input my.fasta --output features.csv
|
|
170
|
+
# 输出含 native 特征 + espritz-idr-fraction(ESpritz 域 IDR)+ lcr-fraction(SEG 域)
|
|
171
|
+
|
|
172
|
+
# 完整 8/10 特征重算(requires --deepcoil-features;catGRANULE 走 catgranule 包)
|
|
173
|
+
pixi run phasepred features-recomputed \
|
|
174
|
+
--sequences data/interim/sequences.csv \
|
|
175
|
+
--output data/interim/recomputed_features_full.csv \
|
|
176
|
+
--espritz-cache data/interim/espritz_idr_cache.jsonl \
|
|
177
|
+
--deepcoil-features data/interim/deepcoil_features.csv
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### 复现 Product A
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# 按论文协议重训 Product A(默认 XGBoost,5-fold×10 负集×2:1,SEED=42)
|
|
184
|
+
pixi run retrain
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## 仓库结构
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
src/phasepred/ 共享库 + CLI(模块边界:features/tools/models/cli/data)
|
|
191
|
+
cli.py predict / check-tools / features-from-fasta / ...
|
|
192
|
+
predictor.py FASTA → 特征 → 预测全流程(单产物,stale 检测)
|
|
193
|
+
tools.py 外部工具 Runner(定位→执行→解析→降级)
|
|
194
|
+
features.py 纯计算:native 特征 + v2022 残基对齐工具
|
|
195
|
+
models.py 训练/加载/预测 + feature_definitions_version 机制
|
|
196
|
+
data.py REPO_ROOT / PHASEPRED_DATA_ROOT 解析
|
|
197
|
+
tool_paths.py manifest 注册表路径解析(PHASEPRED_<TOOL>_DIR → tools/<TOOL>/ → PATH)
|
|
198
|
+
|
|
199
|
+
packages/catgranule/ 独立 catgranule 包(0.1.0,由 phasepred path 依赖)
|
|
200
|
+
src/catgranule/ scoring / weights / cli(catgranule CLI)
|
|
201
|
+
weights/ catgranule_v1_weights.json(含 provenance: legacy-unaudited)
|
|
202
|
+
|
|
203
|
+
products/
|
|
204
|
+
A_paper_split_recomputed/ 论文划分 + Optuna 调优 XGBoost(唯一产物)
|
|
205
|
+
models/<task>/8f_model_{0..9}.joblib (10 模型集成 × 4 任务)
|
|
206
|
+
|
|
207
|
+
tools/ 外部工具包契约(S3 标准工具包,每工具一个目录)
|
|
208
|
+
<TOOL>/run 统一入口:./run <in.fasta> [原生参数] → stdout 标准格式
|
|
209
|
+
<TOOL>/manifest.toml 机器可读契约:name/kind/license/redistributable/runtime/install/...
|
|
210
|
+
<TOOL>/install.sh 幂等安装(含 --check);README.md 用法/出处/许可/署名
|
|
211
|
+
SEG/ PLAAC/ PScore/ ESpritz/ DeepCoil/ LocalCIDER/ 六契约
|
|
212
|
+
_archive/ catGRANULE_v2/(实验) + IUPred3/(D17 归档)
|
|
213
|
+
|
|
214
|
+
docs/ FEATURES.md / RETRAIN_PROTOCOL.md / CATGRANULE_SPEC.md
|
|
215
|
+
/ TOOL_LICENSES.md / ENVIRONMENT.md / migration/
|
|
216
|
+
tests/ pytest 测试套件(含 packages/catgranule/ 独立测试)
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## 探索过程与关键结论
|
|
220
|
+
|
|
221
|
+
项目从重建实验室 2022 年发表的 PhaSePred 起步(Chen et al. 2022, *PNAS*)。重建中最重要的审计结论已经落在 `docs/FEATURES.md`(v2022 特征定义权威对照):**唯一重大定义偏差是 DeepCoil 二值化**(论文 = 0.82 阈值 0/1,早期重建误用均值),已在 S2 修复;ESpritz 横幅行解析小瑕疵也已修复。详细实施记录见 `docs/migration/PLAN.md` 与 `docs/migration/work-log/`。
|
|
222
|
+
|
|
223
|
+
性能历史数字(0.x 重建版,Optuna 调优 + S3 测试集)见旧版 README 与 `products/A_paper_split_recomputed/metrics.json`;S5 将按论文默认参数重训并记录论文层 AUC 对照。
|
|
224
|
+
|
|
225
|
+
## 引用
|
|
226
|
+
|
|
227
|
+
如使用本工具,请引用原始论文:
|
|
228
|
+
|
|
229
|
+
> Chen, Z., Hou, C., Wang, L., Yu, C., Chen, T., Shen, B., Hou, Y.,
|
|
230
|
+
> Li, P., Li, T. (2022). Screening membraneless organelle participants
|
|
231
|
+
> with machine-learning models that integrate multimodal features.
|
|
232
|
+
> *Proceedings of the National Academy of Sciences* 119(24), e2115369119.
|
|
233
|
+
> https://doi.org/10.1073/pnas.2115369119
|
|
234
|
+
|
|
235
|
+
catGRANULE 打分实现源自 Bolognesi et al. 2016(*Cell Reports* 16:222-231)。外部特征工具的引用见 [docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md)。
|
|
236
|
+
|
|
237
|
+
## License
|
|
238
|
+
|
|
239
|
+
PhaSePred 本仓库(代码、模型、文档)采用 **MIT License** 发布。详见根目录 [LICENSE](LICENSE)。
|
|
240
|
+
|
|
241
|
+
> Copyright (c) 2026 Tingting Li Lab, Department of Biochemistry and Molecular Biology,
|
|
242
|
+
> School of Basic Medical Sciences, Peking University.
|
|
243
|
+
|
|
244
|
+
仓库内 vendored 的第三方组件(PLAAC、PScore、SEG)保留各自的上游 license——见
|
|
245
|
+
[docs/TOOL_LICENSES.md](docs/TOOL_LICENSES.md) 的完整审计。用户自行安装的工具
|
|
246
|
+
(ESpritz、DeepCoil)遵循各自上游条款。
|