#' detTSR
#' @description An internal function, which is invoked using the user-level
#' function determineTSR that identifies TSRs from the selected tssSet 
#' (Internal function)
#' @param experimentName - a S4 object of class tssObject containing
#' information in slot tssTagData
#' @param tssSetType - specifies the set to be clustered. Options are
#' "replicates" or "merged"
#' @param tssSet - number of the dataset to be analyzed
#' @param tagCountThreshold - number of TSSs required at a given position
#' @param clustDist - maximum distance of TSSs between two TSRs (in base pairs)
#  @keywords internal
#' @return via the user-level function determineTSR, creates a list of
#' GenomicRanges objects containing TSR positions in slot 'tsrData' on
#' the tssObject object
#' @export
#' @rdname detTSR-methods

    function(experimentName, tssSetType, tssSet=1, tagCountThreshold,

#' @rdname detTSR-methods

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

          function(experimentName, tssSetType, tssSet,
                   tagCountThreshold=1, clustDist) {

              message("... detTSR ...")
              if (tssSetType=="replicates") {
                  if (tssSet>length(experimentName@tssCountData)) {
                      stop("The value selected for tssSet exceeds ",
                           "the number of slots in tssCountData.")
                  tss.df <- experimentName@tssCountData[[tssSet]]
              } else if (tssSetType=="merged") {
                  if (length(experimentName@tssCountDataMerged)<1) {
                      stop("The @tssCountDataMerged slot is currently empty.",
                           "\nPlease complete the merger before continuing.")
                  if (tssSet>length(experimentName@tssCountDataMerged)) {
                      stop("The value selected for tssSet exceeds the number ",
                           "of slots in tssCountDataMerged.")
                  tss.df <- experimentName@tssCountDataMerged[[tssSet]]
              } else {
                  stop("Error: argument tssSetType to detTSR() should be ",
                       "either \"replicates\" or \"merged\".")

              tsr.DF <- tsrCluster(tss.df, minNbrTAGs=tagCountThreshold,

              message(" Done.\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.