getPathLengths | R Documentation |
getPathLengths
calculates the unweighted (number of steps) and weighted (distance)
path lengths from the root of a lineage tree.
getPathLengths(graph, root = "Germline", field = NULL, exclude = NULL)
graph |
igraph object containing an annotated lineage tree. |
root |
name of the root (germline) node. |
field |
annotation field to use for exclusion of nodes from step count. |
exclude |
annotation values specifying which nodes to exclude from step count.
If |
A data.frame with columns:
name
: node name
steps
: path length as the number of nodes traversed
distance
: path length as the sum of edge weights
See buildPhylipLineage for generating input trees.
# Define example graph
graph <- ExampleTrees[[24]]
# Consider all nodes
getPathLengths(graph, root="Germline")
# Exclude nodes without an isotype annotation from step count
getPathLengths(graph, root="Germline", field="c_call", exclude=NA)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.