Sequence Alignment
A skill for performing sequence alignment using NCBI BLAST API. Supports nucleotide and protein sequence comparison against major biological databases.
When to Use
- - Use this skill when the task needs performing sequence alignment using NCBI BLAST API. Supports nucleotide and protein sequence comparison against major biological databases.
- Use this skill for data analysis tasks that require explicit assumptions, bounded scope, and a reproducible output format.
- Use this skill when the response must stay inside the documented task boundary instead of expanding into adjacent work.
Key Features
See ## Features above for related details.
- - Scope-focused workflow aligned to: A skill for performing sequence alignment using NCBI BLAST API. Supports nucleotide and protein sequence comparison against major biological databases.
- Packaged executable path(s):
scripts/main.py. - Reference material available in
references/ for task-specific guidance. - Structured execution path designed to keep outputs consistent and reviewable.
Dependencies
See ## Prerequisites above for related details.
- -
Python: 3.10+. Repository baseline for current packaged skills. - INLINECODE6 :
not explicitly version-pinned in this skill package. Add pinned versions if this skill needs stricter environment control.
Example Usage
See ## Usage above for related details.
CODEBLOCK0
Example run plan:
- 1. Confirm the user input, output path, and any required config values.
- Edit the in-file
CONFIG block or documented parameters if the script uses fixed settings. - Run
python scripts/main.py with the validated inputs. - Review the generated output and return the final artifact with any assumptions called out.
Implementation Details
See ## Workflow above for related details.
- - Execution model: validate the request, choose the packaged workflow, and produce a bounded deliverable.
- Input controls: confirm the source files, scope limits, output format, and acceptance criteria before running any script.
- Primary implementation surface:
scripts/main.py. - Reference guidance:
references/ contains supporting rules, prompts, or checklists. - Parameters to clarify first: input path, output path, scope filters, thresholds, and any domain-specific constraints.
- Output discipline: keep results reproducible, identify assumptions explicitly, and avoid undocumented side effects.
Quick Check
Use this command to verify that the packaged script entry point can be parsed before deeper execution.
CODEBLOCK1
Audit-Ready Commands
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
CODEBLOCK2
Workflow
- 1. Confirm the user objective, required inputs, and non-negotiable constraints before doing detailed work.
- Validate that the request matches the documented scope and stop early if the task would require unsupported assumptions.
- Use the packaged script path or the documented reasoning path with only the inputs that are actually available.
- Return a structured result that separates assumptions, deliverables, risks, and unresolved items.
- If execution fails or inputs are incomplete, switch to the fallback path and state exactly what blocked full completion.
Features
- - BLAST API Integration: Query NCBI BLAST service for sequence similarity search
- Multiple BLAST Programs: blastn, blastp, blastx, tblastn, tblastx
- Alignment Visualization: Display results in human-readable format
- Database Support: nr, nt, swissprot, refseq, pdb, and more
Usage
CODEBLOCK3
Parameters
| Parameter | Description | Required |
|---|
| INLINECODE14 | Query sequence (DNA/Protein) | Yes |
| INLINECODE15 |
BLAST program: blastn, blastp, blastx, tblastn, tblastx | Yes |
|
--database | Target database: nr, nt, swissprot, pdb, refseq_protein | Yes |
|
--output | Output file path | No |
|
--format | Output format: text, json, csv | No (default: text) |
|
--max_hits | Maximum number of hits to return | No (default: 10) |
|
--evalue | E-value threshold | No (default: 10) |
Technical Difficulty
Medium - Requires understanding of BLAST algorithm, API handling with retry logic, and biological sequence formats.
BLAST Programs Reference
| Program | Query Type | Database Type | Use Case |
|---|
| blastn | Nucleotide | Nucleotide | DNA vs DNA |
| blastp |
Protein | Protein | Protein vs Protein |
| blastx | Nucleotide (translated) | Protein | DNA vs Protein |
| tblastn | Protein | Nucleotide (translated) | Protein vs DNA |
| tblastx | Nucleotide (translated) | Nucleotide (translated) | Translated DNA vs DNA |
Example Workflows
DNA Sequence Similarity Search
CODEBLOCK4
Protein Sequence Alignment
CODEBLOCK5
Output Format
Results include:
- - Query sequence info
- Hit definitions and accession numbers
- Alignment scores (bit score, e-value)
- Percent identity and similarity
- Alignment visualization with match/mismatch highlighting
References
Risk Assessment
| Risk Indicator | Assessment | Level |
|---|
| Code Execution | Python scripts with tools | High |
| Network Access |
External API calls | High |
| File System Access | Read/write data | Medium |
| Instruction Tampering | Standard prompt guidelines | Low |
| Data Exposure | Data handled securely | Medium |
Security Checklist
- - [ ] No hardcoded credentials or API keys
- [ ] No unauthorized file system access (../)
- [ ] Output does not expose sensitive information
- [ ] Prompt injection protections in place
- [ ] API requests use HTTPS only
- [ ] Input validated against allowed patterns
- [ ] API timeout and retry mechanisms implemented
- [ ] Output directory restricted to workspace
- [ ] Script execution in sandboxed environment
- [ ] Error messages sanitized (no internal paths exposed)
- [ ] Dependencies audited
- [ ] No exposure of internal service architecture
Prerequisites
No additional Python packages required.
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
Output Requirements
Every final response should make these items explicit when they are relevant:
- - Objective or requested deliverable
- Inputs used and assumptions introduced
- Workflow or decision path
- Core result, recommendation, or artifact
- Constraints, risks, caveats, or validation needs
- Unresolved items and next-step checks
Error Handling
- - If required inputs are missing, state exactly which fields are missing and request only the minimum additional information.
- If the task goes outside the documented scope, stop instead of guessing or silently widening the assignment.
- If
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback. - Do not fabricate files, citations, data, search results, or execution outcomes.
Input Validation
This skill accepts requests that match the documented purpose of sequence-alignment and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
INLINECODE23 only handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
Response Template
Use the following fixed structure for non-trivial requests:
- 1. Objective
- Inputs Received
- Assumptions
- Workflow
- Deliverable
- Risks and Limits
- Next Checks
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
序列比对
一项使用NCBI BLAST API进行序列比对的技能。支持针对主要生物数据库的核苷酸和蛋白质序列比较。
使用时机
- - 当任务需要使用NCBI BLAST API进行序列比对时使用此技能。支持针对主要生物数据库的核苷酸和蛋白质序列比较。
- 用于需要明确假设、有限范围和可重复输出格式的数据分析任务。
- 当响应必须保持在文档定义的任务边界内,而不扩展到相邻工作时使用此技能。
主要特性
相关详情请参见上方的## 特性部分。
- - 范围聚焦的工作流程,对齐于:一项使用NCBI BLAST API进行序列比对的技能。支持针对主要生物数据库的核苷酸和蛋白质序列比较。
- 打包的可执行路径:scripts/main.py。
- references/中提供参考材料,用于任务特定指导。
- 结构化执行路径,旨在保持输出一致且可审查。
依赖项
相关详情请参见上方的## 前提条件部分。
- - Python:3.10+。当前打包技能的仓库基线。
- 第三方包:本技能包中未明确指定版本。如果此技能需要更严格的环境控制,请添加固定版本。
使用示例
相关详情请参见上方的## 使用方法部分。
bash
cd 20260318/scientific-skills/Data Analytics/sequence-alignment
python -m py_compile scripts/main.py
python scripts/main.py --help
示例运行计划:
- 1. 确认用户输入、输出路径以及任何必需的配置值。
- 如果脚本使用固定设置,编辑文件内的CONFIG块或文档化参数。
- 使用验证后的输入运行python scripts/main.py。
- 审查生成的输出,并返回最终产物,同时注明任何假设。
实现细节
相关详情请参见上方的## 工作流程部分。
- - 执行模型:验证请求,选择打包的工作流程,并生成有限的可交付成果。
- 输入控制:在运行任何脚本之前,确认源文件、范围限制、输出格式和验收标准。
- 主要实现面:scripts/main.py。
- 参考指南:references/包含支持性规则、提示或检查清单。
- 首先需要明确的参数:输入路径、输出路径、范围过滤器、阈值以及任何领域特定约束。
- 输出规范:保持结果可重复,明确标识假设,避免未记录的副作用。
快速检查
在深入执行之前,使用此命令验证打包脚本入口点是否可解析。
bash
python -m py_compile scripts/main.py
审计就绪命令
使用这些具体命令进行验证。它们特意设计为自包含,避免使用占位符路径。
bash
python -m py_compile scripts/main.py
python scripts/main.py --help
工作流程
- 1. 在进行详细工作之前,确认用户目标、所需输入和不可协商的约束条件。
- 验证请求是否与文档范围匹配,如果任务需要不支持的假设,则提前停止。
- 仅使用实际可用的输入,使用打包脚本路径或文档化的推理路径。
- 返回结构化结果,将假设、可交付成果、风险和未解决项分开。
- 如果执行失败或输入不完整,切换到备用路径,并准确说明阻止完整完成的原因。
特性
- - BLAST API集成:查询NCBI BLAST服务进行序列相似性搜索
- 多种BLAST程序:blastn、blastp、blastx、tblastn、tblastx
- 比对可视化:以人类可读格式显示结果
- 数据库支持:nr、nt、swissprot、refseq、pdb等
使用方法
text
python scripts/main.py --sequence ATGCGTACGTAGCTAGCTAG --program blastn --database nt --output results.txt
参数
| 参数 | 描述 | 必需 |
|---|
| --sequence | 查询序列(DNA/蛋白质) | 是 |
| --program |
BLAST程序:blastn、blastp、blastx、tblastn、tblastx | 是 |
| --database | 目标数据库:nr、nt、swissprot、pdb、refseq_protein | 是 |
| --output | 输出文件路径 | 否 |
| --format | 输出格式:text、json、csv | 否(默认:text) |
| --max_hits | 返回的最大命中数 | 否(默认:10) |
| --evalue | E值阈值 | 否(默认:10) |
技术难度
中等 - 需要理解BLAST算法、带重试逻辑的API处理以及生物序列格式。
BLAST程序参考
| 程序 | 查询类型 | 数据库类型 | 使用场景 |
|---|
| blastn | 核苷酸 | 核苷酸 | DNA vs DNA |
| blastp |
蛋白质 | 蛋白质 | 蛋白质 vs 蛋白质 |
| blastx | 核苷酸(翻译后) | 蛋白质 | DNA vs 蛋白质 |
| tblastn | 蛋白质 | 核苷酸(翻译后) | 蛋白质 vs DNA |
| tblastx | 核苷酸(翻译后) | 核苷酸(翻译后) | 翻译后DNA vs DNA |
示例工作流程
DNA序列相似性搜索
text
python scripts/main.py --sequence ATGGCCCTGTGGATGCGCTTCTTAGTCG --program blastn --database nt --max_hits 5
蛋白质序列比对
text
python scripts/main.py --sequence MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQAPILSRVGDGT --program blastp --database swissprot --evalue 0.001
输出格式
结果包括:
- - 查询序列信息
- 命中定义和登录号
- 比对得分(比特分数、E值)
- 百分比一致性和相似性
- 带匹配/不匹配高亮显示的比对可视化
参考资料
风险评估
| 风险指标 | 评估 | 级别 |
|---|
| 代码执行 | 带工具的Python脚本 | 高 |
| 网络访问 |
外部API调用 | 高 |
| 文件系统访问 | 读/写数据 | 中等 |
| 指令篡改 | 标准提示指南 | 低 |
| 数据暴露 | 安全处理数据 | 中等 |
安全检查清单
- - [ ] 无硬编码凭证或API密钥
- [ ] 无未经授权的文件系统访问(../)
- [ ] 输出不暴露敏感信息
- [ ] 已实施提示注入保护
- [ ] API请求仅使用HTTPS
- [ ] 输入已根据允许模式进行验证
- [ ] 已实现API超时和重试机制
- [ ] 输出目录限制在工作空间内
- [ ] 在沙盒环境中执行脚本
- [ ] 错误消息已清理(不暴露内部路径)
- [ ] 依赖项已审计
- [ ] 不暴露内部服务架构
前提条件
无需额外的Python包。
评估标准
成功指标
- - [ ] 成功执行主要功能
- [ ] 输出符合质量标准
- [ ] 优雅处理边缘情况
- [ ] 性能可接受
测试用例
- 1. 基本功能:标准输入 → 预期输出
- 边缘情况:无效输入 → 优雅的错误处理
- 性能:大数据集 → 可接受的处理时间
生命周期状态
- - 当前阶段:草案
- 下次审查日期:2026-03-06
- 已知问题:无
- 计划改进:
- 性能优化
- 额外功能支持
输出要求
每个最终响应在相关时应明确以下内容:
- - 目标或请求的可交付成果
- 使用的输入和引入的假设
- 工作流程或决策路径
- 核心结果、建议或产物
- 约束、风险、注意事项或验证需求
- 未解决项和下一步检查
错误处理
- - 如果缺少必需输入,准确说明缺少哪些字段,并仅请求最少的额外信息。
- 如果任务超出文档范围,停止而不是猜测或静默扩大任务范围。
- 如果scripts/main.py失败,报告失败点,总结仍可安全完成的内容,并提供手动备用方案。
- 不要捏造文件、引用、数据、搜索结果或执行结果。
输入验证
此技能接受与sequence-alignment文档化目的匹配且包含足够上下文以安全完成工作流程的请求。
当请求超出范围、缺少关键输入或需要不支持的假设时,不要继续工作流程。而是响应:
sequence-alignment仅处理其文档化的工作流程。请提供