#' @title \emph{prcTSS()}
#' @description An internal function, invoked via processTSS, that creates an
#' expression matrix for all TSSs within a given TSS experiment (in slot
#' tssTagData)
#' @param experimentName - a S4 object of class tssObject containing
#' information in slot tssTagData
#' @param n.cores the number of cores to be used for this job.
#' @param tssSet - number of the dataset to be analyzed
#' @param writeTable - if set to TRUE, writes a data frame containing
#' the TSSs positions and their abundance to your workspace
#' @keywords internal
#' @return \emph{prcTSS} fills the slot experimentName@tssCountData[[tssSet]]
#' in the tssObject \emph{experimentName} with a matrix of unique TSS positions
#' (rows) and observed tag counts in each position for data set tssSet;
#' precisely, each entry of the matrix consists of "seq" (chr), "TSS" (num),
#' "nTAGs" (num), and "strand" (+ or -), corresponding to the sequence
#' identifier, position, tag count, and strand,
#' respectively.

    function(experimentName, n.cores, tssSet, writeTable)

          signature(experimentName="tssObject", "numeric", "numeric",

          function(experimentName, n.cores, tssSet, writeTable) {
              object.name <- deparse(substitute(experimentName))

              if (tssSet>length(experimentName@replicateIDs)) {
                  stop("The value selected exceeds the toal number of samples.")

              outfname <- paste("TSSset-", tssSet, sep="")
              outfname <- paste(outfname, "txt", sep=".")

              tss.df <- tagCountTSS(experimentName@tssTagData[[tssSet]],
                                    n.cores, outfname, writeTable)

              message("\n... the TSS expression matrix for dataset ", tssSet,
                  " has been successfully\nadded to the tssObject.\n")

Try the TSRchitect package in your browser

Any scripts or data that you put into this service are public.

TSRchitect documentation built on Nov. 8, 2020, 8:11 p.m.