bedgraph-methods: Get bedgraph from methylRaw, methylRawList and methylDiff...

Description Usage Arguments Value Details Examples

Description

The function converts methylRaw, methylRawDB, methylRawList, methylRawListDB, methylDiff or methylDiffDB object into a bedgraph format. It either writes as a file or returns a data.frame

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
bedgraph(
  methylObj,
  file.name = NULL,
  col.name,
  unmeth = FALSE,
  log.transform = FALSE,
  negative = FALSE,
  add.on = "",
  chunk.size = 1e+06
)

## S4 method for signature 'methylDiff'
bedgraph(
  methylObj,
  file.name,
  col.name,
  unmeth,
  log.transform,
  negative,
  add.on
)

## S4 method for signature 'methylRaw'
bedgraph(
  methylObj,
  file.name,
  col.name,
  unmeth,
  log.transform,
  negative,
  add.on
)

## S4 method for signature 'methylRawList'
bedgraph(
  methylObj,
  file.name,
  col.name,
  unmeth,
  log.transform,
  negative,
  add.on
)

## S4 method for signature 'methylRawDB'
bedgraph(
  methylObj,
  file.name = NULL,
  col.name,
  unmeth = FALSE,
  log.transform = FALSE,
  negative = FALSE,
  add.on = "",
  chunk.size = 1e+06
)

## S4 method for signature 'methylRawListDB'
bedgraph(
  methylObj,
  file.name = NULL,
  col.name,
  unmeth = FALSE,
  log.transform = FALSE,
  negative = FALSE,
  add.on = "",
  chunk.size = 1e+06
)

## S4 method for signature 'methylDiffDB'
bedgraph(
  methylObj,
  file.name,
  col.name,
  log.transform,
  negative,
  add.on,
  chunk.size
)

Arguments

methylObj

a methylRaw, methylRawDB, methylRawList, methylRawListDB, methylDiff or methylDiffDB object

file.name

Default: NULL. if a string is given a bedgraph file will be written, if NULL a data.frame or a list of data frames will be returned

col.name

name of the column in methylRaw, methylRawDB, methylRawList, methylRawListDB, methylDiff or methylDiffDB objects to be used as a score for the bedgraph. For methylDiff or methylDiffDB, col.name must be one of the following 'pvalue','qvalue', 'meth.diff'. For methylRaw, methylRawDB, methylRawList and methylRawListDB it must be one of the following 'coverage', 'numCs','numTs', 'perc.meth'

unmeth

when working with methylRaw, methylRawDB, methylRawList and methylRawListDB objects should you output unmethylated C percentage this makes it easier to see the unmethylated bases because their methylation percentage values will be zero. Only invoked when file.name is not NULL.

log.transform

Default FALSE, If TRUE the score column of the bedgraph wil be in log10 scale. Ignored when col.name='perc.meth'

negative

Default FALSE, If TRUE, the score column of the bedgraph will be multiplied by -1. Ignored when col.name='perc.meth'

add.on

additional string to be add on the track line of bedgraph. can be viewlimits,priority etc. Check bedgraph track line options at UCSC browser

chunk.size

Number of rows to be taken as a chunk for processing the methylRawDB, methylRawListDB or methylDiffDB objects, default: 1e6

Value

Returns a data.frame or list of data.frames if file.name=NULL, if a file.name given appropriate bed file will be written to that file

Details

The parameter chunk.size is only used when working with methylRawDB, methylRawListDB or methylDiffDB objects, as they are read in chunk by chunk to enable processing large-sized objects which are stored as flat file database. Per default the chunk.size is set to 1M rows, which should work for most systems. If you encounter memory problems or have a high amount of memory available feel free to adjust the chunk.size.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(methylKit)

# getting a bedgraph file from a methylDiff object containing differential 
# methylation percentages
bedgraph(methylDiff.obj, file.name="test.bed", col.name="meth.diff", 
         unmeth=FALSE,log.transform=FALSE,negative=FALSE,add.on="")

# remove the file
unlink("test.bed")

# getting a bedgraph file from a methylBase object containing percent 
#methylation values
bedgraph(methylRawList.obj[[1]], file.name="test2.bed", col.name="perc.meth", 
         unmeth=FALSE,log.transform=FALSE,negative=FALSE,add.on="")

unlink("test2.bed") # remove the file

methylKit documentation built on Jan. 30, 2021, 2 a.m.