TCMSP-Spider is a Python tool for extracting data from TCMSP (Traditional Chinese Medicine Systems Pharmacology Database and Analysis Platform) website. It allows you to search for a specific drug and retrieve its related ingredients, targets, and diseases. Additionally, you can download "all" data of drugs, ingredients, targets, and diseases. The tool can be easily configured to query and download a list of drugs, eliminating the need to manually pass token
parameters.
git clone https://github.com/shujuecn/TCMSP-Spider.git
cd TCMSP-Spider
pip3 install -r requirements.txt
herb_list.txt
. You can add multiple drugs, and the names can be written in Chinese, Pinyin or Latin, for example:麻黄
Baizhu
Citrus Reticulata
python3 src/search_save_herbs.py
The program will automatically obtain the token
value and query all the drugs specified in herb_list.txt
. Because a single Chinese or Pinyin name may correspond to multiple drugs, the program will download the ingredients, targets, and diseases of each drug, and save them in an Excel (.xlsx) file in the data/spider_data
folder.
麻黄 -> 麻黄、麻黄根
fuzi -> Baifuzi、Difuzi、Fuzi、Laifuzi
On the TCMSP Browse Database page, the website provides four types of data, including "all" drugs, ingredients, targets, and diseases. You can use the following command to download these data and save them in an Excel (.xlsx) file in the data/sample_data
folder.
python3 src/get_all_data.py
Using the data downloaded with "Get all data," you can use the program to query the relationships between drugs, ingredients, targets, and diseases. For example:
Target ID: TAR00006
Related diseases: Chronic inflammatory diseases...
Related ingredients: cyanidol...
Related herbs: Asteris Radix Et Rhizoma...
While it is not currently available in the current version of the program, in the future, it may be possible to use the data downloaded using "Get all data" to query for relationships between different elements, such as finding all the ingredients related to a certain disease or target. This feature is not yet implemented in the current version, but may be added in a future update.
This project is released under the MIT open source license. If you have any suggestions or feedback, please feel free to submit an issue or pull request.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。