如何使用 Python 将 MeSH ID 映射到 MeSH 术语

我们的 MeSH-JSON 项目提供了预编译的 MeSH ID 到术语映射的 JSON:

在此下载 或使用此命令下载:

download_mesh_json.sh
wget "https://techoverflow.net/downloads/mesh.json.gz"

如何在 Python 中使用:

mesh_load_example.py
#!/usr/bin/env python3
import json
import gzip

# 如何加载
with gzip.open("mesh.json.gz", "rb") as infile:
    mesh_id_to_term = json.load(infile)

# 使用示例
print(mesh_id_to_term["D059630"]) # 打印 'Mesenchymal Stem Cells'

Check out similar posts by category: Bioinformatics, Python