The Sets class implements a container to describe distinct objects that make up sets, along with element metadata and set metadata.
Sets(relations = DataFrame(element = character(0), set = character(0)), elementInfo, setInfo)
| relations |
|
|---|---|
| elementInfo |
|
| setInfo |
|
A Sets object.
relationsHits
The left node and right node of each hit stores the index of the element and set in elementInfo and setInfo, respectively.
Metadata for each relation is stored as mcols(relations(object)).
elementInfoIdVector.
Metadata for each unique element in relations$element is stored as mcols(elementInfo).
setInfoIdVector.
Metadata for each unique set in relations$set is stored as mcols(setInfo).
# Constructor ---- # Visually intuitive definition of sets sets <- list( set1=c("A", "B"), set2=c("B", "C", "D"), set3=c("E")) bs <- as(sets, "Sets") bs#> Sets with 6 relations between 5 elements and 3 sets #> element set #> <character> <character> #> [1] A set1 #> [2] B set1 #> [3] B set2 #> [4] C set2 #> [5] D set2 #> [6] E set3 #> ----------- #> elementInfo: IdVector with 0 metadata #> setInfo: IdVector with 0 metadata# Coercing ---- # to list (gene sets) ls1 <- as(bs, "list") ls1#> List of length 3 #> names(3): set1 set2 set3# to matrix (logical membership) m1 <- as(bs, "matrix") m1#> set1 set2 set3 #> A TRUE FALSE FALSE #> B TRUE TRUE FALSE #> C FALSE TRUE FALSE #> D FALSE TRUE FALSE #> E FALSE FALSE TRUE#> Hits object with 6 hits and 0 metadata columns: #> from to #> <integer> <integer> #> [1] 1 1 #> [2] 2 1 #> [3] 2 2 #> [4] 3 2 #> [5] 4 2 #> [6] 5 3 #> ------- #> nLnode: 5 / nRnode: 3elementInfo(bs)#> IdVector of length 5 with 5 unique identifiers #> Ids: A, B, C, D, ... #> Metadata: (0 columns)setInfo(bs)#> IdVector of length 3 with 3 unique identifiers #> Ids: set1, set2, set3 #> Metadata: (0 columns)#> [1] 6nElements(bs)#> [1] 5nSets(bs)#> [1] 3setLengths(bs)#> set1 set2 set3 #> 2 3 1elementLengths(bs)#> A B C D E #> 1 2 1 1 1