# ----- Define a function for plotting a matrix ----- #
# source("http://www.phaget4.org/R/myImagePlot.R")
# Nice plot of data frame or matrix
myImagePlot <- function(x, ...){
min <- min(x)
max <- max(x)
yLabels <- rownames(x)
xLabels <- colnames(x)
title <-c()
# check for additional function arguments
if( length(list(...)) ){
Lst <- list(...)
if( !is.null(Lst$zlim) ){
min <- Lst$zlim[1]
max <- Lst$zlim[2]
}
if( !is.null(Lst$yLabels) ){
yLabels <- c(Lst$yLabels)
}
if( !is.null(Lst$xLabels) ){
xLabels <- c(Lst$xLabels)
}
if( !is.null(Lst$title) ){
title <- Lst$title
}
}
# check for null values
if( is.null(xLabels) ){
xLabels <- c(1:ncol(x))
}
if( is.null(yLabels) ){
yLabels <- c(1:nrow(x))
}
layout(matrix(data=c(1,2), nrow=1, ncol=2), widths=c(4,1), heights=c(1,1))
# Red and green range from 0 to 1 while Blue ranges from 1 to 0
ColorRamp <- rgb( seq(0,1,length=256), # Red
seq(0,1,length=256), # Green
seq(1,0,length=256)) # Blue
ColorLevels <- seq(min, max, length=length(ColorRamp))
# Reverse Y axis
reverse <- nrow(x) : 1
yLabels <- yLabels[reverse]
x <- x[reverse,]
# Data Map
par(mar = c(3,5,2.5,2))
image(1:length(xLabels), 1:length(yLabels), t(x), col=ColorRamp, xlab="",
ylab="", axes=FALSE, zlim=c(min,max))
if( !is.null(title) ){
title(main=title)
}
axis(BELOW<-1, at=1:length(xLabels), labels=xLabels, cex.axis=0.7)
axis(LEFT <-2, at=1:length(yLabels), labels=yLabels, las= HORIZONTAL<-1,
cex.axis=0.7)
# Color Scale
par(mar = c(3,2.5,2.5,2))
image(1, ColorLevels,
matrix(data=ColorLevels, ncol=length(ColorLevels),nrow=1),
col=ColorRamp,
xlab="",ylab="",
xaxt="n")
layout(1)
}
# ----- END plot function ----- #
Tuesday, March 31, 2009
Plotting matrix
Sunday, March 29, 2009
Faster way to get a maximum for each row
do.call(pmax,data.frame(Matrix))
This is faster than apply(Matrix,1,max)
This is faster than apply(Matrix,1,max)
Friday, March 27, 2009
Group Folder
I found this description on Ubuntu forum http://ubuntuforums.org/showthread.php?t=576907
Re: Inheriting permissions
If you are sharing files with few people. You should create a group for that folder. http://www.cyberciti.biz/faq/howto-linux-add-user-to-group/ Let's say the folder contains open office docs. Create a group called, /data1/washuDataReformatted and put all the users who need to write to that group. The users might be Jane, Bob, and John. Set folder to 770 on /data1 folder.
groupadd analysts
useradd -g analysts bhoom
If you already have stuff in that folder,
chmod -R 770 /data1
-R is recursive
After that set your setgid by typing
chmod g+s /data1
It will inherited the group permission now on.
Hope it works?!
Wednesday, March 18, 2009
At a glance : Mapping complex disease traits with global gene expression : Nature Reviews Genetics
At a glance : Mapping complex disease traits with global gene expression : Nature Reviews Genetics: "Nature Reviews Genetics 10, 184-194 (March 2009) | doi:10.1038/nrg2537
Mapping complex disease traits with global gene expression
William Cookson1, Liming Liang2, Gonçalo Abecasis2, Miriam Moffatt1 & Mark Lathrop3 About the authors"
Mapping complex disease traits with global gene expression
William Cookson1, Liming Liang2, Gonçalo Abecasis2, Miriam Moffatt1 & Mark Lathrop3 About the authors"
Friday, March 06, 2009
NEJM -- Serotonin Rising -- The Bone, Brain, Bowel Connection
NEJM -- Serotonin Rising -- The Bone, Brain, Bowel Connection: "Most circulating serotonin arises from synthesis in the duodenum by specialized neuroendocrine enterochromaffin cells. The life cycle of serotonin begins with meal-induced mucosal stimulation of the gut,"
Umm... it is all connected. Eating, eating and eating...
Umm... it is all connected. Eating, eating and eating...
Sunday, March 01, 2009
New Ph.D.s to Teach Harvard Undergrads -- Gaidos 323 (5915): 697 -- Science - Sent using Google Toolbar
"Saw this news on Science. This might be an interesting option for a preclinical department, or at least for my department, which always have a complain that we do not have enough staff to teach. We do not have enough time to do research either, as most of our research time is invaded by the time we have to spend teaching. One of my senior colleague said teaching should be our primary responsibility. Although I like teaching, I prefer research over teaching. In addition, we are supposed to do research as we should be one of the leading research university. Or else, I probably should look for jobs at other places that allow us to do both teaching and hand-on work. However, I guess that we do not have this option available yet in Thailand or at least at my work place. Hiring temporary teaching staff might help to solve the workload we have to teach medical students, and might allow more time to do research."
See the news below.
New Ph.D.s to Teach Harvard Undergrads -- Gaidos 323 (5915): 697 -- Science
HIGHER EDUCATION:
Susan Gaidos*
Harvard University plans to hire up to 20 recent Ph.D.s to teach undergraduate courses in a move that officials say will improve instruction and help students facing a tough job market.
The new College Fellows Program was announced last week in an e-mail to faculty and will go into effect this fall. Fellows will be paid $48,000 with full benefits to work in some 20 academic departments throughout the Faculty of Arts and Sciences. The program is open to all recent--since 2005--Ph.D. graduates. The awards are for 1 year, with a second year possible, and the money will come from the university's instructional budget.
"A large part of the goal was to support graduates and mentor excellent teaching among recent Ph.D.s, and [another] was to meet essential teaching needs in Harvard College," says Allan Brandt, dean of Harvard's Graduate School of Arts and Sciences. "We wanted to develop strong teaching for our Harvard College students and to make sure our teaching needs were met."
Each fellow will be assigned a faculty mentor, and teaching-focused seminars are planned. The program, Brandt says, "is designed for people who have a deep interest in university teaching." Fellows will be expected to carry 70% of the teaching load of a faculty member, leaving them some time to pursue their research. "At this career stage," says Brandt, "it's very important that they have some protected time to continue their research endeavors."
James Hanken, Alexander Agassiz professor of zoology, says the program offers new Ph.D. recipients "a sort of a temporary hold" in a tough job market. "If it's a teaching postdoc that doesn't consume all of your waking hours and leaves you time to do some research, I think it can be a good deal," he says.
See the news below.
New Ph.D.s to Teach Harvard Undergrads -- Gaidos 323 (5915): 697 -- Science
HIGHER EDUCATION:
New Ph.D.s to Teach Harvard Undergrads
Susan Gaidos*
Harvard University plans to hire up to 20 recent Ph.D.s to teach undergraduate courses in a move that officials say will improve instruction and help students facing a tough job market.
The new College Fellows Program was announced last week in an e-mail to faculty and will go into effect this fall. Fellows will be paid $48,000 with full benefits to work in some 20 academic departments throughout the Faculty of Arts and Sciences. The program is open to all recent--since 2005--Ph.D. graduates. The awards are for 1 year, with a second year possible, and the money will come from the university's instructional budget.
"A large part of the goal was to support graduates and mentor excellent teaching among recent Ph.D.s, and [another] was to meet essential teaching needs in Harvard College," says Allan Brandt, dean of Harvard's Graduate School of Arts and Sciences. "We wanted to develop strong teaching for our Harvard College students and to make sure our teaching needs were met."
Each fellow will be assigned a faculty mentor, and teaching-focused seminars are planned. The program, Brandt says, "is designed for people who have a deep interest in university teaching." Fellows will be expected to carry 70% of the teaching load of a faculty member, leaving them some time to pursue their research. "At this career stage," says Brandt, "it's very important that they have some protected time to continue their research endeavors."
James Hanken, Alexander Agassiz professor of zoology, says the program offers new Ph.D. recipients "a sort of a temporary hold" in a tough job market. "If it's a teaching postdoc that doesn't consume all of your waking hours and leaves you time to do some research, I think it can be a good deal," he says.
Subscribe to:
Comments (Atom)
