Holmes commited on
Commit
b9da337
·
1 Parent(s): dcda47f

version 2

Browse files
Files changed (1) hide show
  1. README.md +19 -36
README.md CHANGED
@@ -1,5 +1,7 @@
1
  # P2DFlow
2
 
 
 
3
  P2DFlow is a protein ensemble generative model with SE(3) flow matching based on ESMFold, the ensembles generated by P2DFlow could aid in understanding protein functions across various scenarios.
4
 
5
  Technical details and evaluation results are provided in our paper:
@@ -37,43 +39,27 @@ python ./dataset/download.py
37
  ```
38
  We will use `.pdb` and `.xtc` files for the following calculation.
39
 
40
- #### 2. Calculate the 'approximate energy and select representative structures
41
- (i) Use `gaussian_kde` to calculate the 'approximate energy' (You need to put all files above in `./dataset`, include `ATLAS_filename.txt` for filenames of all proteins):
42
  ```
43
- python ./dataset/traj_analyse.py
44
  ```
45
- And you will get `traj_info.csv`.
46
 
47
- (ii) Select representative structures at equal intervals based on the 'approximate energy':
48
- ```
49
- python ./dataset/md_select.py
50
- ```
51
 
52
  #### 3. Process selected dataset
53
 
54
- (i) Download the selected dataset (or get it from the two steps above) from [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing) whose filename is `selected_dataset.tar`, and decompress it using:
55
  ```
56
- tar -xvf select_dataset.tar
57
  ```
58
- (ii) Preprocess `.pdb` files to get `.pkl` files:
59
- ```
60
- python ./data/process_pdb_files.py --pdb_dir ${pdb_dir} --write_dir ${write_dir}
61
- ```
62
- And you will get `metadata.csv`.
63
 
64
- then compute node representation and pair representation using ESM-2 (`csv_path` is the path of `metadata.csv`):
65
- ```
66
- python ./data/cal_repr.py --csv_path ${csv_path}
67
  ```
68
- then compute predicted static structure using ESMFold (`csv_path` is the path of `metadata.csv`):
69
  ```
70
- python ./data/cal_static_structure.py --csv_path ${csv_path}
71
- ```
72
- (iii) Provide the necessary `.csv` files for training
73
-
74
- If you are using the data we have preprocessed, download the `.csv` files from [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing) whose filenames are `train_dataset.csv` and `train_dataset_energy.csv`(they correspond to `csv_path` and `energy_csv_path` in `./configs/base.yaml` during training).
75
-
76
- Or if you are using your own data, you can get `metadata.csv` from step 3 (correspond to `csv_path` in `./configs/base.yaml` during training, and you need to split a subset from it as the train dataset), and get `traj_info.csv` from step 2 (correspond to `energy_csv_path`).
77
 
78
 
79
 
@@ -82,7 +68,7 @@ Download the pretrained checkpoint from [Google Drive](https://drive.google.com/
82
 
83
 
84
  ## Training
85
- To train P2DFlow, firstly make sure you have prepared the dataset according to `Prepare Dataset`, and put it in the right folder, then modify `./configs/base.yaml` (especially for `csv_path` and `energy_csv_path`). After this, you can run:
86
  ```
87
  python experiments/train_se3_flows.py
88
  ```
@@ -90,7 +76,7 @@ And you will get the checkpoints in `./ckpt`.
90
 
91
 
92
  ## Inference
93
- To infer for specified protein sequence, firstly modify `./inference/valid_seq.csv` and `./configs/inference.yaml` (especially for `validset_path`), then run:
94
  ```
95
  python experiments/inference_se3_flows.py
96
  ```
@@ -98,18 +84,15 @@ And you will get the results in `./inference_outputs/weights/`.
98
 
99
 
100
  ## Evaluation
101
- To evaluate metrics related to fidelity and dynamics, specify paths in `./analysis/eval_test.py`, then run:
102
- ```
103
- python ./analysis/eval_test.py
104
- ```
105
- To evaluate PCA, specify paths in `./analysis/pca_analyse.py`, then run:
106
  ```
