forked from jimhester/GenomicRanges
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRangedData-methods.R
47 lines (39 loc) · 1.24 KB
/
RangedData-methods.R
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
### =========================================================================
### RangedData/RangesList implementation of the GenomicRanges API
### -------------------------------------------------------------------------
###
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### seqinfo
###
setMethod("seqinfo", "List", function(x) {
si <- metadata(x)$seqinfo
if (is.null(si)) {
sn <- names(x)
if (is.null(sn))
sn <- as.character(seq_len(length(x)))
si <- Seqinfo(unique(sn))
}
si
})
setMethod("seqinfo", "RangesList", function(x) {
si <- callNextMethod()
if (!is.null(universe(x)))
genome(si) <- universe(x)
si
})
### FIXME: needs sanity checks
setReplaceMethod("seqinfo", "List",
function(x, value) {
metadata(x)$seqinfo <- value
x
})
setMethod("seqinfo", "RangedData", function(x) seqinfo(ranges(x)))
setReplaceMethod("seqinfo", "RangedData",
function(x, value) {
seqinfo(ranges(x)) <- value
x
})
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
### seqnames
###
setMethod("seqnames", "RangedData", function(x) space(x))