biopython
它能做什么
这个工具可以帮你处理分子生物学信息,比如 DNA 或蛋白质序列。它允许你读取、写入和处理这些数据,还能访问科学数据库。
适用场景
- ✓当你需要分析 DNA 或蛋白质序列时。
- ✓当你需要读取或保存包含生物数据的文件(如 FASTA 或 GenBank)时。
- ✓需要在 PubMed 等科学数据库中搜索信息时。
技能链接
https://github.com/K-Dense-AI/scientific-agent-skills/blob/main/skills/biopython/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“分析这段 DNA 序列,并告诉我它的 GC 含量。”
每周 5 个新技能,1 分钟读完。
工作原理
这个工具使用名为 Biopython 的库,其中包含许多计算生物学常用任务的现成函数。它可以读取多种文件格式,还能与在线数据库交互。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Biopython: Computational Molecular Biology in Python
Overview
Biopython is a comprehensive set of freely available Python tools for biological computation. It provides functionality for sequence manipulation, file I/O, database access, structural bioinformatics, phylogenetics, and many other bioinformatics tasks. These examples target Biopython 1.88 (released 6 August 2026), tested here on Python 3.13. It requires Python 3.10+ and NumPy; Python 3.10 support is deprecated. Upgrade to 1.88 for its Bio.Nexus parser security fix, in addition to the Entrez XML fix in 1.87. See the release notes. Local example checks and external-service limits are recorded in references/review.md; examples requiring user files or external programs are illustrative unless listed there as exercised.
When to Use This Skill
Use this skill when:
- Working with biological sequences (DNA, RNA, or protein)
- Reading, writing, or converting biological file formats (FASTA, GenBank, FASTQ, PDB, mmCIF, etc.)
- Accessing NCBI databases (GenBank, PubMed, Protein, Gene, etc.) via Entrez
- Running BLAST searches or parsing BLAST results
- Performing sequence alignments (pairwise or multiple sequence alignments)
- Analyzing protein structures from PDB files
- Creating, manipulating, or visualizing phylogenetic trees
- Finding sequence motifs or analyzing motif patterns
- Calculating sequence statistics (GC content, molecular weight, melting temperature, etc.)
- Performing structural bioinformatics tasks
- Working with population genetics data
- Any other computational molecular biology task
Core Capabilities
Biopython is organized into modular sub-packages, each addressing specific bioinformatics domains:
- Sequence Handling - Bio.Seq and Bio.SeqIO for sequence manipulation and file I/O
- Alignment Analysis - Bio.Align and Bio.AlignIO for pairwise and multiple sequence alignments
- Database Access - Bio.Entrez for programmatic access to NCBI databases
- BLAST Operations - Bio.Blast for running and parsing BLAST searches
- Structural Bioinformatics - Bio.PDB for working with 3D protein structures
- Phylogenetics - Bio.Phylo for phylogenetic tree manipulation and visualization
- Advanced Features - Motifs, population genetics, sequence utilities, and more
Installation and Setup
Install the current stable Biopython release with an explicit version pin for reproducibility:
uv pip install "biopython==1.88"
For NCBI database access, always set your email address (required by NCBI). For reusable software, set a stable Entrez.tool value and register the tool/email with NCBI. For higher rate limits (10 req/s instead of 3 req/s), read only NCBI_API_KEY from the environment — do not hardcode keys or load unrelated environment variables:
import os
from Bio import Entrez
Entrez.email = "your.email@example.com" # required — use your real email
Entrez.tool = "your_tool_name" # optional but recommended for reusable software
# Optional: register at https://www.ncbi.nlm.nih.gov/account/settings/
if api_key := os.environ.get("NCBI_API_KEY"):
Entrez.api_key = api_key
Using This Skill
This skill provides comprehensive documentation organized by functionality area. When working on a task, consult the relevant reference documentation:
1. Sequence Handling (Bio.Seq & Bio.SeqIO)
Reference: references/sequence_io.md
Use for:
- Creating and manipulating biological sequences
- Reading and writing sequence files (FASTA, GenBank, FASTQ, etc.)
- Converting between file formats
- Extracting sequences from large files
- Sequence translation, transcription, and reverse complement
- Working with SeqRecord objects
Quick example:
from Bio import SeqIO
# Read sequences from FASTA file
for record in SeqIO.parse("sequences.fasta", "fasta"):
print(f"{record.id}: {len(record.seq)} bp")
# Convert GenBank to FASTA
SeqIO.convert("input.gb", "genbank", "output.fasta", "fasta")
2. Alignment Analysis (Bio.Align & Bio.AlignIO)
Reference: references/alignment.md
Use for:
- Pairwise sequence alignment (global and local)
- Reading and writing multiple sequence alignments
- Using substitution matrices (BLOSUM, PAM)
- Calculating alignment statistics
- Customizing alignment parameters
Quick example:
from Bio import Align
# Pairwise alignment
…
常见问题
使用这个工具需要会编程吗?
你不需要是经验丰富的程序员。工具简化了函数的使用,但了解自己想对生物数据做什么会很有帮助。
工具如何访问数据库?
它使用名为 Entrez 的系统连接 NCBI 数据库,比如 PubMed 和 GenBank,让你可以直接搜索和下载信息。
它能识别哪些文件类型?
它能识别几种常见的生物学格式,比如 FASTA、GenBank、PDB 等,方便不同程序之间交换数据。
详情
作者的原始描述
Provides Biopython workflows for sequence manipulation, file parsing (FASTA/GenBank/PDB), phylogenetics, and programmatic NCBI/PubMed access (Bio.Entrez). Supports batch processing, custom molecular-biology pipelines, BLAST automation, structure analysis, and motif analysis.
热度
- GitHub 星标
- 51k
- 排名
- #3432
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …