View difference between Paste ID: pwvNr0CM and ysc2XB5R
SHOW: | | - or go back to the newest paste.
1
2
# !!! warning messages can be ignored
3
4
d <- read.csv("sil_time.csv",sep=";",dec=".",header=FALSE)
5
dm <- d[,1]
6
cc <- d[1:24,2]
7
8
dm.shapiro <- shapiro.test(dm)
9
cc.shapiro <- shapiro.test(cc)
10
11
# visual normality test
12
# qqnorm(dm)
13
# qqnorm(cc)
14
15
dm.conf <- t.test(dm)$conf.int
16
cc.conf <- t.test(cc)$conf.int
17
18
# p-value = 0.3811 
19
# there is greater than 5 % chance that 
20
# population medians are the same
21
cc.dm.wilcox <- wilcox.test(cc,dm,alternative="two.sided",paired=FALSE)
22
23
# box plots with 95 % confidence intervals of means
24
cairo_pdf(filename="cc_dm_boxplot.pdf",onefile=TRUE,width=8,height=8,pointsize=12)
25
boxplot(cbind(dm,cc),names=c("Diabetes mellitus type 2","Colorectal carcinoma"),main="Drug target distances")
26
points(c(dm.conf[1],dm.conf[2],cc.conf[1],cc.conf[2])~c(1,1,2,2),col="red",pch="-",cex=5)
27
dev.off()
28
29
# ####
30
31
f <- read.csv("silt.csv",sep=";",dec=".",header=TRUE)
32
33
g <- f[,2]
34
35
a <- length(g)/(max(g)-min(g))
36
i <- min(g)
37
j <- max(g)
38
e <- 10
39
hh <- 0
40
t <- 1
41
c <- 0
42
43
while(TRUE){
44
	c <- c+1
45
	j <- j-e
46
	h <- densty(i,j,g)
47-
}
47+
48
	if(h<hh & t==1){
49
		j <- j+e
50
		e <- e*2
51
		h <- hh
52
		t <- 2
53
	}
54
	if(h>hh & t>1){
55
		e <- 10
56
		t <- 1
57
		hh <- h
58
	}
59
	if(h<hh & t>1){
60
		j <- j+e
61
		if(t==2){
62
			e <- e/4
63
		}else{
64
			e <- round(e/2)
65
		}
66
		if(e==1){
67
			print(paste("i = ",i,sep=""))
68
			print(paste("j = ",j,sep=""))
69
			print(paste("c = ",c,sep=""))
70
			print(paste("h = ",hh,sep=""))
71
			print(paste("a = ",a,sep=""))
72
			high <- list(i,j,h)
73
			break
74
		}
75
		h <- hh
76
		t <- 3
77
	}
78
	if(h>hh & t==1){
79
		hh <- h
80
	}
81
}
82
83
# searching for lower limit
84
85
a <- length(g)/(max(g)-min(g))
86
i <- min(g)
87
j <- max(g)
88
e <- 10
89
hh <- 0
90
t <- 1
91
c <- 0
92
93
while(TRUE){
94
	c <- c+1
95
	i <- i+e
96
	h <- densty(i,j,g)
97
	print(paste("iteration: interval [",i,";",j,"] average: ",h,sep=""))
98
	if(h<hh & t==1){
99
		i <- i-e
100
		e <- e*2
101
		h <- hh
102
		t <- 2
103
	}
104
	if(h>hh & t>1){
105
		e <- 10
106
		t <- 1
107
		hh <- h
108
	}
109
	if(h<hh & t>1){
110
		i <- i-e
111
		if(t==2){
112
			e <- e/4
113
		}else{
114
			e <- round(e/2)
115
		}
116
		if(e==1){
117
			print(paste("i = ",i,sep=""))
118
			print(paste("j = ",j,sep=""))
119
			print(paste("c = ",c,sep=""))
120
			print(paste("h = ",hh,sep=""))
121
			print(paste("a = ",a,sep=""))
122
			low <- list(i,j,h)
123
			break
124
		}
125
		h <- hh
126
		t <- 3
127
	}
128
	if(h>hh & t==1){
129
		hh <- h
130
	}
131
}
132
133
densty <- function(i,j,d){
134
	a <- length(d)/(max(d)-min(d))
135
	ij <- subset(d,d>i & d<j)
136
	aa <- length(ij)/(max(ij)-min(ij))
137
	return(aa)
138
}
139
140
cairo_pdf(filename="silt_hist.pdf",onefile=TRUE,width=12,height=8,pointsize=12)
141
hist(g,breaks=50,xlab="Silencing time",main="Frequency of drug targets\nas a function of silencing time")
142
abline(v=31,col="red",lwd=2)
143
abline(v=87,col="red",lwd=2)
144
dev.off()