I am following http://www.hindawi.com/journals/bmri/2014/589290/ article for chi square test for gene selection. According to this article all the gene expression of each sample will either be greater or lesser than their respective mean i.e all the gene expression of sample1 will be either lesser than their respective mean or greater than their respective mean. But when i am comparing gene expressions of any sample with their mean of gene, i am getting some are lesser and some are greater. I don't understand i am doing something wrong or my data is wrong. I am using gds4515 dataset of bioconductor.
row of eset contain genes and column of eset contain samples.
The following code for first 20 genes of first sample
tempFunc <- function(eset) { #eset is my expression set
exprsEset <- exprs(eset)
meanGene=c()
for(i in 1:20)
{
meanGene[i]=mean(exprsEset[i,])
}
for(i in 1:20)
{
cat("meanGene = ",meanGene[i])
cat("exprsEset = ",exprsEset[i,1])
if(exprsEset[i,1]>meanGene[i])
print("greater")
else if(exprsEset[i,1]<meanGene[i])
print("lesser")
else
print("equal")
}
}
And here is the output
-
meanGene = 3.301822 exprsEset = 3.363718[1] "greater"
-
meanGene = 2.61106 exprsEset = 2.755734[1] "greater"
-
meanGene = 2.614429 exprsEset = 2.52532[1] "lesser"
-
meanGene = 3.016704 exprsEset = 2.947369[1] "lesser"
-
meanGene = 1.930851 exprsEset = 1.868928[1] "lesser"
-
meanGene = 2.980301 exprsEset = 3.017314[1] "greater"
-
meanGene = 2.50876 exprsEset = 2.445917[1] "lesser"
-
meanGene = 2.260986 exprsEset = 2.292166[1] "greater"
-
meanGene = 2.561356 exprsEset = 2.517724[1] "lesser"
-
meanGene = 1.924788 exprsEset = 1.825676[1] "lesser"
-
meanGene = 2.843669 exprsEset = 3.019766[1] "greater"
-
meanGene = 3.016528 exprsEset = 3.032245[1] "greater"
-
meanGene = 2.659819 exprsEset = 2.589222[1] "lesser"
-
meanGene = 3.297349 exprsEset = 3.287197[1] "lesser"
-
meanGene = 3.037114 exprsEset = 2.964646[1] "lesser"
-
meanGene = 2.881649 exprsEset = 2.941078[1] "greater"
-
meanGene = 2.403006 exprsEset = 2.41512[1] "greater"
-
meanGene = 2.469731 exprsEset = 2.425784[1] "lesser"
-
meanGene = 3.128546 exprsEset = 3.076901[1] "lesser"
-
meanGene = 2.620181 exprsEset = 2.627992[1] "greater"
But all of them should be either greater or lesser, not combination of both.
|
Thank You @Aaron Lun for your reply. I will try to contact him.