Machine Learning Assisted Intraoperative Assessment of Brain Tumor Margins Using HRMAS NMR Spectroscopy
Doruk Cakmakci, Emin Onur Karakaslar, Elisa Ruhland, Marie-Pierre Chenard, Francois Proust, Martial Piotto, Izzie Jacques Namer and A. Ercument Cicek
PLoS Computational Biology 2020, in press
Create Dataset: This script is used to create the experiment setup presented in the paper. Samples are grouped according to their patient ids. Patients are randomly shuffled. Folds are generated by stratified and grouped k-fold cross validation approach. Finally, spectrum data is preprocessed as discussed in the paper.
SHAP Value Plotting: This script contains function used for generating SHAP Value Plots given in Figure 3 in the paper.
Random Forest, CNN , Fully-connected NN, SVM , PLSDA
Random Forest, CNN, Fully-connected NN, SVM, PLSDA
- Download the dataset from here. Extract the compressed folder and move dataset folder to /data folder as a subdirectory.
- Download and save Supplementary Table 1 to /data folder. Rename the file to supplement.xls
- Install dependencies. If an Ubuntu machine with GPU is used, dependencies may be installed by creating a conda environment using ubuntu_environment.yml file and installing shap and xlrd dependencies using conda.
- Clone PyNMR library to /lib
- Generate dataset using create_dataset.py by uncommenting corresponding dataset option (Lines 222-225)
- Execute any model script (For random forest, SHAP plots will be saved to the same directory)
In order to reproduce the results reported in the preprint the dataset and folds must be downloaded from here. After extracting the compressed folder, fold_data/ must be moved to /reproduce/ as a subdirectory. Below you may find the instructions for reproducing Figure 2 and Figure 3 from the preprint.
- Instructions for Figure 2:
- Panel A:
- Execute cnn.py, nn.py, rf.py, plsda.py and svm.py scripts located under /reproduce/figure_2/control_tumor/seed_2453, /reproduce/figure_2/control_tumor/seed_1117 and /reproduce/figure_2/control_tumor/seed_423 (In total of 15 scripts should be executed).
- Execute plot_boxplot.py located at /reproduce/figure_2/control_tumor/. The plot will be saved to the same directory.
- Panel B:
- Execute cnn.py, nn.py, rf.py, plsda.py and svm.py scripts located under /reproduce/figure_2/benign_aggressive/seed_228, /reproduce/figure_2/benign_aggressive/seed_1849 and /reproduce/figure_2/benign_aggressive/seed_2251 (In total of 15 scripts should be executed).
- Execute plot_boxplot.py located at /reproduce/figure_2/benign_aggressive/. The plot will be saved to the same directory.
- Panel A:
- Instructions for Figure 3:
- Panel A:
- Execute rf.py script located at /reproduce/figure_3/control_tumor/seed_1648.
- The plot will be saved to /reproduce/figure_3/control_tumor/seed_1648/plots.
- Panel B:
- Execute rf.py script located at /reproduce/figure_3/benign_aggressive/seed_1648.
- The plot will be saved to /reproduce/figure_3/benign_aggressive/seed_1648/plots.
- Panel A: