AllLifestages.R

From Organic Design wiki
Revision as of 04:31, 28 March 2006 by Sven (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

dataDir <- "/Volumes/HD2/Clinton/Data/" lifecourse <- read.table(file.path(dataDir, "lifecourseallgenes.txt"), sep="\t", header=T, as.is=T)

matplot(seq(lifecourse[,"Timepoint"]), lifecourse[,6:12], type="l")

lifecourse

dset1 <- lifecourse[lifecourse$Lifestage=="Larvae",] dset1 <- data.frame(Time = dset1$Time, Genes = rep(names(dset1)[6:12], each=6), RE = unlist(dset1[,6:12])) dset1$Time <- factor(dset1$Time, levels=levels(dset1$Time)[c(6,1:5)]) xyplot(RE ~ Time, data=dset1, groups=dset1$Genes, type="l", ylim=c(0,0.6))

dset2 <- lifecourse[lifecourse$Lifestage=="Pupae",] dset2 <- data.frame(Time = dset2$Time, Genes = rep(names(dset2)[6:12], each=10), Sex=c("Female","Male"), RE = unlist(dset2[,6:12])) dset2$Time <- factor(dset2$Time, levels=levels(dset2$Time)[c(2:6,1)]) xyplot(RE ~ Time|Sex, data=dset2, groups=dset2$Genes, type="l", ylim=c(0,0.6))

dset3 <- lifecourse[lifecourse$Lifestage=="Adult",] dset3 <- data.frame(Time = dset3$Time, Genes = rep(names(dset3)[6:12], each=16),

                   Sex=dset3$Sex, Bodypart=dset3$Body.Part, RE = unlist(dset3[,6:12]))

mykey <- simpleKey(text=levels(dset3$Genes), points=F, lines=T, space="top", columns=4) xyplot(RE ~ Time|Sex*Bodypart, data=dset3, groups=dset3$Genes, type="l", ylim=c(0,1), key=mykey) X11() ORdset <- dset3[dset3$Genes=="OR1" | dset3$Genes=="OR2" | dset3$Genes=="OR3",] ORdset$Genes <- factor(as.character(ORdset$Genes)) mykey <- simpleKey(text=levels(ORdset$Genes), points=F, lines=T, space="top", columns=3) xyplot(RE ~ Time|Sex*Bodypart, data=ORdset, groups=ORdset$Genes, type="l", ylim=c(0,1), key=mykey) X11() PBPdset <- dset3[dset3$Genes=="PBP1" | dset3$Genes=="PBP2" | dset3$Genes=="PBP3",] PBPdset$Genes <- factor(as.character(PBPdset$Genes)) mykey <- simpleKey(text=levels(PBPdset$Genes), points=F, lines=T, space="top", columns=3) xyplot(RE ~ Time|Sex*Bodypart, data=PBPdset, groups=PBPdset$Genes, type="l", ylim=c(0,1), key=mykey)