R/print.estConverge.R

#' print.estConverge
#'
#' \code{print.estConverge} is a print method for the S3 class.
#'
#' It suppresses \code{estimate} to show all results.
#' Only the final estimates and the number of iterations would be shown.
#' Iteration history can be accessed by explicitly calling:
#'   e.g.: \code{estimate()$v_history}
#' @export
#'
print.estConverge <- function(res){
  epty <- rep(' ',3)
  m <- round(res$m_hat, digits = 2)
  uI <- paste('uI', 1:3, sep='')
  uE <- paste('uE', 1:3, sep='')
  uT <- paste('uT', 1:3, sep='')
  uIv <- m[2:4]; uEv <- m[5:7]; uTv <- m[8:10]
  uORF <- cbind(uI, uIv,epty, uE, uEv,epty, uT, uTv)
  cat("Mean parameters of translated uORF:\n")
  write.table(format(uORF, justify="right"),
              row.names=F, col.names=F, quote=F)
  cat("\n")
  I <- paste('I', 1:3, sep='')
  E <- paste('E', 1:3, sep='')
  Ter <- paste('T', 1:3, sep='')
  Iv <- m[12:14]; Ev <- m[15:17]; Tv <- m[18:20]
  main <- cbind(I, Iv,epty, E, Ev,epty, Ter, Tv)
  cat("Mean parameters of main coding region:\n")
  write.table(format(main, justify="right"),
              row.names=F, col.names=F, quote=F)
  cat("\n")
  un <- cbind("5'U", m[1], " ", "5'U2", m[11], " ", "3'U", m[21])
  cat("Mean parameters of untranslated region:\n")
  write.table(format(un, justify="right"),
              row.names=F, col.names=F, quote=F)
  cat("\n")
  hiter <- res$iter
  names(hiter) <- 'Number of iterations: '
  print(hiter)
}
shimlab/riboHMM2 documentation built on May 19, 2019, 6:23 p.m.