Gene filtering from gene expression data in R
/*
* http://sosal.tistory.com/
* made by so_Sal
*/
Gene expression data로부터 데이터를 읽어와
r, d value에 따라 사용하고자 하는 DNA를 선별
data <- read.table("gene_expression.csv", header=F, sep=",") #데이터 불러오기
#csv 확장자는 ,으로 데이터 단위 분리
mmfilt <- function(r = 5, d = 0.5, na.rm = TRUE) {
#na.rm = TRUE는 NA (null) 데이터일 경우 true로 리턴
function(x) {
minval <- min(x, na.rm = na.rm)
maxval <- max(x, na.rm = na.rm)
(maxval/minval > r) && (maxval - minval > d)
}
}
#Filtering: r = 5, d = 0.5로 설정
library(genefilter) #genefilter: Filtering 함수 라이브러리 불러오기
mmfun <- mmfilt()
ffun <- filterfun(mmfun)
sub<- genefilter(data[,2:83], ffun)
yeast <- data[sub, ]
#data[,2:83]
# 아래는 filtering 이후 TRUE data counting.
yes = T
count = 0
uncount = 0
for ( i in 1:6178 ){
if(sub[i] == yes){
count = count+1;
}
else
uncount = uncount+1;
}
count