GenomicBoxPlot.pl
From Organic Design wiki
#!/usr/bin/perl -w
use strict;
open(R, "|R --slave --vanilla") || die("A horrible death not opening R");
print R q(
namesx <- scan(what="")
row.name leaf leaf leafblade leafblade leaftip leaftip leafmidrib leafmidrib leafpetiole leafpetiole leafstip leafstip skin skin skin skin phloem xylem xylem bark bark root root flower flower early.fruit early.fruit early.fruit early.fruit early.fruit early.fruit midfruit midfruit midfruit midfruit ripefruit ripefruit ripefruit ripefruit early.fruit early.fruit early.fruit early.fruit early.fruit early.fruit midfruit midfruit midfruit midfruit ripefruit ripefruit ripefruit ripefruit bud bud bud bud bud bud
""
x <- scan(what="")
10017 0.64341027176457 0.829329073318191 0.362411417925247 0.766835581759949 0.786759826372035 0.606647671577055 0.711988395910225 1.29842449819515 0.538688821596687 0.592240867047912 0.504472607769847 0.603540066717039 0.791048712607732 0.980250587891535 0.803408942746179 0.925087016399338 0.795967842387701 0.673951334957717 2.09043424440674 0.672208329460112 0.596795453323307 0.997626567511741 0.482697346298433 0.715827962070734 0.497536670220194 0.902596530866395 0.53618714233502 0.679952509683944 1.06171768116192 0.907155193369489 0.835770496592281 0.940730196277371 0.75681553314726 NA 0.909572485461949 0.818789529935885 0.426241623666381 0.861496002253244 0.795132562849779 1.12878956127929 1.62674574247937 1.10411153478918 1.71686462655066 1.34058650384034 0.609589261229755 1.09534088252461 NA 1.02376533187486 1.07205341606875 0.734307629650687 0.847617489014977 0.34326986321062 0.524803073137244 0.807975220979305 0.870008795517868 1.0145818651229 0.811682500237641 1.45605950298705 0.931468106168375
""
x <- as.numeric(x)
names(x) <- namesx
dset <- data.frame(tissue = factor(namesx)[-1], response = x[-1])
# EST number currently unused
estNum <- x[1]
genomicBoxPlot <- function(dir, filename, data=dset, size=600, pointsize=12, col="#FFFFFF", main="") {
# Create png
png(file.path(dir, filename), height=size, width=size, pointsize=pointsize)
# Boxplot
tissueType <- unique(dset$tissue)
boxplot(response ~ tissue, data=dset, ylab="Expression", main=main, xaxt="n", color=col)
text(x=seq(length(tissueType)), y=par("usr")[3]-0.05, labels=tissueType, srt = 90, adj = 1, xpd = TRUE)
dev.off()
invisible()
}
genomicBoxPlot("/tmp", "foo.png", data=dset, size=600, col="#ACACAC")
);
close(R);