R/TPMInfo.R

#' @include GRFClass.R

#' @export TPMInfo
setGeneric(name = "TPMInfo",
  def = function(info.obj){
    standardGeneric("TPMInfo")
  }
)

#' @rdname TPMInfo-methods
setMethod(f = "TPMInfo",
  signature = c("info"),
  definition = function(info.obj) {
    # genes with TPM >= 1 at any stage during reprogramming
    col_nm <- copy(colnames(info.obj@gene)[grep("^tpm_(MEF|ESC)", colnames(info.obj@gene))])
    idx <- info.obj@gene[, apply(.SD, 1, function(vec)any(vec>1)), .SDcols = col_nm]
    stopifnot(all(!idx) == FALSE)
    # update info.obj
    message(sum(!idx), " genes that did not reach TPM > 1 at any stage of reprogramming were filtered.")
    info.obj@gene <- copy(info.obj@gene[idx])
    validObject(info.obj)
    return(info.obj = info.obj)
  }
)
ericaenjoy3/GRFLoop documentation built on May 12, 2019, 1:35 a.m.