copyAttr | R Documentation |
Copy Attributes to Another Object
copyAttr(x, y)
x |
Object 1. |
y |
Object 2. |
The normalizeToMatrix
object is actually a matrix but with more additional attributes attached.
When manipulating such matrix, there are some circumstances that the attributes are lost.
This function is used to copy these specific attributes when dealing with the matrix.
Zuguang Gu <z.gu@dkfz.de>
gr = GRanges(seqnames = c("chr5", "chr5"),
ranges = IRanges(start = c(98, 98),
end = c(104, 104)))
target = GRanges(seqnames = "chr5",
ranges = IRanges(start = 100,
end = 100))
mat1 = normalizeToMatrix(gr, target, extend = 6, w = 1)
# attributes removed and you cannot use it for EnrichedHeatmap()
mat2 = mat1[]
# copy attributes to mat2 and now mat3 can be used for EnrichedHeatmap()
mat3 = copyAttr(mat1, mat2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.