-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinsertion_time.R
More file actions
26 lines (22 loc) · 780 Bytes
/
insertion_time.R
File metadata and controls
26 lines (22 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# https://github.com/wangziwei08/LTR-insertion-time-estimation
library(ape)
#library(xlsx)
setwd('z.Copia/') ###The path should be changed
list <- list.files()
fas.F1 = read.FASTA(list[1])
mat1 = dist.dna(fas.F1,as.matrix = T, model = "K80")
merge.data = mat1[1,2]
#mutate_rate <- 1.3e-8 #according to rice mutation rate described in Ma, 2004
mutate_rate <- 1e-8
time1 = merge.data/(2*mutate_rate)
v1.merge = c(list[1],merge.data, time1)
dir = paste("./",list,sep="")
n = length(dir)
for (i in 2:n){
fas.F.new = read.FASTA(list[i])
mat.new = dist.dna(fas.F.new, as.matrix = T, model = "K80")
time = mat.new[1,2]/(2*mutate_rate)
v.new = c(list[i], mat.new[1,2], time)
v1.merge = rbind(v1.merge, v.new)
}
write.csv(v1.merge,file = '../LTR_Copia_Insert_time.csv')