kegg-database by davila7/claude-code-templates
npx skills add https://github.com/davila7/claude-code-templates --skill kegg-databaseKEGG(京都基因与基因组百科全书)是一个用于生物通路分析和分子相互作用网络的综合生物信息学资源。
重要提示:KEGG API 仅限学术用户用于学术用途。
当需要使用 KEGG 的 REST API 跨多个生物体查询通路、基因、化合物、酶、疾病和药物时,应使用此技能。
该技能提供:
scripts/kegg_api.py)references/kegg_reference.md)当用户请求 KEGG 数据时,确定需要哪种操作,并使用 scripts/kegg_api.py 中的相应函数。
kegg_info)检索 KEGG 数据库的元数据和统计信息。
何时使用:了解数据库结构、检查可用数据、获取发布信息。
用法:
from scripts.kegg_api import kegg_info
# 获取通路数据库信息
info = kegg_info('pathway')
# 获取生物体特定信息
hsa_info = kegg_info('hsa') # 人类基因组
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
常见数据库:kegg, pathway, module, brite, genes, genome, compound, glycan, reaction, enzyme, disease, drug
kegg_list)列出 KEGG 数据库中的条目标识符和名称。
何时使用:获取生物体的所有通路、列出基因、检索化合物目录。
用法:
from scripts.kegg_api import kegg_list
# 列出所有参考通路
pathways = kegg_list('pathway')
# 列出人类特定通路
hsa_pathways = kegg_list('pathway', 'hsa')
# 列出特定基因(最多 10 个)
genes = kegg_list('hsa:10458+hsa:10459')
常见生物体代码:hsa (人类), mmu (小鼠), dme (果蝇), sce (酵母), eco (大肠杆菌)
kegg_find)通过关键词或分子属性搜索 KEGG 数据库。
何时使用:通过名称/描述查找基因、通过分子式或质量搜索化合物、通过关键词发现条目。
用法:
from scripts.kegg_api import kegg_find
# 关键词搜索
results = kegg_find('genes', 'p53')
shiga_toxin = kegg_find('genes', 'shiga toxin')
# 化学式搜索(精确匹配)
compounds = kegg_find('compound', 'C7H10N4O2', 'formula')
# 分子量范围搜索
drugs = kegg_find('drug', '300-310', 'exact_mass')
搜索选项:formula (精确匹配), exact_mass (范围), mol_weight (范围)
kegg_get)获取完整的数据库条目或特定的数据格式。
何时使用:检索通路详细信息、获取基因/蛋白质序列、下载通路图谱、访问化合物结构。
用法:
from scripts.kegg_api import kegg_get
# 获取通路条目
pathway = kegg_get('hsa00010') # 糖酵解通路
# 获取多个条目(最多 10 个)
genes = kegg_get(['hsa:10458', 'hsa:10459'])
# 获取蛋白质序列 (FASTA)
sequence = kegg_get('hsa:10458', 'aaseq')
# 获取核苷酸序列
nt_seq = kegg_get('hsa:10458', 'ntseq')
# 获取化合物结构
mol_file = kegg_get('cpd:C00002', 'mol') # ATP,MOL 格式
# 获取通路为 JSON 格式(仅限单个条目)
pathway_json = kegg_get('hsa05130', 'json')
# 获取通路图像(仅限单个条目)
pathway_img = kegg_get('hsa05130', 'image')
输出格式:aaseq (蛋白质 FASTA), ntseq (核苷酸 FASTA), mol (MOL 格式), kcf (KCF 格式), image (PNG), kgml (XML), json (通路 JSON)
重要提示:图像、KGML 和 JSON 格式每次仅允许一个条目。
kegg_conv)在 KEGG 和外部数据库之间转换标识符。
何时使用:将 KEGG 数据与其他数据库集成、映射基因 ID、转换化合物标识符。
用法:
from scripts.kegg_api import kegg_conv
# 将所有人类基因转换为 NCBI Gene ID
conversions = kegg_conv('ncbi-geneid', 'hsa')
# 转换特定基因
gene_id = kegg_conv('ncbi-geneid', 'hsa:10458')
# 转换为 UniProt
uniprot_id = kegg_conv('uniprot', 'hsa:10458')
# 将化合物转换为 PubChem
pubchem_ids = kegg_conv('pubchem', 'compound')
# 反向转换 (NCBI Gene ID 到 KEGG)
kegg_id = kegg_conv('hsa', 'ncbi-geneid')
支持的转换:ncbi-geneid, ncbi-proteinid, uniprot, pubchem, chebi
kegg_link)在 KEGG 数据库内部和之间查找相关条目。
何时使用:查找包含基因的通路、获取通路中的基因、将基因映射到 KO 组、查找通路中的化合物。
用法:
from scripts.kegg_api import kegg_link
# 查找与人类基因链接的通路
pathways = kegg_link('pathway', 'hsa')
# 获取特定通路中的基因
genes = kegg_link('genes', 'hsa00010') # 糖酵解基因
# 查找包含特定基因的通路
gene_pathways = kegg_link('pathway', 'hsa:10458')
# 查找通路中的化合物
compounds = kegg_link('compound', 'hsa00010')
# 将基因映射到 KO(直系同源)组
ko_groups = kegg_link('ko', 'hsa:10458')
常见链接:genes ↔ pathway, pathway ↔ compound, pathway ↔ enzyme, genes ↔ ko (orthology)
kegg_ddi)检查药物-药物相互作用。
何时使用:分析药物组合、检查禁忌症、药理学研究。
用法:
from scripts.kegg_api import kegg_ddi
# 检查单一药物
interactions = kegg_ddi('D00001')
# 检查多种药物(最多 10 个)
interactions = kegg_ddi(['D00001', 'D00002', 'D00003'])
使用场景:查找与感兴趣基因相关的通路(例如,用于通路富集分析)。
from scripts.kegg_api import kegg_find, kegg_link, kegg_get
# 步骤 1:通过名称查找基因 ID
gene_results = kegg_find('genes', 'p53')
# 步骤 2:将基因链接到通路
pathways = kegg_link('pathway', 'hsa:7157') # TP53 基因
# 步骤 3:获取详细的通路信息
for pathway_line in pathways.split('\n'):
if pathway_line:
pathway_id = pathway_line.split('\t')[1].replace('path:', '')
pathway_info = kegg_get(pathway_id)
# 处理通路信息
使用场景:获取生物体通路中的所有基因以进行富集分析。
from scripts.kegg_api import kegg_list, kegg_link
# 步骤 1:列出所有人类通路
pathways = kegg_list('pathway', 'hsa')
# 步骤 2:对于每个通路,获取相关基因
for pathway_line in pathways.split('\n'):
if pathway_line:
pathway_id = pathway_line.split('\t')[0]
genes = kegg_link('genes', pathway_id)
# 为富集分析处理基因
使用场景:查找包含感兴趣化合物的代谢通路。
from scripts.kegg_api import kegg_find, kegg_link, kegg_get
# 步骤 1:搜索化合物
compound_results = kegg_find('compound', 'glucose')
# 步骤 2:将化合物链接到反应
reactions = kegg_link('reaction', 'cpd:C00031') # 葡萄糖
# 步骤 3:将反应链接到通路
pathways = kegg_link('pathway', 'rn:R00299') # 特定反应
# 步骤 4:获取通路详细信息
pathway_info = kegg_get('map00010') # 糖酵解
使用场景:将 KEGG 数据与 UniProt、NCBI 或 PubChem 数据库集成。
from scripts.kegg_api import kegg_conv, kegg_get
# 步骤 1:将 KEGG 基因 ID 转换为外部数据库 ID
uniprot_map = kegg_conv('uniprot', 'hsa')
ncbi_map = kegg_conv('ncbi-geneid', 'hsa')
# 步骤 2:解析转换结果
for line in uniprot_map.split('\n'):
if line:
kegg_id, uniprot_id = line.split('\t')
# 使用外部 ID 进行集成
# 步骤 3:使用 KEGG 获取序列
sequence = kegg_get('hsa:10458', 'aaseq')
使用场景:比较不同生物体之间的通路。
from scripts.kegg_api import kegg_list, kegg_get
# 步骤 1:列出多个生物体的通路
human_pathways = kegg_list('pathway', 'hsa')
mouse_pathways = kegg_list('pathway', 'mmu')
yeast_pathways = kegg_list('pathway', 'sce')
# 步骤 2:获取用于比较的参考通路
ref_pathway = kegg_get('map00010') # 参考糖酵解
# 步骤 3:获取生物体特定版本
hsa_glycolysis = kegg_get('hsa00010')
mmu_glycolysis = kegg_get('mmu00010')
KEGG 将通路组织为七个主要类别。在解释通路 ID 或向用户推荐通路时:
map00010 - 糖酵解, map00190 - 氧化磷酸化)map03010 - 核糖体, map03040 - 剪接体)map04010 - MAPK 信号通路, map02010 - ABC 转运蛋白)map04140 - 自噬, map04210 - 凋亡)map04610 - 补体级联反应, map04910 - 胰岛素信号通路)map05200 - 癌症通路, map05010 - 阿尔茨海默病)有关详细通路列表和分类,请参考 references/kegg_reference.md。
map##### - 参考通路(通用,非生物体特定)hsa##### - 人类通路mmu##### - 小鼠通路organism:gene_number (例如,hsa:10458)cpd:C##### (例如,cpd:C00002 代表 ATP)dr:D##### (例如,dr:D00001)ec:EC_number (例如,ec:1.1.1.1)ko:K##### (例如,ko:K00001)使用 KEGG API 时请遵守以下约束:
有关全面的 API 文档、数据库规范、生物体代码和高级用法,请参考 references/kegg_reference.md。其中包括:
404 未找到:条目或数据库不存在;验证 ID 和生物体代码 400 错误请求:API 调用中存在语法错误;检查参数格式 空结果:搜索词可能不匹配条目;尝试更广泛的关键词 图像/KGML 错误:这些格式仅适用于单个条目;移除批处理
用于交互式通路可视化和注释:
每周安装数
128
仓库
GitHub 星标
22.6K
首次出现
2026年1月21日
安全审计
安装于
claude-code108
opencode101
cursor95
gemini-cli93
antigravity87
codex85
KEGG (Kyoto Encyclopedia of Genes and Genomes) is a comprehensive bioinformatics resource for biological pathway analysis and molecular interaction networks.
Important : KEGG API is made available only for academic use by academic users.
This skill should be used when querying pathways, genes, compounds, enzymes, diseases, and drugs across multiple organisms using KEGG's REST API.
The skill provides:
scripts/kegg_api.py) for all KEGG REST API operationsreferences/kegg_reference.md) with detailed API specificationsWhen users request KEGG data, determine which operation is needed and use the appropriate function from scripts/kegg_api.py.
kegg_info)Retrieve metadata and statistics about KEGG databases.
When to use : Understanding database structure, checking available data, getting release information.
Usage :
from scripts.kegg_api import kegg_info
# Get pathway database info
info = kegg_info('pathway')
# Get organism-specific info
hsa_info = kegg_info('hsa') # Human genome
Common databases : kegg, pathway, module, brite, genes, genome, compound, glycan, reaction, enzyme, disease, drug
kegg_list)List entry identifiers and names from KEGG databases.
When to use : Getting all pathways for an organism, listing genes, retrieving compound catalogs.
Usage :
from scripts.kegg_api import kegg_list
# List all reference pathways
pathways = kegg_list('pathway')
# List human-specific pathways
hsa_pathways = kegg_list('pathway', 'hsa')
# List specific genes (max 10)
genes = kegg_list('hsa:10458+hsa:10459')
Common organism codes : hsa (human), mmu (mouse), dme (fruit fly), sce (yeast), eco (E. coli)
kegg_find)Search KEGG databases by keywords or molecular properties.
When to use : Finding genes by name/description, searching compounds by formula or mass, discovering entries by keywords.
Usage :
from scripts.kegg_api import kegg_find
# Keyword search
results = kegg_find('genes', 'p53')
shiga_toxin = kegg_find('genes', 'shiga toxin')
# Chemical formula search (exact match)
compounds = kegg_find('compound', 'C7H10N4O2', 'formula')
# Molecular weight range search
drugs = kegg_find('drug', '300-310', 'exact_mass')
Search options : formula (exact match), exact_mass (range), mol_weight (range)
kegg_get)Get complete database entries or specific data formats.
When to use : Retrieving pathway details, getting gene/protein sequences, downloading pathway maps, accessing compound structures.
Usage :
from scripts.kegg_api import kegg_get
# Get pathway entry
pathway = kegg_get('hsa00010') # Glycolysis pathway
# Get multiple entries (max 10)
genes = kegg_get(['hsa:10458', 'hsa:10459'])
# Get protein sequence (FASTA)
sequence = kegg_get('hsa:10458', 'aaseq')
# Get nucleotide sequence
nt_seq = kegg_get('hsa:10458', 'ntseq')
# Get compound structure
mol_file = kegg_get('cpd:C00002', 'mol') # ATP in MOL format
# Get pathway as JSON (single entry only)
pathway_json = kegg_get('hsa05130', 'json')
# Get pathway image (single entry only)
pathway_img = kegg_get('hsa05130', 'image')
Output formats : aaseq (protein FASTA), ntseq (nucleotide FASTA), mol (MOL format), kcf (KCF format), image (PNG), kgml (XML), json (pathway JSON)
Important : Image, KGML, and JSON formats allow only one entry at a time.
kegg_conv)Convert identifiers between KEGG and external databases.
When to use : Integrating KEGG data with other databases, mapping gene IDs, converting compound identifiers.
Usage :
from scripts.kegg_api import kegg_conv
# Convert all human genes to NCBI Gene IDs
conversions = kegg_conv('ncbi-geneid', 'hsa')
# Convert specific gene
gene_id = kegg_conv('ncbi-geneid', 'hsa:10458')
# Convert to UniProt
uniprot_id = kegg_conv('uniprot', 'hsa:10458')
# Convert compounds to PubChem
pubchem_ids = kegg_conv('pubchem', 'compound')
# Reverse conversion (NCBI Gene ID to KEGG)
kegg_id = kegg_conv('hsa', 'ncbi-geneid')
Supported conversions : ncbi-geneid, ncbi-proteinid, uniprot, pubchem, chebi
kegg_link)Find related entries within and between KEGG databases.
When to use : Finding pathways containing genes, getting genes in a pathway, mapping genes to KO groups, finding compounds in pathways.
Usage :
from scripts.kegg_api import kegg_link
# Find pathways linked to human genes
pathways = kegg_link('pathway', 'hsa')
# Get genes in a specific pathway
genes = kegg_link('genes', 'hsa00010') # Glycolysis genes
# Find pathways containing a specific gene
gene_pathways = kegg_link('pathway', 'hsa:10458')
# Find compounds in a pathway
compounds = kegg_link('compound', 'hsa00010')
# Map genes to KO (orthology) groups
ko_groups = kegg_link('ko', 'hsa:10458')
Common links : genes ↔ pathway, pathway ↔ compound, pathway ↔ enzyme, genes ↔ ko (orthology)
kegg_ddi)Check for drug-drug interactions.
When to use : Analyzing drug combinations, checking for contraindications, pharmacological research.
Usage :
from scripts.kegg_api import kegg_ddi
# Check single drug
interactions = kegg_ddi('D00001')
# Check multiple drugs (max 10)
interactions = kegg_ddi(['D00001', 'D00002', 'D00003'])
Use case : Finding pathways associated with genes of interest (e.g., for pathway enrichment analysis).
from scripts.kegg_api import kegg_find, kegg_link, kegg_get
# Step 1: Find gene ID by name
gene_results = kegg_find('genes', 'p53')
# Step 2: Link gene to pathways
pathways = kegg_link('pathway', 'hsa:7157') # TP53 gene
# Step 3: Get detailed pathway information
for pathway_line in pathways.split('\n'):
if pathway_line:
pathway_id = pathway_line.split('\t')[1].replace('path:', '')
pathway_info = kegg_get(pathway_id)
# Process pathway information
Use case : Getting all genes in organism pathways for enrichment analysis.
from scripts.kegg_api import kegg_list, kegg_link
# Step 1: List all human pathways
pathways = kegg_list('pathway', 'hsa')
# Step 2: For each pathway, get associated genes
for pathway_line in pathways.split('\n'):
if pathway_line:
pathway_id = pathway_line.split('\t')[0]
genes = kegg_link('genes', pathway_id)
# Process genes for enrichment analysis
Use case : Finding metabolic pathways containing compounds of interest.
from scripts.kegg_api import kegg_find, kegg_link, kegg_get
# Step 1: Search for compound
compound_results = kegg_find('compound', 'glucose')
# Step 2: Link compound to reactions
reactions = kegg_link('reaction', 'cpd:C00031') # Glucose
# Step 3: Link reactions to pathways
pathways = kegg_link('pathway', 'rn:R00299') # Specific reaction
# Step 4: Get pathway details
pathway_info = kegg_get('map00010') # Glycolysis
Use case : Integrating KEGG data with UniProt, NCBI, or PubChem databases.
from scripts.kegg_api import kegg_conv, kegg_get
# Step 1: Convert KEGG gene IDs to external database IDs
uniprot_map = kegg_conv('uniprot', 'hsa')
ncbi_map = kegg_conv('ncbi-geneid', 'hsa')
# Step 2: Parse conversion results
for line in uniprot_map.split('\n'):
if line:
kegg_id, uniprot_id = line.split('\t')
# Use external IDs for integration
# Step 3: Get sequences using KEGG
sequence = kegg_get('hsa:10458', 'aaseq')
Use case : Comparing pathways across different organisms.
from scripts.kegg_api import kegg_list, kegg_get
# Step 1: List pathways for multiple organisms
human_pathways = kegg_list('pathway', 'hsa')
mouse_pathways = kegg_list('pathway', 'mmu')
yeast_pathways = kegg_list('pathway', 'sce')
# Step 2: Get reference pathway for comparison
ref_pathway = kegg_get('map00010') # Reference glycolysis
# Step 3: Get organism-specific versions
hsa_glycolysis = kegg_get('hsa00010')
mmu_glycolysis = kegg_get('mmu00010')
KEGG organizes pathways into seven major categories. When interpreting pathway IDs or recommending pathways to users:
map00010 - Glycolysis, map00190 - Oxidative phosphorylation)map03010 - Ribosome, map03040 - Spliceosome)map04010 - MAPK signaling, map02010 - ABC transporters)map04140 - Autophagy, map04210 - Apoptosis)map04610 - Complement cascade, - Insulin signaling)Reference references/kegg_reference.md for detailed pathway lists and classifications.
map##### - Reference pathway (generic, not organism-specific)hsa##### - Human pathwaymmu##### - Mouse pathwayorganism:gene_number (e.g., hsa:10458)cpd:C##### (e.g., cpd:C00002 for ATP)dr:D##### (e.g., dr:D00001)ec:EC_number (e.g., ec:1.1.1.1)ko:K##### (e.g., ko:K00001)Respect these constraints when using the KEGG API:
For comprehensive API documentation, database specifications, organism codes, and advanced usage, refer to references/kegg_reference.md. This includes:
404 Not Found : Entry or database doesn't exist; verify IDs and organism codes 400 Bad Request : Syntax error in API call; check parameter formatting Empty results : Search term may not match entries; try broader keywords Image/KGML errors : These formats only work with single entries; remove batch processing
For interactive pathway visualization and annotation:
Weekly Installs
128
Repository
GitHub Stars
22.6K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code108
opencode101
cursor95
gemini-cli93
antigravity87
codex85
lark-cli 共享规则:飞书资源操作指南与权限配置详解
31,600 周安装
gh-cli:GitHub 命令行工具,替代 curl/wget,高效管理仓库、PR、Issue
659 周安装
图像SEO优化指南:替代文本、文件压缩、格式选择与性能提升
615 周安装
程序化SEO分析与规划工具:大规模生成高质量页面,防止内容单薄与索引膨胀
615 周安装
iOS 身份验证开发指南:Sign in with Apple、OAuth、生物识别与密码自动填充
617 周安装
交互式作品集设计指南:30秒吸引招聘者,提升作品集转化率与个人品牌
611 周安装
SEO内容优化与E-E-A-T分析指南 | AI时代内容质量评估与生成式引擎优化(GEO)
623 周安装
map04910map05200 - Pathways in cancer, map05010 - Alzheimer disease)