Last data update: 2014.03.03

R: Class to contain raw Bisulfite Sequencing (BiSeq) Data
BSraw-classR Documentation

Class to contain raw Bisulfite Sequencing (BiSeq) Data

Description

The BSraw class is derived from RangedSummarizedExperiment and contains a SimpleList of matrices named methReads and totalReads as assays.

Objects from the Class

Objects can be created by calls of the form BSraw(metadata = list(), rowRanges, colData = DataFrame(row.names=colnames(methReads)), methReads, totalReads, ...).

However, one will most likely create a BSraw object when use readBismark to load data.

Slots

metadata:

An optional list of arbitrary content describing the overall experiment.

rowRanges:

Object of class "GRanges" containing the genome positions of CpG-sites covered by bisulfite sequencing. WARNING: The accessor for this slot is rowRanges, not rowRanges!

colData:

Object of class "DataFrame" containing information on variable values of the samples.

assays:

Object of class SimpleList of two matrices, named totalReads and methReads. The matrix totalReads contains the number of reads spanning a CpG-site. The rows represent the CpG sites in rowRanges and the columns represent the samples in colData. The matrix methReads contains the number of methylated reads spanning a CpG-site.

Extends

Class "RangedSummarizedExperiment", directly.

Methods

totalReads

signature(x = "BSraw"): Gets the totalReads slot.

totalReads<-

signature(x = "BSraw", value = "matrix"): Sets the totalReads slot.

methReads

signature(x = "BSraw"): Gets the methReads slot.

methReads<-

signature(x = "BSraw", value = "matrix"): Sets the methReads slot.

combine

signature(x = "BSraw", y = "BSraw"): Combines two BSraw objects.

Author(s)

Katja Hebestreit

See Also

RangedSummarizedExperiment, BSrel-class, readBismark

Examples

showClass("BSraw")

## How to create a BSraw object by hand:
metadata <- list(Sequencer = "Sequencer", Year = "2013")
rowRanges <- GRanges(seqnames = "chr1",
                  ranges = IRanges(start = c(1,2,3), end = c(1,2,3)))
colData <- DataFrame(group = c("cancer", "control"),
                     row.names = c("sample_1", "sample_2"))
totalReads <- matrix(c(rep(10L, 3), rep(5L, 3)), ncol = 2)
methReads <- matrix(c(rep(5L, 3), rep(5L, 3)), ncol = 2)
BSraw(metadata = metadata,
      rowRanges = rowRanges,
      colData = colData,
      totalReads = totalReads,
      methReads = methReads)

## A more realistic example can be loaded:
data(rrbs)
rrbs

head(totalReads(rrbs))
head(methReads(rrbs))

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BiSeq)
Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit


Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums

Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: GenomeInfoDb
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: Formula
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/BiSeq/BSraw-class.Rd_%03d_medium.png", width=480, height=480)
> ### Name: BSraw-class
> ### Title: Class to contain raw Bisulfite Sequencing (BiSeq) Data
> ### Aliases: BSraw-class BSraw BSraw,matrix,matrix,GRanges-method
> ###   combine,BSraw,BSraw-method methReads methReads<- totalReads
> ###   totalReads<- totalReads,BSraw-method totalReads<-,BSraw,matrix-method
> ###   methReads,BSraw-method methReads<-,BSraw,matrix-method
> ### Keywords: classes
> 
> ### ** Examples
> 
> showClass("BSraw")
Class "BSraw" [package "BiSeq"]

Slots:
                                                            
Name:                   rowRanges                    colData
Class: GenomicRangesORGRangesList                  DataFrame
                                                            
Name:                      assays                      NAMES
Class:                     Assays            characterORNULL
                                                            
Name:             elementMetadata                   metadata
Class:                  DataFrame                       list

Extends: 
Class "RangedSummarizedExperiment", directly
Class "SummarizedExperiment", by class "RangedSummarizedExperiment", distance 2
Class "Vector", by class "RangedSummarizedExperiment", distance 3
Class "Annotated", by class "RangedSummarizedExperiment", distance 4
> 
> ## How to create a BSraw object by hand:
> metadata <- list(Sequencer = "Sequencer", Year = "2013")
> rowRanges <- GRanges(seqnames = "chr1",
+                   ranges = IRanges(start = c(1,2,3), end = c(1,2,3)))
> colData <- DataFrame(group = c("cancer", "control"),
+                      row.names = c("sample_1", "sample_2"))
> totalReads <- matrix(c(rep(10L, 3), rep(5L, 3)), ncol = 2)
> methReads <- matrix(c(rep(5L, 3), rep(5L, 3)), ncol = 2)
> BSraw(metadata = metadata,
+       rowRanges = rowRanges,
+       colData = colData,
+       totalReads = totalReads,
+       methReads = methReads)
class: BSraw 
dim: 3 2 
metadata(0):
assays(2): totalReads methReads
rownames: NULL
rowData names(0):
colnames(2): sample_1 sample_2
colData names(1): group
> 
> ## A more realistic example can be loaded:
> data(rrbs)
> rrbs
class: BSraw 
dim: 10502 10 
metadata(0):
assays(2): totalReads methReads
rownames(10502): 1456 1457 ... 4970981 4970982
rowData names(0):
colnames(10): APL1 APL2 ... APL11624 APL5894
colData names(1): group
> 
> head(totalReads(rrbs))
     APL1 APL2 APL3 APL7 APL8 APL10961 APL11436 APL11523 APL11624 APL5894
1456   39    6   10    0    0       48       31       65       39      29
1457   39    6   10    0    0       48       31       65       39      29
1458   39    6   10    0    0       48       27       65       39      29
1459   20   26   49   48   39       27       23       34       29      15
1460   20   26   49   48   39       27       23       34       28      15
1461   20   26   49   48   39       27       22       34       29      15
> head(methReads(rrbs))
     APL1 APL2 APL3 APL7 APL8 APL10961 APL11436 APL11523 APL11624 APL5894
1456   32    6    7    0    0       15       23       16        7       7
1457   33    6    7    0    0       18       10       19        2       7
1458   33    6   10    0    0       20       10       19        2       3
1459   13   20   34   41   32        3        8        8        6       4
1460   14   18   35   37   33        2        4        4        3       0
1461   14   16   35   40   31        5        5        5        1       2
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>