2017-11-30 11 views
1
library(ROCR);  
lig <- unique(read.table("ligands.txt")[,1]); 
dec <- unique(read.table("decoys.txt")[,1]); 
uniqRes <- read.table("file1.txt",header=T); 
colnames(uniqRes)[1]="LigandName"; 
uniqRes$IsActive <- as.numeric(uniqRes$LigandName %in% lig) 
predTOTALuq <- prediction(uniqRes$TOTAL*-1, uniqRes$IsActive) 
perfTOTALuq <- performance(predTOTALuq, 'tpr','fpr') 
jpeg("hivpr_Rinter_ROC.jpg") 
plot(perfTOTALuq,main="hivpr - ROC Curves",col="blue") 
abline(0,1,col="grey") 
dev.off() 

ここでは、1つのファイルからデータを取得して1つの曲線をプロットするためのコードです。 iは3 あなたが直接ablineまたはcurveを追加することができますので、同じグラフの複数の曲線をプロットするR

答えて

0

私がやって助けてください三つの異なるファイル、すなわちファイル1、ファイル2、ファイルからデータを取ることによって同じプロットで3つの曲線をプロットしたいです。

df1 <- data.frame(x = 1:10, y = 1:10) 
df2 <- data.frame(x = 1:13, y = 2:14) 
df3 <- data.frame(x = 6:10, y = 2:6) 
lx <- range(c(df1$x, df2$x, df3$x)) 
ly <- range(c(df1$y, df2$y, df3$y)) 

plot(df1, main = "hivpr - ROC Curves", xlim = lx, ylim = ly, col = "blue") 
abline(0, 1, col = "blue") 
points(df2, col = 'red3') 
points(df3, col = 'yellow') 

enter image description here

+0

ligands.txtとdecoys.txtある最初の2つのファイルは同じ まま、実際に私は uniqRes <すなわち三つのファイル ために、このコマンドを変更したい - read.tableを( "FILE1.TXT "、ヘッダー= T)。uniqRes < - read.table( "file2.txt"、header = T);uniqRes < - read.table( "file3.txt"、header = T); – rtulip

+0

ポイントとラインをプロットするだけですか? – myincas

+0

ROCカーブの行だけ – rtulip

関連する問題