ich möchte mit Hilfe eines einfachen T-Test und FDR Kontrolle Differentiell exprimierte Gene zwischen sensitiv und nicht sensitive Zellen finden.
Um mir die Expressiondaten zu erzeugen:
Code: Alles auswählen
library(affy)
library(qvalue)
cell.lines<-read.csv("sensitivity.csv",row.names=1,header=TRUE,sep=",")
pheno<-as.data.frame(cell.lines[,2],row.names=row.names(cell.lines))
names(pheno)<-c("sensitivity")
pheno<-new("AnnotatedDataFrame", data = pheno)
wangData<-ReadAffy(phenoData=pheno)
wangExpr<-rma(wangData)
sampleNames(wangExpr)
featureNames(wangExpr)
description(wangExpr)
annotation(wangData)
pData(phenoData(wangData))
dim(exprs(wangExpr))
head(exprs(wangExpr))
x<-exprs(wangExpr)
1. cell.lines:
Code: Alles auswählen
cellline drugsens
GSM243480 PC3 s
GSM243481 DU145 s
GSM243482 LNCaP s
GSM243483 22Rv r
2. x:
Code: Alles auswählen
GSM243480.CEL GSM243481.CEL GSM243482.CEL GSM243483.CEL
1007_s_at 8.947219 9.126816 9.061964 9.571040
1053_at 8.892565 8.663903 8.610118 10.069438
117_at 4.657418 4.589023 4.437430 4.574685
121_at 7.232597 7.349899 7.597990 8.310655
1255_g_at 3.335694 3.359144 3.351804 3.201163
Überlegt habe ich mir, dass ich mir ja mal so eine Funktion schreiben kann, die mir den Test berechnet:
Code: Alles auswählen
A wrapper function to perform a t-test for all genes
my.t.test <- function(x, group, alternative = "two.sided"){
x1 <- t(x[group[,1]])
x2 <- t(x[group[,2]])
tres <- t.test(x = x1, y = x2, alternative = alternative)
fc <- mean(x1) - mean(x2)
stat <- tres$statistic
if(alternative == "two.sided"){
stat <- abs(stat)
}
res<-matrix(c(stat, tres$p.value, fc), ncol=3)
colnames(res)<-c("statistic","p.value","fc")
return(res)
}
#test sensitiv versus non sensitiv genes
sVr<-cbind(cell.lines$drugsens=="s",cell.lines$drugsens=="r")
colnames(sVr)<-c("sensitiv", "rezesiv")
SensitivVersusRezesiv <- apply(X=x, MARGIN=2, FUN=my.t.test, group=sVr)
SensitivVersusRezesiv <- as.data.frame(t(SensitivVersusRezesiv))
colnames(SensitivVersusRezesiv)<-c("statistic","p.value","fc")
SensitivVersusRezesiv <- cbind(t(x[0,]),SensitivVersusRezesiv)
Vielen Dank schon mal für eure Hilfe!