107
- python ./analysis/pca_analyse.py
108
  ```
109
- To draw the ramachandran plots, specify paths in `./analysis/Ramachandran_plot.py`, then run:
110
  ```
111
- python ./analysis/Ramachandran_plot.py
112
  ```
 
113
 
114
  ## License
115
  This project is licensed under the terms of the GPL-3.0 license.
 
1
  # P2DFlow
2
 
3
+ > ## ℹ️ The version 2 code of P2DFlow has been released!
4
+
5
  P2DFlow is a protein ensemble generative model with SE(3) flow matching based on ESMFold, the ensembles generated by P2DFlow could aid in understanding protein functions across various scenarios.
6
 
7
  Technical details and evaluation results are provided in our paper:
 
39
  ```
40
  We will use `.pdb` and `.xtc` files for the following calculation.
41
 
42
+ #### 2. Calculate the 'approximate energy' and select representative structures
43
+ (i) Use `gaussian_kde` to calculate the 'approximate energy' (You need to put all files above in `./dataset`, just like `ATLAS_init_example` in [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing)):
44
  ```
45
+ python ./dataset/traj_analyse_select.py
46
  ```
47
+ And you will get selected representative structures in `select` dir and `traj_info_select.csv` for 'approximate energy'.
48
 
 
 
 
 
49
 
50
  #### 3. Process selected dataset
51
 
52
+ (i) Download the selected dataset (or get it from the two steps above) from [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing) whose filename is `selected_dataset_v1.tar` or `selected_dataset_v2.tar` ('v1' selects ~10 structures from MD, 'v2' selects ~100 structures from MD), and decompress it using:
53
  ```
54
+ tar -xzvf select_dataset_v1.tar
55
  ```
 
 
 
 
 
56
 
57
+ (ii) Preprocess `.pdb` files to get `.pkl` files, compute node representation and pair representation using ESM-2, predict static structure using ESMFold, and get merged `.csv` file:
 
 
58
  ```
59
+ python ./data/process_pdb_files.py --pdb_dir ${pdb_dir} --write_dir ${write_dir} --traj_info_file ${traj_info_file} --valid_seq_file ${valid_seq_file} --merged_output_file ${merged_output_file}
60
  ```
61
+ And you will get `.pkl` files (large file size) and `metadata_merged.csv`. (if you are using your own data, you need to split dataset to get validation set as ${valid_seq_file} first, an example is `./inference/valid_seq.csv`).
62
+ Processed data will be similar to `ATLAS_processed_example.tar.gz` in [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing)
 
 
 
 
 
63
 
64
 
65
 
 
68
 
69
 
70
  ## Training
71
+ To train P2DFlow, firstly make sure you have prepared the dataset according to `Prepare Dataset`, and put it in the right folder, then modify `./configs/base.yaml` (especially for `csv_path`). After this, you can run:
72
  ```
73
  python experiments/train_se3_flows.py
74
  ```
 
76
 
77
 
78
  ## Inference
79
+ To infer for specified protein sequence, firstly modify `./configs/inference.yaml` (especially for `ckpt_path` and `validset_path`), then run:
80
  ```
81
  python experiments/inference_se3_flows.py
82
  ```
 
84
 
85
 
86
  ## Evaluation
87
+ To evaluate metrics related to validity, fidelity and dynamics, run:
 
 
 
 
88
  ```
89
+ python ./analysis/eval_result.py --pred_org_dir ${pred_org_dir} --valid_csv_file ${valid_csv_file} --pred_merge_dir ${pred_merge_dir} --target_dir ${target_dir} --crystal_dir ${crystal_dir}
90
  ```
91
+ To evaluate PCA, run:
92
  ```
93
+ python ./analysis/pca_analyse.py --pred_pdb_dir ${pred_pdb_dir} --target_dir ${target_dir} --crystal_dir ${crystal_dir}
94
  ```
95
+ Evaluation results will be similar to `evaluation_example` in [Google Drive](https://drive.google.com/drive/folders/11mdVfMi2rpVn7nNG2mQAGA5sNXCKePZj?usp=sharing)
96
 
97
  ## License
98
  This project is licensed under the terms of the GPL-3.0 license.