Need suggestions for ROC Curve in R
1
0
Entering edit mode
10 months ago
shabbas12 ▴ 10

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 • 782 views
ADD COMMENT
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
10 months ago
Mensur Dlakic ★ 28k

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

ADD COMMENT

Login before adding your answer.

Traffic: 2234 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6