2007-09-26

The main dish is coming? Q1.1 ~ 4... XD

Q1.1) fold change:
easy thought, easy Done! Sorting data by AVE(schz)/AVE(ctrl) and then pick up the first 200 genes. But how?


>aa<-array(round(rnorm(24),2),dim=c(6,4))  # randomly generate number based on normal dist
>aa
[,1] [,2] [,3] [,4]
[1,] -0.53 -1.26 0.87 1.92
[2,] 1.00 0.26 -0.40 -0.67
[3,] 1.39 -0.16 -0.11 -0.06
[4,] -0.51 0.35 0.28 0.07
[5,] -1.59 1.80 0.52 -0.63
[6,] 0.03 -0.60 0.61 -0.17
>order(aa[ ,2]) # sort by column 2
>order(aa[3, ]) # sort by row 5
>order(aa[3, ], decreasing=TRUE) # this one is the default
>order(aa[3, ], decreasing=FALSE)
>aa[order(aa[3,]),]
>aa[order(aa[3,])[1:2],3:5] #aa[order(aa[3,])[row],col]
As you can see the order() returning the order of row or column as a vector, and that's why it's a beautiful thing for us when selecting genes by kinda order.

No comments: