Entering edit mode
6.5 years ago
a511512345
▴
190
Same data for the same code, why do I get different numbers of DEGs. Hello everyone, I encountered a problem when using the samr package to find differential expressed genes. The same data for the same code, why do I get a different number of DEGs? For example, I got 108 DEGs in one analysis, but I got 368 DEGs when I repeated the following code. My code is as follows:
x=read.csv("expr.csv",sep = ',',row.names = 1,header = T)
#View(head(x))
Pheno<-read.csv('target.csv',sep = ',',header = T,row.names = 1)
R<-rownames(pheno)
x=x[,R]
y=pheno$group
Data=list(x=as.matrix(x),y=y,geneid=rownames(x),genenames=as.character(rownames(x)),logged2=TRUE)
Samr.obj<-samr(data,resp.type="Two class unpaired", nperms=1000)
Delta.table <- samr.compute.delta.table(samr.obj, min.foldchange=1.2,nvals=100)
Siggenes.table <- samr.compute.siggenes.table(samr.obj, del=0, data, delta.table,all.genes=TRUE)
a <- siggenes.table$genes.up; # all up regulated genes
b <- siggenes.table$genes.lo; # all down regulated genes
c <- rbind(a,b)
#View(head(c))
Lo <- c[as.numeric(c[,8])<20,]#FDR<20%
For (i in 1:nrow(lo))
{
Tp <- as.numeric(as.vector(as.matrix(lo[i,1])))-1;
Lo[i,3] <- as.character(as.vector(as.matrix(x[tp,1])));
}
Write.csv(lo,"DEGs.csv")
set a seed and try
thanks for your answer,i will try
You are probably experiencing non-deterministic outputs. I am kind of surprised with the wide variation though. As suggested by @cpad0112 you can try setting a seed.
thanks for reply! So,can i run untill i get ideal numbers of DEGs?
There is no
ideal number
of DEG's. Since you need to validate the hypotheses you are generating (list of DE genes) by independent means, you probably don't want hundreds anyway.BTW: Please use
ADD REPLY/ADD COMMENT
when responding to existing posts to keep the thread logically organized.I appreciate your help very much, thanks a lot!