Western Blot Quantifier
Automatically identify Western Blot gel bands, perform densitometric analysis, and calculate normalized values relative to loading controls.
Features
- - Automatic Band Detection: Detect protein band positions in gel images
- Densitometric Analysis: Calculate grayscale/optical density values for each band
- Normalization: Normalize relative to loading control proteins (e.g., GAPDH, β-actin, Tubulin)
- Data Export: Output quantitative results in CSV format
Usage
Basic Usage
CODEBLOCK0
Command Line Usage
CODEBLOCK1
Parameter Description
| Parameter | Description | Default |
|---|
| INLINECODE0 | Gel image path | Required |
| INLINECODE1 |
Loading control protein name list | ["GAPDH"] |
|
target_bands | Target protein name list | [] |
|
lane_positions | Lane position list | Auto-detect |
|
threshold | Band detection threshold | 0.1 |
|
background_correction | Background correction method | "rolling_ball" |
Output Format
CSV Output Example
CODEBLOCK2
Return Object
CODEBLOCK3
Dependencies
CODEBLOCK4
Installation
CODEBLOCK5
Notes
- 1. Image Quality: High resolution, good contrast grayscale or black and white gel images are recommended
- Loading Control Selection: Common loading controls include GAPDH, β-actin, Tubulin; selection depends on experimental conditions
- Background Correction: Supports rolling_ball, median, none three background correction methods
- Lane Marking: If auto-detection is inaccurate, lane positions can be manually specified
Examples
Example 1: Basic Analysis
CODEBLOCK6
Example 2: Batch Processing
CODEBLOCK7
Algorithm Description
- 1. Image Preprocessing: Grayscale conversion → Background correction → Denoising
- Lane Detection: Automatic lane boundary identification based on vertical projection analysis
- Band Detection: Band localization using 1D Gaussian fitting or peak detection algorithms
- Optical Density Calculation: Integrate grayscale values in band region, subtract background
- Normalization: Target protein value / Loading control protein value
Author
OpenClaw Skills
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python/R scripts executed locally | Medium |
| Network Access |
No external API calls | Low |
| File System Access | Read input files, write output files | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Output files saved to workspace | Low |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] Input file paths validated (no ../ traversal)
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no stack traces exposed)
- [ ] Dependencies audited
Prerequisites
CODEBLOCK8
Evaluation Criteria
Success Metrics
- - [ ] Successfully executes main functionality
- [ ] Output meets quality standards
- [ ] Handles edge cases gracefully
- [ ] Performance is acceptable
Test Cases
- 1. Basic Functionality: Standard input → Expected output
- Edge Case: Invalid input → Graceful error handling
- Performance: Large dataset → Acceptable processing time
Lifecycle Status
- - Current Stage: Draft
- Next Review Date: 2026-03-06
- Known Issues: None
- Planned Improvements:
- Performance optimization
- Additional feature support
技能名称: western-blot-quantifier
详细描述:
Western Blot 定量分析工具
自动识别 Western Blot 凝胶条带,进行光密度分析,并计算相对于内参的归一化值。
功能特点
- - 自动条带检测:检测凝胶图像中的蛋白条带位置
- 光密度分析:计算每个条带的灰度/光密度值
- 归一化处理:相对于内参蛋白(如 GAPDH、β-actin、Tubulin)进行归一化
- 数据导出:以 CSV 格式输出定量结果
使用方法
基本用法
python
在 Python 中调用
from skills.western
blotquantifier.scripts.main import WesternBlotQuantifier
创建分析器
analyzer = WesternBlotQuantifier()
分析单张图像
result = analyzer.analyze(
image
path=path/to/wbimage.png,
reference_bands=[GAPDH], # 内参条带名称
target_bands=[p53, Bcl-2], # 目标蛋白条带名称
lane_positions=[0.2, 0.4, 0.6, 0.8] # 泳道位置(相对于图像宽度)
)
print(result.summary())
result.save(output/quantification_results.csv)
命令行使用
bash
python -m skills.westernblotquantifier.scripts.main \
--input path/to/wb_image.png \
--reference GAPDH \
--targets p53,Bcl-2 \
--lanes 4 \
--output results.csv
参数说明
| 参数 | 说明 | 默认值 |
|---|
| imagepath | 凝胶图像路径 | 必填 |
| referencebands |
内参蛋白名称列表 | [GAPDH] |
| target_bands | 目标蛋白名称列表 | [] |
| lane_positions | 泳道位置列表 | 自动检测 |
| threshold | 条带检测阈值 | 0.1 |
| background
correction | 背景校正方法 | rollingball |
输出格式
CSV 输出示例
csv
Lane,Protein,RawIntensity,Background,CorrectedIntensity,NormalizedtoReference
1,GAPDH,125000.5,5000.2,120000.3,1.00
1,p53,85000.2,3000.1,82000.1,0.68
1,Bcl-2,62000.8,2500.5,59500.3,0.50
2,GAPDH,118000.3,4800.2,113200.1,1.00
...
返回对象
python
{
raw_data: DataFrame, # 原始光密度数据
normalized_data: DataFrame, # 归一化后的数据
band_regions: List[Dict], # 检测到的条带区域坐标
statistics: Dict, # 统计分析结果
figures: Dict # 可视化图表路径
}
依赖项
numpy>=1.21.0
opencv-python>=4.5.0
pandas>=1.3.0
matplotlib>=3.4.0
scipy>=1.7.0
scikit-image>=0.18.0
安装
bash
pip install -r requirements.txt
注意事项
- 1. 图像质量:建议使用高分辨率、对比度良好的灰度或黑白凝胶图像
- 内参选择:常用内参包括 GAPDH、β-actin、Tubulin,选择取决于实验条件
- 背景校正:支持 rolling_ball、median、none 三种背景校正方法
- 泳道标记:如果自动检测不准确,可以手动指定泳道位置
示例
示例 1:基础分析
python
from skills.westernblotquantifier.scripts.main import WesternBlotQuantifier
analyzer = WesternBlotQuantifier()
分析 4 泳道 Western Blot 结果
result = analyzer.analyze(
image
path=experimentdata/wb_gel.png,
reference_bands=[GAPDH],
target_bands=[p53, p21],
lane_count=4
)
查看归一化结果
print(result.normalized_data)
保存图表
result.save_figures(output/)
示例 2:批量处理
python
import glob
analyzer = WesternBlotQuantifier()
for image_path in glob.glob(experiments/*.png):
result = analyzer.analyze(
imagepath=imagepath,
reference_bands=[β-actin],
targetbands=[TargetProtein],
lane_count=6
)
result.save(foutput/{Path(imagepath).stem}results.csv)
算法说明
- 1. 图像预处理:灰度转换 → 背景校正 → 去噪
- 泳道检测:基于垂直投影分析自动识别泳道边界
- 条带检测:使用一维高斯拟合或峰值检测算法定位条带
- 光密度计算:积分条带区域灰度值,减去背景
- 归一化处理:目标蛋白值 / 内参蛋白值
作者
OpenClaw Skills
风险评估
| 风险指标 | 评估 | 等级 |
|---|
| 代码执行 | 本地执行 Python/R 脚本 | 中 |
| 网络访问 |
无外部 API 调用 | 低 |
| 文件系统访问 | 读取输入文件,写入输出文件 | 中 |
| 指令篡改 | 标准提示词指南 | 低 |
| 数据泄露 | 输出文件保存到工作区 | 低 |
安全检查清单
- - [ ] 无硬编码的凭据或 API 密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不泄露敏感信息
- [ ] 已实施提示注入保护
- [ ] 输入文件路径已验证(无 ../ 遍历)
- [ ] 输出目录限制在工作区内
- [ ] 脚本在沙盒环境中执行
- [ ] 错误消息已清理(不暴露堆栈跟踪)
- [ ] 依赖项已审计
前置条件
bash
Python 依赖项
pip install -r requirements.txt
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- - 当前阶段:草稿
- 下次审查日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 增加更多功能支持