Contents

1 TWGBS data

The DNA methylation data have been stored as rds files and are bsseq objects. They contain the raw counts for each CpG position in the mm10 reference genome as well the preprocessed smoothed values for each sample. In addition there is a second file containing DNA methylation profiles per tissue, e.g. the replicates from the same tissue have been collapsed. Also here the smoothed values have been precomputed and are directly available.

1.1 Per sample

We first load necessary libraries and data:

library(ExperimentHub)
library(bsseq)
eh <- ExperimentHub()
BS.obj.ex.fit <- eh[["EH1072"]]
#> see ?tissueTreg and browseVignettes('tissueTreg') for documentation
#> loading from cache

For example to visually inspect the DNA methylation state of the FoxP3 gene in the CNS2 region we first specify a single region:

regions <- GRanges(
  seqnames = c("X"),
  ranges = IRanges(start = c(7579676),
                   end = c(7595243)
  )
)

We can then directly use the plotRegion function from the bsseq package for visualization based on smoothed values:

plotRegion(BS.obj.ex.fit, region=regions[1,], extend = 2000)

We assume that the three sample with higher DNA methylation in CNS2 are the T conventional samples. To check that visually we can color the samples by tissue and cell type.

We check the order in the object first:

colnames(BS.obj.ex.fit)
#>  [1] "Fat-Treg-R1"     "Fat-Treg-R2"     "Fat-Treg-R3"     "Liver-Treg-R1"  
#>  [5] "Liver-Treg-R2"   "Liver-Treg-R3"   "Skin-Treg-R1"    "Skin-Treg-R2"   
#>  [9] "Skin-Treg-R3"    "Lymph-N-Tcon-R1" "Lymph-N-Tcon-R2" "Lymph-N-Tcon-R3"
#> [13] "Lymph-N-Treg-R1" "Lymph-N-Treg-R2" "Lymph-N-Treg-R3"

And assign the colors:

pData <- pData(BS.obj.ex.fit)
pData$col <- rep(c("red", "blue", "green", "yellow", "orange"), rep(3,5))
pData(BS.obj.ex.fit) <- pData
plotRegion(BS.obj.ex.fit, region=regions[1,], extend = 2000)

This plot is confirming our assumption but we don’t have to plot all samples since they seem to be already consistent. We would now like to do the same region using smoothed values for each group.

1.2 Per tissue / cell type

The smoothed data has already been precomputed and stored in a another rds file which we first need to load:

BS.obj.ex.fit.combined <- eh[["EH1073"]]
#> see ?tissueTreg and browseVignettes('tissueTreg') for documentation
#> loading from cache
colnames(BS.obj.ex.fit.combined)
#> [1] "Fat-Treg"     "Liver-Treg"   "Lymph-N-Tcon" "Lymph-N-Treg" "Skin-Treg"

We now only have the tissue and cell type instead of the replicates. We assign the same colors:

pData <- pData(BS.obj.ex.fit.combined)
pData$col <- c("red", "blue", "yellow", "orange", "green")
pData(BS.obj.ex.fit.combined) <- pData
plotRegion(BS.obj.ex.fit.combined, region=regions[1,], extend = 2000)