This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Need suggestions for ROC Curve in R

Please suggest how to plot ROC curve in R from below data, I have CSV file, Example enter image description here

Data in column 2 from ClinVar, 1 is used for pathogenic and 0 is used for benign variants after that implemented three tools, so 1 and 0 is for tool predictions.

Now I want to make a plot as shown in figure enter image description here

anyone have id, is my data format correct ?

Implemented through library(pROC), but still not succeeded

curve roc python r

These should be pretty straightforward using the R library ggplot2. R Graph Gallery website is pretty good at giving templates and examples of most plot types with base R and ggplot2.

If you want to calculate and visualize ROC Curves Across Multi-Class Classifications, you can use multiROC.

1 answer

Don't know about R, but for Python your data format would be correct. Two columns are needed for AUC calculation at a time (c vs tool1).

https://scikit-learn.org/stable/auto_examples/model_selection/plot_roc.html

Assuming your table is saved in roc.csv, here is a simple script:

import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import RocCurveDisplay

df = pd.read_csv('roc.csv')

fig, ax = plt.subplots(figsize=(6, 6))
RocCurveDisplay.from_predictions(df['c'].values,df['tool1'].values,name='Tool1',pos_label=1,ax=ax,color='aqua')
RocCurveDisplay.from_predictions(df['c'].values,df['tool2'].values,name='Tool2',pos_label=1,ax=ax,color='darkorange')
RocCurveDisplay.from_predictions(df['c'].values,df['tool3'].values,name='Tool3',pos_label=1,ax=ax,color='cornflowerblue')
_ = ax.set(
    xlabel='False Positive Rate',
    ylabel='True Positive Rate',
    title='AUC for various tools',
)
plt.savefig('multiple_auc_plots.png',dpi=150)
plt.show()

AUC plots

Log in to answer this question.