reorganize | R Documentation |
The function creates a new methylRawList
, methylRawListDB
,
methylBase
or methylBaseDB
object by selecting a subset of samples from the input object, which is
a methylRawList
or methylBase
object. You can use the function
to partition a large methylRawList or methylBase object
to smaller object based on sample ids or when you want to reorder samples
and/or give a new treatmet vector.
reorganize(
methylObj,
sample.ids,
treatment,
chunk.size = 1e+06,
save.db = FALSE,
...
)
## S4 method for signature 'methylBase'
reorganize(
methylObj,
sample.ids,
treatment,
chunk.size = 1e+06,
save.db = FALSE,
...
)
## S4 method for signature 'methylRawList'
reorganize(
methylObj,
sample.ids,
treatment,
chunk.size = 1e+06,
save.db = FALSE,
...
)
## S4 method for signature 'methylRawListDB'
reorganize(
methylObj,
sample.ids,
treatment,
chunk.size = 1e+06,
save.db = TRUE,
...
)
## S4 method for signature 'methylBaseDB'
reorganize(
methylObj,
sample.ids,
treatment,
chunk.size = 1e+06,
save.db = TRUE,
...
)
methylObj |
a |
sample.ids |
a vector for sample.ids to be subset. Order is important and the order should be similar to treatment. sample.ids should be a subset or reordered version of sample ids in the input object. |
treatment |
treatment vector, should be same length as sample.ids vector |
chunk.size |
Number of rows to be taken as a chunk for processing the
|
save.db |
A Logical to decide whether the resulting object should be saved as flat file database or not, default: explained in Details sections |
... |
optional Arguments used when save.db is TRUE
|
returns a methylRawList
, methylRawListDB
,
methylBase
or methylBaseDB
object depending on the input object
The parameter chunk.size
is only used when working with
methylBaseDB
or methylRawListDB
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
.
The parameter save.db
is per default TRUE for methylDB objects as
methylBaseDB
and methylRawListDB
,
while being per default FALSE for methylBase
and
methylRawList
. If you wish to save the result of an
in-memory-calculation as flat file database or if the size of the
database allows the calculation in-memory,
then you might want to change the value of this parameter.
# this is a list of example files, ships with the package
file.list=list( system.file("extdata", "test1.myCpG.txt", package = "methylKit"),
system.file("extdata", "test2.myCpG.txt", package = "methylKit"),
system.file("extdata", "control1.myCpG.txt", package = "methylKit"),
system.file("extdata", "control2.myCpG.txt", package = "methylKit") )
# read the files to a methylRawList object: myobj
myobj=methRead( file.list,
sample.id=list("test1","test2","ctrl1","ctrl2"),
assembly="hg18",pipeline="amp",treatment=c(1,1,0,0))
meth=unite(myobj,destrand=TRUE)
# get samples named "test1" and "ctrl2" from myobj and create a new methylRawList object
myobj2=reorganize(myobj,sample.ids=c("test1","ctrl2"),treatment=c(1,0) )
# # get samples named "test1" and "ctrl2" from meth and create a new methylBase object
meth2 =reorganize(meth,sample.ids=c("test1","ctrl2"),treatment=c(1,0) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.