Duy Dinh - 2013-05-02

!/bin/bash

-----------------------------------

R script to display correlation between mapping change and attribute change in ontologies

@author: Duy Dinh, University of Toulouse

@date: 17 April 2013

-----------------------------------

directory containing results files

each file has 6 columns: NoCT SUP SUB SIB ALL

path <- "/home/duy/Desktop/ISWC-2013/results/TSV"

Output directory

outputpath="/home/duy/Desktop/ISWC-2013/images"
outputImage=TRUE

outputImage=FALSE

output image file name

outputImg = paste(outputpath, "correlationACMC1", sep="/")
outputImg = paste(outputImg, "eps", sep=".")

start graphics drawing

if (outputImage == TRUE){
postscript(file=outputImg, horizontal=FALSE, height=4, width=15)
#png(filename=outputImg)
}

files <- list.files(path, full.names=TRUE)
names <- list.files(path)

lineColors <- c("green", "cyan", "orange", "darkgray", "darkblue")
plotChars <- c(18, 2, 5, 19, 19)
plotChars1 <- c(21, 18, 23)
lineStyles <- c(1, 2, 3, 4, 5)

number of files

n <- length(files)
cexValue=.5
cexValueLegend=.73

distribute plots on the grid

par(mfrow=c(n/2,n/2), mar=c(2.85,3.6,2,1), cex.axis = 1, cex.lab = 1, mgp = c(2, 1, 0))

par(mfrow=c(1,2), mar=c(4,4,2,2))

tickLabs=c(1, 5, 10, 15, 20, 25, 30)
xTickCount=5
yTickCount=5

top A size

minN=0
maxN=100

number of adapted mappings

minM=0
maxM=35

colors <- c("black", "blue", "green")

read data from the first file

data <- read.table(files[1], header=TRUE, nrows=maxN)
plot(data$N, data$Character_based_ED, type="o", pch=plotChars1[1], col=colors[1], xlab=NA, ylab="#Correlation", #xlab="#TopA",
ylim=c(0, maxM), main="1) Similarity measures (without CT)", cex=cexValue, lty=lineStyles[1])
lines(data$N, data$Knowledge_based_Similarity, type="o", pch=plotChars1[2], col=colors[2], cex=cexValue, lty=lineStyles[2])
lines(data$N, data$Word_based_ED, type="o", pch=plotChars1[3], col=colors[3], cex=cexValue, lty=lineStyles[3])

add legend

legend(5, 13, gsub("_", " ", names(data[2:length(data)])), cex=.9, col=colors, pch=plotChars1, lty=lines, horiz=FALSE, bty="n");

read data from files

for (i in 2: n){
#if (i == 2)
{
data1 <- read.table(files[i], header=TRUE, nrows=maxN)
plot(data1$N, data1$NOCT, type="o", pch=plotChars[1], col=lineColors[1], ylim=c(0, maxM), xlab=NA, ylab=NA, #xlab="#TopA", ylab="#Correlation",
main=paste(paste(i, ") ", sep=""), gsub("based", "-based ", names[i]), "(with CT)", sep=" "), cex=cexValue, lty=lineStyles[1])
lines(data1$N, data1$SUP, type="o", pch=plotChars[2], col=lineColors[2], cex=cexValue, lty=lineStyles[2])
lines(data1$N, data1$SUB, type="o", pch=plotChars[3], col=lineColors[3], cex=cexValue, lty=lineStyles[3])
lines(data1$N, data1$SIB, type="o", pch=plotChars[4], col=lineColors[4], cex=cexValue, lty=lineStyles[4])
lines(data1$N, data1$ALL, type="o", pch=plotChars[5], col=lineColors[5], cex=cexValue, lty=lineStyles[5])

# add legend
legend(0, maxM+2, names(data1[2:length(data1)]), cex=.6, col=lineColors, pch=plotChars, lty=lineStyles, horiz=TRUE, bty="n");
if  (i > 2){
 title(xlab="#TopA", ylab="#Correlation") 
}

}
}

turn off graphical device

if (outputImage){
dev.off()
}