@@ -237,3 +237,34 @@ colnames(summary.mat) <- c("lnL", "max lnL", "tract length",
237
237
"Pr(S_0)", "Pr(S_1)",
238
238
"df", "d^2f", "c.i. tract length", "c.i tract length")
239
239
summary.mat
240
+ source('~/.active-rstudio-document', echo=TRUE)
241
+ # plot one paralog
242
+ paralog = "EDN_ECP"
243
+ lnL.ratio <- as.vector(read.table(paste("./summary/", paralog, "_MG94_nonclock_HMM_log_posterior_ratio.txt", sep = "")))
244
+ Viterbi.path <- as.vector(read.table(paste("./summary/", paralog, "_MG94_nonclock_HMM_Viterbi_path.txt", sep = "")))
245
+ lnL.surface <- as.vector(read.table(paste("./summary/", paralog, "_MG94_nonclock_HMM_lnL_surface.txt", sep = "")))
246
+ IGC.sw.lnL <- as.vector(read.table(paste("./summary/", paralog, "_MG94_nonclock_sw_lnL.txt", sep = "")))
247
+ Force.sw.lnL <- as.vector(read.table(paste("./summary/Force_", paralog, "_MG94_nonclock_sw_lnL.txt", sep = "")))
248
+ plot(lnL.ratio[, 1], xlab = "codon number", ylab = "log values",
249
+ type = "l", col = "black", lty = 1,
250
+ main = paste(paralog, " HMM result"),
251
+ ylim = c(min(-0.5, min(lnL.ratio)), max(lnL.ratio)))
252
+ lines(1:dim(Viterbi.path)[1], Viterbi.path[, 1], type = "S", lty = 2, col = "red")
253
+ #lines(1:dim(IGC.sw.lnL)[1], IGC.sw.lnL[, 2] - Force.sw.lnL[, 2], type = "l", lty = 3, col = "red")
254
+ legend(1, max(lnL.ratio), legend = c("log posterior ratio", "Viterbi path"),
255
+ lty = c(1, 2), col = c( "black", "red"))
256
+ plot(-lnL.surface[, 1], xlab = "tract length in nucleotide", ylab= "lnL", type = "l", col = "black", lty = 1,
257
+ main = paste(paralog, " lnL surface"))
258
+ summary.mat <- read.table("./HMM_tract_MG94_nonclock_summary.txt")
259
+ # Now calculate standard deviation of lnP
260
+ lnP <- log(3.0 / summary.mat[, 3])
261
+ sd.lnP <- 1.0 / sqrt(-summary.mat[, 7])
262
+ low.cf <- exp(lnP - 1.96 * sd.lnP)
263
+ up.cf <- exp(lnP + 1.96 * sd.lnP)
264
+ up.cf[up.cf > 1] <- 1.0
265
+ summary.mat <- cbind(summary.mat, 3.0 / up.cf, 3.0 / low.cf)
266
+ rownames(summary.mat) <- c("EDN_ECP")
267
+ colnames(summary.mat) <- c("lnL", "max lnL", "tract length",
268
+ "Pr(S_0)", "Pr(S_1)",
269
+ "df", "d^2f", "c.i. tract length", "c.i tract length")
270
+ summary.mat
0 commit comments