技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
string-database【数据与研究】Access the STRING database to map identifiers, retrieve protein–protein interaction networks, and run functional/PPI enrichment when you need interaction context for a gene/protein set.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
TP53) and need to resolve them to STRING protein identifiers for downstream analysis.>=3.8requests (tested with >=2.28)pandas (tested with >=1.5)Install:
pip install requests pandas
from scripts.string_api import StringClient
def main():
# STRING does not require a secret API key, but providing a caller identity is recommended.
client = StringClient(caller_identity="my_analysis_tool")
# 1) Map an identifier (e.g., TP53 in Homo sapiens; NCBI taxonomy ID 9606)
protein_id = client.map_id(identifier="TP53", species=9606)
print("Mapped ID:", protein_id)
# 2) Download a network image and expand by adding interaction partners
client.get_network_image(
identifiers=[protein_id],
output_file="tp53_network.png",
add_color_nodes=10, # add 10 partners
)
print("Saved network image to tp53_network.png")
# 3) Run PPI enrichment for the set
ppi_stats = client.get_ppi_enrichment(identifiers=[protein_id])
print("PPI enrichment:", ppi_stats)
if __name__ == "__main__":
main()
scripts/string_api.py provides the main wrapper (e.g., StringClient) around the STRING REST API.caller_identity string is strongly recommended (project name/email/URL) to support rate/load management.StringClient(caller_identity="my_email@example.com")) or inject via environment variables in your own wrapper.9606 for human).references/string_reference.md for original API notes and endpoint details included with this skill.