模型名称: Genereux-akotenou/genomics-tf-prediction
模型链接: HuggingFace
模型描述: 基于 k-mer 编码的转录因子(Transcription Factor, TF)家族预测模型。采用两阶段预测 pipeline:第一阶段使用 58 个二元分类器(每个 TF family 一个)预测序列属于该 family 的概率;第二阶段使用 MetaClassifier 整合所有 family 的概率进行最终分类。
模型架构: 多层全连接网络(Feedforward Neural Network)
参数规模: 每个 binary classifier ~177K–587K 参数(取决于 k 值)
输入规格:
输出规格:
| 依赖项 | 版本要求 | 说明 |
|---|---|---|
| Python | >= 3.10 | 推荐 3.11 |
| keras | >= 3.0 | Keras 3 深度学习框架 |
| numpy | >= 1.20 | 数值计算 |
| h5py | >= 3.0 | .keras 模型格式支持 |
安装命令:
pip install -r requirements.txt# 验证 Python 环境
python3 --version
# 验证 keras
python3 -c "import keras; print(keras.__version__)"方式一:GitCode 模型仓库(推荐,国内速度快)
# 克隆模型仓库(包含所有模型权重和 meta.json)
git clone https://gitcode.com/gcw_coj3XaOd/genomics-tf-prediction-model.git /tmp/genomics_tf_model方式二:AtomGit 镜像(备选)
# 使用 Bearer Token 下载
ATOMGIT_TOKEN="<your-token>"
wget --header="Authorization: Bearer $ATOMGIT_TOKEN" \
"https://ai.gitcode.com/hf_mirrors/gcw_coj3XaOd/genomics-tf-prediction-model/resolve/main/Binary-Classifier/AP2/FEEDFORWARD_k2.keras" \
-O Binary-Classifier/AP2/FEEDFORWARD_k2.keras方式三:HuggingFace 原始源
huggingface-cli download Genereux-akotenou/genomics-tf-prediction --local-dir ./modelspython3 inference.py \
--model-path /tmp/genomics_tf_model \
--tf-family AP2 \
--sequence "ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATG"# 从文件读取序列(每行一个)
python3 inference.py \
--model-path /tmp/genomics_tf_model \
--tf-family AP2 \
--input-file sequences.txt# 使用 MetaClassifier 进行最终分类
python3 inference.py \
--model-path /tmp/genomics_tf_model \
--tf-family AP2 \
--k-models k2 \
--two-stage \
--sequence "ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATG"| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| --model-path | str | 必填 | 模型根目录路径 |
| --tf-family | str | AP2 | TF family 名称 |
| --k-models | str | k2,k3,k4,k5 | 使用的 k-mer 模型 |
| --sequence | str | None | 输入 DNA 序列 |
| --input-file | str | None | 序列文件路径(每行一个) |
| --two-stage | flag | False | 启用 MetaClassifier |
| --batch-size | int | 32 | 批量推理 batch 大小 |
[信息] 模型路径: /tmp/genomics_tf_model
[信息] TF family: AP2
[信息] K models: ['k2', 'k3', 'k4']
[信息] 序列数: 1
[元数据] df_length: 8894
k2: f1=0.9651, accuracy=0.9651, features_mask=200 entries
k3: f1=0.9732, accuracy=0.9731, features_mask=1000 entries
k4: f1=0.9687, accuracy=0.9685, features_mask=1000 entries
[加载] FEEDFORWARD_k2.keras ... 完成 (0.61s), input_shape=(None, 200), params=176,897
[加载] FEEDFORWARD_k3.keras ... 完成 (0.39s), input_shape=(None, 1000), params=586,497
[加载] FEEDFORWARD_k4.keras ... 完成 (0.40s), input_shape=(None, 1000), params=586,497
============================================================
[推理] 开始预测
============================================================
[模型] FEEDFORWARD_k2:
输入序列: ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGAT...
预测概率: 0.000147
预测标签: 阴性
[模型] FEEDFORWARD_k3:
输入序列: ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGAT...
预测概率: 0.004740
预测标签: 阴性
[模型] FEEDFORWARD_k4:
输入序列: ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGAT...
预测概率: 0.007745
预测标签: 阴性
============================================================
[状态] SUCCESS
[状态] 总耗时: 1.51s
[状态] 模型: keras 3.15.1
============================================================[加载] MetaClassifier/META_k3.keras ... 完成 (0.22s), input_shape=(None, 58)
[两阶段预测结果]
最佳 family: AP2
置信度: 0.9651
Meta score: 0.8923运行命令:
python3 inference.py --model-path /tmp/genomics_tf_model --tf-family AP2 --k-models k2 --sequence "ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATG"输出:
[模型] FEEDFORWARD_k2:
输入序列: ATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGATGAT...
预测概率: 0.000147
预测标签: 阴性运行命令:
python3 inference.py --model-path /tmp/genomics_tf_model --tf-family AP2 --k-models k2,k3,k4输出:
[模型] FEEDFORWARD_k2: 预测概率: 0.000147, 标签: 阴性
[模型] FEEDFORWARD_k3: 预测概率: 0.004740, 标签: 阴性
[模型] FEEDFORWARD_k4: 预测概率: 0.007745, 标签: 阴性


测试数据: 原始论文测试集(testset.csv)
评测指标:
| Family | k | F1 | Accuracy | Precision | Recall |
|---|---|---|---|---|---|
| AP2 | k2 | 0.9651 | 0.9651 | 0.9659 | - |
| AP2 | k3 | 0.9732 | 0.9731 | - | - |
| AP2 | k4 | 0.9687 | 0.9685 | - | - |
评测命令:
python3 inference.py --model-path /tmp/genomics_tf_model --tf-family AP2 --k-models k2,k3,k4本模型使用 multi-k-mer 编码方案将 DNA 序列转换为数值特征向量:
| k 值 | k-mer 示例 | 特征维度 | features_mask 条目数 |
|---|---|---|---|
| 2 | AA, AC, AG, AT, ... | 16 (4²) | 200 |
| 3 | AAA, AAC, AAG, ... | 64 (4³) | 1000 |
| 4 | AAAA, AAAC, ... | 256 (4⁴) | 1000 |
| 5 | AAAAA, ... | 1024 (4⁵) | 1000 |
编码过程:对每个 k 值,在序列上滑动窗口提取所有 k-mer,统计每个 k-mer 的出现次数,按 features_mask 指定的位置组装最终特征向量。
| Family | k2 F1 | k3 F1 | k4 F1 |
|---|---|---|---|
| AP2 | 0.9651 | 0.9732 | 0.9687 |
| ... | ... | ... | ... |
完整列表见 HuggingFace 模型页面。
GitCode 模型仓库(权重文件): https://gitcode.com/gcw_coj3XaOd/genomics-tf-prediction-model
GitCode 代码仓库(推理脚本): https://gitcode.com/gcw_coj3XaOd/genomics-tf-prediction
HuggingFace 原始源: https://huggingface.co/Genereux-akotenou/genomics-tf-prediction