biology-biopython
它能做什么
该技能为在 Python 中处理生物序列和数据库提供规则。适合处理序列文件或遗传数据的研究人员和学生。
适用场景
- ✓当你在 Python 中处理 DNA、RNA 或蛋白质序列的时候。
- ✓当你需要读取或转换 FASTA 或 GenBank 文件的时候。
- ✓当你想运行 BLAST 搜索或从 NCBI 数据库获取记录的时候。
技能链接
https://github.com/aiming-lab/AutoResearchClaw/blob/main/.claude/skills/biology-biopython/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“读取这个 FASTA 文件,把每条 DNA 序列翻译成蛋白质,并报告 GC 含量。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会使用 Biopython 库读取序列文件,计算 GC 含量等数值,翻译 DNA,并搜索 NCBI 数据库。它会遵循一些规则,例如在访问任何 NCBI 资源之前先设置电子邮箱地址。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Biopython Bioinformatics Best Practice
Sequence Manipulation
- Create sequences:
from Bio.Seq import Seq; seq = Seq("ATGCGA") - Complement:
seq.complement(); Reverse complement:seq.reverse_complement() - Transcription:
seq.transcribe()(DNA to RNA) - Translation:
seq.translate()(DNA/RNA to protein) - GC content:
from Bio.SeqUtils import gc_fraction; gc_fraction(seq) - Molecular weight:
from Bio.SeqUtils import molecular_weight
File Parsing (SeqIO)
- Read FASTA:
for rec in SeqIO.parse("file.fasta", "fasta"): ... - Read GenBank:
for rec in SeqIO.parse("file.gb", "genbank"): ... - Read single record:
rec = SeqIO.read("file.fasta", "fasta") - Write sequences:
SeqIO.write(records, "output.fasta", "fasta") - Convert formats:
SeqIO.convert("input.gb", "genbank", "output.fasta", "fasta") - Index large files:
idx = SeqIO.index("large.fasta", "fasta")for random access
BLAST Operations
- Online BLAST:
from Bio.Blast import NCBIWWW; result = NCBIWWW.qblast("blastn", "nt", seq) - Parse results:
from Bio.Blast import NCBIXML; records = NCBIXML.parse(result) - Local BLAST: run via subprocess, parse XML output with NCBIXML
- Always set
Entrez.emailbefore any NCBI access - Filter results by e-value (typically < 1e-5) and coverage
NCBI Database Access (Entrez)
- Always set email:
Entrez.email = "your@email.com" - Search:
handle = Entrez.esearch(db="pubmed", term="query") - Fetch records:
handle = Entrez.efetch(db="nucleotide", id="ID", rettype="fasta") - Use API key for higher rate limits (10 req/s vs 3 req/s)
- Respect NCBI rate limits; add delays between batch requests
Phylogenetics (Bio.Phylo)
- Read trees:
from Bio import Phylo; tree = Phylo.read("tree.nwk", "newick") - Draw trees:
Phylo.draw(tree)orPhylo.draw_ascii(tree) - Supported formats: newick, nexus, phyloxml
- Traverse clades:
for clade in tree.find_clades(): ... - Calculate distances:
tree.distance(clade1, clade2)
Structure Analysis (Bio.PDB)
- Parse PDB:
parser = PDBParser(); structure = parser.get_structure("id", "file.pdb") - Hierarchy: Structure > Model > Chain > Residue > Atom
- Get atoms: iterate through
structure.get_atoms() - Calculate distances: use atom coordinate vectors
- For mmCIF files: use
MMCIFParser()instead ofPDBParser()
Common Pitfalls
- Always handle
SeqIO.parseas an iterator — it exhausts after one pass - Check sequence alphabet compatibility before operations
- Large files: use
SeqIO.index()notSeqIO.to_dict()to avoid memory issues - Set proper timeout for remote BLAST queries (can take minutes)
- Validate parsed data — missing annotations are common in public databases
常见问题
使用 NCBI 之前需要设置什么吗?
需要。该技能要求在访问任何 NCBI 数据库之前设置你的电子邮箱地址。
它能处理大文件吗?
能。它可以为大型 FASTA 文件建立索引,以便随机访问。
它能在本地运行 BLAST 吗?
能。它可以通过本地命令运行 BLAST 并解析 XML 输出,也可以在线搜索。
详情
作者的原始描述
Bioinformatics with Biopython for sequence manipulation, file parsing, BLAST, and phylogenetics. Use when working with DNA/RNA/protein sequences or biological databases.
热度
- GitHub 星标
- 15k
- 排名
- #11045
- 许可证
- MIT
- 更新时间
- 2026/8/19
评论
- …
同一仓库的更多技能
a-evolve
15k帮你的智能体通过反复运行来不断改进:诊断失败原因,根据错误模式创建有针对性的技能,并记录经验以备日后使用。
chemistry-rdkit
15k帮你的智能体使用 RDKit 分析以 SMILES 字符串表示的分子,包括描述符、指纹、相似性和子结构搜索。
hypothesis-formulation
15k帮你的智能体把一项观察转化为可检验的假设,附上相互竞争的解释,以及能够证伪它们的明确预测。
literature-search
15k帮你的智能体规划并执行系统性文献检索,包括检索式、纳入规则、筛选步骤,以及 PRISMA 风格的结果计数。