# read MAP values from a csv file (header in the first line)
table = read.table(files[i], header=TRUE)# Build run names
runNames =c("pllsgen4a2","uwmtDg04tn","pllsgen4a1","PDTNsmp4","Spe-MH-OM+PRF")
run <-factor(rep(runNames, each=length(table$SpeMHOM)))# number of queries# MAP per run data frame
mpre <-data.frame(run, map=c(table$pllsgen4a2,table$uwmtDg04tn,table$pllsgen4a1,table$PDTNsmp4,table$SpeMHOM))# graphical parameters
lineColors =c("red","blue","cyan","black","chartreuse")
pChars=c(20:24)
lineTypes=c(10:length(mpre$run))# plot a group of kernel density curves
sm.density.compare(mpre$map,# vector of data
mpre$run,# vector of group labels
xlab=xAxisLabel, ylab=yAxisLabel,
xlim=xAxisRange, ylim=yAxisRange,
col=lineColors, pch=pChars, lty=lineTypes,
title=names[i])# Add a legend for which line types, colors represent appropriately the corresponding runs#legend("topright", levels(mpre$run), lty=lineTypes, col=lineColors, pch=pChars)
legend("topright",levels(mpre$run), lty=lineTypes, col=lineColors)
}
}
if (outputImage){
dev.off()
}
Last edit: Duy Dinh 2013-04-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
!/bin/bash
-----------------------------------
R script to display kernel distribution of groups of MAP values obtained by different runs
@author: Duy Dinh
@date: 22 March 2012
-----------------------------------
library(sm)
result directory
path = "/home/duy/collection/TRECGenomics-2004/participants"
get file names from directory
fileFilter="*.txt"
full names
files = list.files(path, full.names=TRUE, pattern=fileFilter)
short names
names = list.files(path, pattern=fileFilter)
outputImage=TRUE
outputImage=FALSE
output image
outputImg = paste(path, "output", sep="/")
outputImg = paste(outputImg, "png", sep=".")
start graphics drawing
if (outputImage == TRUE){
#postscript(file=outputImg, horizontal=FALSE, width=15, height=8)
png(filename=outputImg)
}
xAxisLabel = "MAP"
yAxisLabel = "Densité"
xAxisRange = c(0.0, 1.0)
yAxisRange = c(0.0, 3.0)
n=length(files)
if (n > 0){
# distribute plots
par(mfrow=c(1,n))
for (i in 1 : n){
}
}
if (outputImage){
dev.off()
}
Last edit: Duy Dinh 2013-04-23
QueryID pllsgen4a2 uwmtDg04tn pllsgen4a1 PDTNsmp4 SpeMHOM
1 0.4 0.3 0.5 0.2 0.6
2 0.2 0.4 0.34 0.32 0.55
3 0.5 0.46 0.54 0.42 0.75
4 0.25 0.60 0.43 0.22 0.35
5 0.45 0.30 0.42 0.22 0.15