Permute the node labels of a tree

Share:

Description

permuteLabels permutes the node annotations of a lineage tree.

Usage

1
permuteLabels(graph, field, exclude = c("Germline", NA))

Arguments

graph

igraph object containing an annotated lineage tree.

field

string defining the annotation field to permute.

exclude

vector of strings defining field values to exclude from permutation.

Value

A modified igraph object with vertex annotations permuted.

See Also

testEdges.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Define and plot example graph
library(igraph)
graph <- ExampleTrees[[23]]
plot(graph, layout=layout_as_tree, vertex.label=V(graph)$ISOTYPE, 
     vertex.size=50, edge.arrow.mode=0, vertex.color="grey80")

# Permute annotations and plot new tree
g <- permuteLabels(graph, "ISOTYPE")
plot(g, layout=layout_as_tree, vertex.label=V(g)$ISOTYPE,
     vertex.size=50, edge.arrow.mode=0, vertex.color="grey80")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.