Ana səhifə

# "#" indicates a comment that is not executed


Yüklə 41.5 Kb.
tarix25.06.2016
ölçüsü41.5 Kb.
# "#" indicates a comment that is not executed
# R functions are surrounded by round brackets (). You can find the definition of any

# function by ?functionname - e.g. ?read.Galfile


# load the marray library
library(marrayNorm)
# read the gal file
galinfo=read.Galfile("7Kv2a.gal")
# get the names of the gpr files (or spot files) in the directory
fnames=dir(pattern=paste("*","gpr",sep="*"))
# to see the names, just type
fnames
# obtain the name of the column used to flag bad spots (default is NULL)
flags="Flags"
# read gpr files into a rawData set (name.Gf is the excel column name of the

# green foreground, etc, "W" indicates the Flags column)

rawData= read.GenePix(fnames, name.Gf = "F532 Median",

name.Gb ="B532 Median", name.Rf = "F635 Median", name.Rb = "B635 Median",

name.W ="Flags", layout =galinfo$layout, gnames = galinfo$gnames)

#plot red and green foreground and background, and the flag locations.

# "M" is Rf-Gf

# [,i] indicates the i-th column of a matrix


par(ask=T)
for (i in 1:length(fnames)){

par(mfrow=c(2,3))

maImage(rawData[,i],x="maGb",bar=F)
maImage(rawData[,i],x="maRb",bar=F)
maImage(rawData[,i],x="maM",bar=F)
maImage(rawData[,i],x="maGf",bar=F)
maImage(rawData[,i],x="maRf",bar=F)

maImage(rawData[,i],x="maW", bar=F)


}
# or get a larger view (with a scale) one plot at a time.
maImage(rawData[,1],x="maGb")

maImage(rawData[,1],x="maW")


# Fix mistake in GAL file - I edited the gal file in Word and then reread all the data
galinfo=read.Galfile("7Kv2aR1.gal")
# create a list of gpr files (or spot file)
fnames=dir(pattern=paste("*","gpr",sep="*"))
# obtain the name of the column used to flag bad spots (default is NULL)
flags="Flags"
# read gpr files into a rawData set

rawData= read.GenePix(fnames, name.Gf = "F532 Median",

name.Gb ="B532 Median", name.Rf = "F635 Median", name.Rb = "B635 Median",

name.W ="Flags", layout =galinfo$layout, gnames = galinfo$gnames)


#plot array


par(ask=T)
for (i in 1:length(fnames)){

par(mfrow=c(2,3))

maImage(rawData[,i],x="maGb",bar=F)
maImage(rawData[,i],x="maRb",bar=F)
maImage(rawData[,i],x="maM",bar=F)
maImage(rawData[,i],x="maGf",bar=F)
maImage(rawData[,i],x="maRf",bar=F)

maImage(rawData[,i],x="maW", bar=F)


}
# understand the array layout
maImage(rawData[,1],x="maPrintTip")
# top 10% differential expression
top1 = maTop(maM(rawData[,1]),h=0.1,l=0.1)

maImage(rawData[,1],x="maM",subset=top1)


par(mfrow=c(2,2))

for (i in 1:3) maImage(rawData[,1],x="maM", maTop(maM(rawData[,i]),h=0.1,l=0.1),bar=F)

maRf(rawData)[maW(rawData)<0] <- NA

maGf(rawData)[maW(rawData)<0] <- NA

maRb(rawData)[maW(rawData)<0] <- NA

maGb(rawData)[maW(rawData)<0] <- NA


# Normalize - ?maNorm will tell you the options
NormData=maNorm(rawData)
# Boxplots of Diff Exp

# by print-tip on array 1


maBoxplot(rawData[,1],y="maM",x="maPrintTip") maBoxplot(NormData[,1],y="maM",x="maPrintTip")
# by array
maBoxplot(rawData,y="maM")

maBoxplot(NormData,y="maM")


# MvA plots (difference in log expression vs mean log expression) for array 1
maPlot(rawData[,1],x="maA",y="maM")

maPlot(NormData[,1],x="maA",y="maM")


#heatmap (multivariate analysis library)
library(mva)
RmG=maM(NormData)
goodSpot=!is.na(apply(RmG,1,mean))
GoodSpots=RmG[goodSpot,]

heatmap(GoodSpots[1:100,],

col=maPalette(low="green",high="red",mid="black",k=50))

heatmap(GoodSpots[1:100,],

col=maPalette(low="blue",high="red",mid="white",k=50))

heatmap(GoodSpots[1:100,],



col=maPalette(low="blue",high="red",mid="white",k=50))


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©atelim.com 2016
rəhbərliyinə müraciət