The legacy CAGEset class

options(signif = 3, digits = 3)
knitr::opts_chunk$set(tidy = FALSE, cache = TRUE, autodep = TRUE, fig.height = 5.5,
                      message = FALSE, error = FALSE, warning = TRUE)
set.seed(0xdada)

This document reproduces the commands used in older versions of the CAGEr vignette that were based on the legacy CAGEset class. Its purpose is to check that the results of the computations are identical with the old documentation and with the current documentation based on the new CAGEexp class.

library(CAGEr)
library(BSgenome.Drerio.UCSC.danRer7)
inputDir <- system.file("extdata", package = "CAGEr")
pathsToInputFiles <- list.files(inputDir, pattern = "ctss", full.names = TRUE)
basename(pathsToInputFiles)
myCAGEset <- new("CAGEset", genomeName = "BSgenome.Drerio.UCSC.danRer7",
  inputFiles = pathsToInputFiles, inputFilesType = "ctss",
  sampleLabels = c("zf_30p_dome", "zf_high", 
  "zf_prim6_rep1", "zf_prim6_rep2", "zf_unfertilized_egg"))
myCAGEset
TSS.df <- read.table(system.file("extdata/Zf.unfertilized.egg.chr17.ctss", 
  package = "CAGEr"))
colnames(TSS.df) <- c("chr", "pos", "strand", "zf_unfertilized_egg")
TSS.df$chr <- as.character(TSS.df$chr)
TSS.df$pos <- as.integer(TSS.df$pos)
TSS.df$strand <- as.character(TSS.df$strand)
TSS.df$zf_unfertilized_egg <- as.integer(TSS.df$zf_unfertilized_egg)
head(TSS.df)
myCAGEset.coerced <- as(TSS.df, "CAGEset")
myCAGEset.coerced
getCTSS(myCAGEset)
ctss <- CTSStagCount(myCAGEset)
head(ctss)
sampleLabels(myCAGEset)
corr.m <- plotCorrelation(myCAGEset, samples = "all", method = "pearson")
mergeSamples(myCAGEset, mergeIndex = c(3,2,4,4,1), 
  mergedSampleLabels = c("zf_unfertilized_egg", 
  "zf_high", "zf_30p_dome", "zf_prim6"))
librarySizes(myCAGEset)
plotReverseCumulatives(myCAGEset, fitInRange = c(5, 1000), onePlot = TRUE)
normalizeTagCount(myCAGEset, method = "powerLaw", 
  fitInRange = c(5, 1000), alpha = 1.2, T = 5*10^4)
exportCTSStoBedGraph(myCAGEset, values = "normalized", 
  format = "bedGraph", oneFile = TRUE)
exportCTSStoBedGraph(myCAGEset, values = "normalized", format = "BigWig")
clusterCTSS(object = myCAGEset, threshold = 1, thresholdIsTpm = TRUE, 
  nrPassThreshold = 1, method = "distclu", maxDist = 20, 
  removeSingletons = TRUE, keepSingletonsAbove = 5)
tc <- tagClusters(myCAGEset, sample = "zf_unfertilized_egg")
head(tc)
cumulativeCTSSdistribution(myCAGEset, clusters = "tagClusters")
quantilePositions(myCAGEset, clusters = "tagClusters", qLow = 0.1, qUp = 0.9)
tc <- tagClusters(myCAGEset, sample = "zf_unfertilized_egg",
  returnInterquantileWidth = TRUE,  qLow = 0.1, qUp = 0.9)
head(tc)
exportToBed(object = myCAGEset, what = "tagClusters", 
  qLow = 0.1, qUp = 0.9, oneFile = TRUE)
plotInterquantileWidth(myCAGEset, clusters = "tagClusters", 
  tpmThreshold = 3, qLow = 0.1, qUp = 0.9)
aggregateTagClusters(myCAGEset, tpmThreshold = 5, 
  qLow = 0.1, qUp = 0.9, maxDist = 100)
consensusCl <- consensusClusters(myCAGEset)
head(consensusCl)
cumulativeCTSSdistribution(myCAGEset, clusters = "consensusClusters",
  useMulticore = TRUE)
quantilePositions(myCAGEset, clusters = "consensusClusters", qLow = 0.1,
  qUp = 0.9, useMulticore = TRUE)
consensusCl <- consensusClusters(myCAGEset, sample = "zf_unfertilized_egg",
  returnInterquantileWidth = TRUE,  qLow = 0.1, qUp = 0.9)
head(consensusCl)
getExpressionProfiles(myCAGEset, what = "consensusClusters", tpmThreshold = 10, 
  nrPassThreshold = 1, method = "som", xDim = 4, yDim = 2)
plotExpressionProfiles(myCAGEset, what = "consensusClusters")
class3_1 <- extractExpressionClass(myCAGEset, 
  what = "consensusClusters", which = "3_1")
head(class3_1)
exportToBed(myCAGEset, what = "consensusClusters", 
  colorByExpressionProfile = TRUE)
cumulativeCTSSdistribution(myCAGEset, clusters = "consensusClusters")
scoreShift(myCAGEset, groupX = "zf_unfertilized_egg", groupY = "zf_prim6",
  testKS = TRUE, useTpmKS = FALSE)
shifting.promoters <- getShiftingPromoters(myCAGEset, 
  tpmThreshold = 5, scoreThreshold = 0.6,
  fdrThreshold = 0.01)
head(shifting.promoters)
sessionInfo()


Try the CAGEr package in your browser

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

CAGEr documentation built on Jan. 17, 2021, 2 a.m.