文献名称:Cai et al., FP-GNN: a versatile deep learning architecture for enhanced molecular property prediction, Brief Bioinform, 2022
代码地址:GitHub - idrugLab/FP-GNN
复现过程:
- 文献和代码资料准备:在Pubmed和Github 上下载即可
- 环境准备:用XSHELL连接服务器,用XFTP传输文件,并且服务器联网
- 在服务器中创建虚拟环境:(1)使用conda 命令行(2)使用Pycharm
- 主要使用第一种方法,第二种不详细叙述,创建环境命令 conda create -n evn_name python=version ;evn_name是环境的名称,version是python版本,均可自己定义。
-
conda create -n FP-GNN_3.7 python=3.7
- 激活环境:
此时已经进入了虚拟环境中conda activate FP-GNN_3.7
- 配置环境变量:根据代码文件中的环境变量,一般是在后缀名.md的文件中,选择合适的版本进行安装,可以用 conda install 也可以用pip install 的方式
- 运行代码 :python代码的运行方式是python file_name.py 这个你的环境跟文件必须是在同一个目录下,所以一般在运行时需要python文件在xftp中的完整路径,还要注意服务器的系统是linux的话斜杠的方向是,python /.../.../file_name.py 如果有参数还要加上参数:
- 运行train.py 文件命令行:
python train.py --data_path C:/Users/yk3/Desktop/freesolv/freesolv.csv --dataset_type regression --save_path C:/Users/yk3/Desktop/freesolv --log_path C:/Users/yk3/Desktop/freesolv/log/freesolv
后面步骤就不一一演示,过程相似。
The most important python packages are:
- python == 3.6.7
- pytorch == 1.2.0
- torch == 0.4.1
- tensorboard == 1.13.1
- rdkit == 2019.09.3
- scikit-learn == 0.22.2.post1
- hyperopt == 0.2.5
- numpy == 1.18.2
For using our model more conveniently, we provide the environment file *<environment.txt>* to install environment directly.
---
# **Command**
### **1. Train**
Use train.py
Args:
- data_path : The path of input CSV file. *E.g. input.csv*
- dataset_type : The type of dataset. *E.g. classification or regression*
- save_path : The path to save output model. *E.g. model_save*
- log_path : The path to record and save the result of training. *E.g. log*
E.g.
`python train.py --data_path data/test.csv --dataset_type classification --save_path model_save --log_path log`
### **2. Predict**
Use predict.py
Args:
- predict_path : The path of input CSV file to predict. *E.g. input.csv*
- result_path : The path of output CSV file. *E.g. output.csv*
- model_path : The path of trained model. *E.g. model_save/model.pt*
E.g.
`python predict.py --predict_path data/test.csv --model_path model_save/test.pt --result_path result.csv`
### **3. Hyperparameters Optimization**
Use hyper_opti.py
Args:
- data_path : The path of input CSV file. *E.g. input.csv*
- dataset_type : The type of dataset. *E.g. classification or regression*
- save_path : The path to save output model. *E.g. model_save*
- log_path : The path to record and save the result of hyperparameters optimization. *E.g. log*
E.g.
`python hyper_opti.py --data_path data/test.csv --dataset_type classification --save_path model_save --log_path log`
### **4. Interpretation of Fingerprints**
Use interpretation_fp.py
Args:
- predict_path : The path of input CSV file. *E.g. input.csv*
- model_path : The path of trained model. *E.g. model_save/model.pt*
- result_path : The path of result. *E.g. result.txt*
E.g.
`python interpretation_fp.py --predict_path test.csv --model_path model_save/test.pt --result_path result.txt`
### **5. Interpretation of Graph**
Use interpretation_graph.py
Args:
- predict_path : The path of input CSV file. *E.g. input.csv*
- model_path : The path of trained model. *E.g. model_save/model.pt*
- figure_path : The path to save figures of graph interpretation. *E.g. figure*
E.g.
`python interpretation_graph.py --predict_path test.csv --model_path model_save/test.pt --figure_path figure`