Learn R Programming

tcR (version 1.3)

set.group.vector: Set group attribute for vertices of a mutation network

Description

asdasd

Usage

set.group.vector(.G, .attr.name, .groups)

get.group.names(.G, .attr.name, .V = V(.G), .paste = T)

Arguments

.G
Mutation network.
.attr.name
Name of the new vertex attribute.
.groups
List with integer vector with indices of subjects for each group.
.V
Indices of vertices.
.paste
If T than return character string with concatenated group names, else return list with character vectors with group names.

Value

  • igraph object with new vertex attribute .attr.name with binary strings for set.group.vector. Return character vector for get.group.names.

Examples

Run this code
data(twb)
twb.shared <- shared.repertoire(twb)
G <- mutation.network(twb.shared)
G <- set.group.vector(G, "twins", list(A = c(1,2), B = c(3,4)))  # <= refactor this
get.group.names(G, "twins", 1)       # "A|B"
get.group.names(G, "twins", 300)     # "A"
get.group.names(G, "twins", 1, F)    # list(c("A", "B"))
get.group.names(G, "twins", 300, F)  # list(c("A"))
# Because we have only two groups, we can assign more readable attribute.
V(G)$twin.names <- get.group.names(G, "twins")
V(G)$twin.names[1]  # "A|B"
V(G)$twin.names[300]  # "A"

Run the code above in your browser using DataLab