### R code from vignette source 'CAGEr.Rnw' ################################################### ### code chunk number 1: setup ################################################### options(width = 60) olocale=Sys.setlocale(locale="C") ################################################### ### code chunk number 2: CAGEr.Rnw:138-139 ################################################### library(CAGEr) ################################################### ### code chunk number 3: CAGEr.Rnw:145-146 ################################################### library(BSgenome.Drerio.UCSC.danRer7) ################################################### ### code chunk number 4: CAGEr.Rnw:167-170 ################################################### inputDir <- system.file("extdata", package = "CAGEr") pathsToInputFiles <- list.files(inputDir, full.names = TRUE) basename(pathsToInputFiles) ################################################### ### code chunk number 5: CAGEr.Rnw:178-182 ################################################### 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")) ################################################### ### code chunk number 6: CAGEr.Rnw:186-187 ################################################### myCAGEset ################################################### ### code chunk number 7: CAGEr.Rnw:208-218 ################################################### TSS.df <- read.table(system.file("extdata/Zf.unfertilized.egg.chr17.ctss", package = "CAGEr")) # make sure the column names are as required colnames(TSS.df) <- c("chr", "pos", "strand", "zf_unfertilized_egg") # make sure the column classes are as required 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) ################################################### ### code chunk number 8: CAGEr.Rnw:222-224 ################################################### myCAGEset.coerced <- as(TSS.df, "CAGEset") myCAGEset.coerced ################################################### ### code chunk number 9: CAGEr.Rnw:229-230 ################################################### getCTSS(myCAGEset) ################################################### ### code chunk number 10: CAGEr.Rnw:235-237 ################################################### ctss <- CTSStagCount(myCAGEset) head(ctss) ################################################### ### code chunk number 11: CAGEr.Rnw:241-242 ################################################### sampleLabels(myCAGEset) ################################################### ### code chunk number 12: CAGEr.Rnw:253-254 (eval = FALSE) ################################################### ## corr.m <- plotCorrelation(myCAGEset, samples = "all", method = "pearson") ################################################### ### code chunk number 13: CAGEr.Rnw:273-276 ################################################### mergeSamples(myCAGEset, mergeIndex = c(3,2,4,4,1), mergedSampleLabels = c("zf_unfertilized_egg", "zf_high", "zf_30p_dome", "zf_prim6")) ################################################### ### code chunk number 14: CAGEr.Rnw:288-289 ################################################### librarySizes(myCAGEset) ################################################### ### code chunk number 15: CAGEr.Rnw:301-302 (eval = FALSE) ################################################### ## plotReverseCumulatives(myCAGEset, fitInRange = c(5, 1000), onePlot = TRUE) ################################################### ### code chunk number 16: CAGEr.Rnw:320-322 ################################################### normalizeTagCount(myCAGEset, method = "powerLaw", fitInRange = c(5, 1000), alpha = 1.2, T = 5*10^4) ################################################### ### code chunk number 17: CAGEr.Rnw:341-343 (eval = FALSE) ################################################### ## exportCTSStoBedGraph(myCAGEset, values = "normalized", ## format = "bedGraph", oneFile = TRUE) ################################################### ### code chunk number 18: CAGEr.Rnw:349-350 (eval = FALSE) ################################################### ## exportCTSStoBedGraph(myCAGEset, values = "normalized", format = "BigWig") ################################################### ### code chunk number 19: CAGEr.Rnw:379-382 ################################################### clusterCTSS(object = myCAGEset, threshold = 1, thresholdIsTpm = TRUE, nrPassThreshold = 1, method = "distclu", maxDist = 20, removeSingletons = TRUE, keepSingletonsAbove = 5) ################################################### ### code chunk number 20: CAGEr.Rnw:388-390 ################################################### tc <- tagClusters(myCAGEset, sample = "zf_unfertilized_egg") head(tc) ################################################### ### code chunk number 21: CAGEr.Rnw:427-429 ################################################### cumulativeCTSSdistribution(myCAGEset, clusters = "tagClusters") quantilePositions(myCAGEset, clusters = "tagClusters", qLow = 0.1, qUp = 0.9) ################################################### ### code chunk number 22: CAGEr.Rnw:433-436 ################################################### tc <- tagClusters(myCAGEset, sample = "zf_unfertilized_egg", returnInterquantileWidth = TRUE, qLow = 0.1, qUp = 0.9) head(tc) ################################################### ### code chunk number 23: CAGEr.Rnw:440-442 (eval = FALSE) ################################################### ## exportToBed(object = myCAGEset, what = "tagClusters", ## qLow = 0.1, qUp = 0.9, oneFile = TRUE) ################################################### ### code chunk number 24: CAGEr.Rnw:456-458 (eval = FALSE) ################################################### ## plotInterquantileWidth(myCAGEset, clusters = "tagClusters", ## tpmThreshold = 3, qLow = 0.1, qUp = 0.9) ################################################### ### code chunk number 25: CAGEr.Rnw:476-478 ################################################### aggregateTagClusters(myCAGEset, tpmThreshold = 5, qLow = 0.1, qUp = 0.9, maxDist = 100) ################################################### ### code chunk number 26: CAGEr.Rnw:483-485 ################################################### consensusCl <- consensusClusters(myCAGEset) head(consensusCl) ################################################### ### code chunk number 27: CAGEr.Rnw:494-496 (eval = FALSE) ################################################### ## consensusCl <- consensusClusters(myCAGEset, sample = "zf_unfertilized_egg", ## returnInterquantileWidth = TRUE, qLow = 0.1, qUp = 0.9) ################################################### ### code chunk number 28: CAGEr.Rnw:510-512 ################################################### getExpressionProfiles(myCAGEset, what = "consensusClusters", tpmThreshold = 10, nrPassThreshold = 1, method = "som", xDim = 4, yDim = 2) ################################################### ### code chunk number 29: CAGEr.Rnw:516-517 (eval = FALSE) ################################################### ## plotExpressionProfiles(myCAGEset, what = "consensusClusters") ################################################### ### code chunk number 30: CAGEr.Rnw:529-532 ################################################### class3_1 <- extractExpressionClass(myCAGEset, what = "consensusClusters", which = "3_1") head(class3_1) ################################################### ### code chunk number 31: CAGEr.Rnw:537-539 (eval = FALSE) ################################################### ## exportToBed(myCAGEset, what = "consensusClusters", ## colorByExpressionProfile = TRUE) ################################################### ### code chunk number 32: CAGEr.Rnw:561-562 ################################################### cumulativeCTSSdistribution(myCAGEset, clusters = "consensusClusters") ################################################### ### code chunk number 33: CAGEr.Rnw:565-567 ################################################### scoreShift(myCAGEset, groupX = "zf_unfertilized_egg", groupY = "zf_prim6", testKS = TRUE, useTpmKS = FALSE) ################################################### ### code chunk number 34: CAGEr.Rnw:591-595 ################################################### shifting.promoters <- getShiftingPromoters(myCAGEset, tpmThreshold = 5, scoreThreshold = 0.6, fdrThreshold = 0.01) head(shifting.promoters) ################################################### ### code chunk number 35: CAGEr.Rnw:630-633 ################################################### data(FANTOM5humanSamples) head(FANTOM5humanSamples) nrow(FANTOM5humanSamples) ################################################### ### code chunk number 36: CAGEr.Rnw:651-654 ################################################### astrocyteSamples <- FANTOM5humanSamples[grep("Astrocyte", FANTOM5humanSamples[,"description"]),] astrocyteSamples ################################################### ### code chunk number 37: CAGEr.Rnw:657-660 ################################################### data(FANTOM5mouseSamples) head(FANTOM5mouseSamples) nrow(FANTOM5mouseSamples) ################################################### ### code chunk number 38: CAGEr.Rnw:664-665 ################################################### astrocyteSamples[,"sample"] ################################################### ### code chunk number 39: CAGEr.Rnw:668-671 ################################################### astrocyteCAGEset <- importPublicData(source = "FANTOM5", dataset = "human", sample = astrocyteSamples[1:3,"sample"]) astrocyteCAGEset ################################################### ### code chunk number 40: CAGEr.Rnw:679-681 (eval = FALSE) ################################################### ## source("http://bioconductor.org/biocLite.R") ## biocLite("FANTOM3and4CAGE") ################################################### ### code chunk number 41: CAGEr.Rnw:684-690 ################################################### library(FANTOM3and4CAGE) data(FANTOMhumanSamples) head(FANTOMhumanSamples) data(FANTOMmouseSamples) head(FANTOMmouseSamples) ################################################### ### code chunk number 42: CAGEr.Rnw:694-698 ################################################### kidneyCAGEset <- importPublicData(source = "FANTOM3and4", dataset = "FANTOMtissueCAGEhuman", group = "kidney", sample = c("kidney", "malignancy")) kidneyCAGEset ################################################### ### code chunk number 43: CAGEr.Rnw:701-707 ################################################### mixedCAGEset <- importPublicData(source = "FANTOM3and4", dataset = c("FANTOMtissueCAGEmouse", "FANTOMtissueCAGEmouse", "FANTOMtimecourseCAGEmouse"), group = c("liver", "liver", "liver_under_constant_darkness"), sample = c("cloned_mouse", "control_mouse", "4_hr")) mixedCAGEset ################################################### ### code chunk number 44: CAGEr.Rnw:716-719 (eval = FALSE) ################################################### ## library(ENCODEprojectCAGE) ## ## data(ENCODEhumanCellLinesSamples) ################################################### ### code chunk number 45: CAGEr.Rnw:723-727 (eval = FALSE) ################################################### ## ENCODEset <- importPublicData(source = "ENCODE", ## dataset = c("A549", "H1-hESC", "IMR90"), ## group = c("cell", "cell", "cell"), sample = c("A549_cell_rep1", ## "H1-hESC_cell_rep1", "IMR90_cell_rep1")) ################################################### ### code chunk number 46: CAGEr.Rnw:736-739 (eval = FALSE) ################################################### ## library(ZebrafishDevelopmentalCAGE) ## ## data(ZebrafishSamples) ################################################### ### code chunk number 47: CAGEr.Rnw:743-746 (eval = FALSE) ################################################### ## zebrafishCAGEset <- importPublicData(source = "ZebrafishDevelopment", ## dataset = "ZebrafishCAGE", group = "development", ## sample = c("zf_64cells", "zf_prim6")) ################################################### ### code chunk number 48: CAGEr.Rnw:758-759 ################################################### sessionInfo()