skeleton_utils
sleap.sleap_io_adaptors.skeleton_utils
¶
Helper functions for sleap_io.Skeleton objects.
Functions:
| Name | Description |
|---|---|
cycles |
Return a list of cycles in the skeleton. |
delete_edge |
Delete an edge between two nodes. |
delete_symmetry |
Delete symmetry for given node name. |
edge_to_index |
Return the index of edge from source to destination. |
find_node |
Find node in skeleton by name of node. |
get_symmetry_node |
Get symmetry node name for given node name. |
in_degree_over_one |
Return a list of nodes in the skeleton with in-degree over one. |
is_arborescence |
Return whether this skeleton graph forms an arborescence. |
node_to_index |
Return the index of the node, accepts either |
root_nodes |
Return a list of root nodes in the skeleton. |
to_graph |
Return a graph representation of the skeleton. |
to_subgraph_view |
Return a view on the subgraph of body nodes and edges. |
cycles(skeleton)
¶
Return a list of cycles in the skeleton.
delete_edge(skeleton, source, destination)
¶
Delete an edge between two nodes. Args: skeleton: The skeleton to delete the edge from. source: The name of the source node. destination: The name of the destination node. Raises: ValueError: If skeleton does not have either source node, destination node, or edge between them. Returns: Skeleton: The skeleton with the edge deleted.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
delete_symmetry(skeleton, node1, node2)
¶
Delete symmetry for given node name.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
edge_to_index(skeleton, source, destination)
¶
Return the index of edge from source to destination.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
find_node(skeleton, node_name)
¶
get_symmetry_node(skeleton, node_name)
¶
Get symmetry node name for given node name.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
in_degree_over_one(skeleton)
¶
Return a list of nodes in the skeleton with in-degree over one.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
is_arborescence(skeleton)
¶
Return whether this skeleton graph forms an arborescence.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
node_to_index(skeleton, node)
¶
Return the index of the node, accepts either Node or name.
Args:
node: The name of the node or the Node object.
Raises:
ValueError if node cannot be found in skeleton.
Returns:
The index of the node in the graph.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
root_nodes(skeleton)
¶
Return a list of root nodes in the skeleton.
to_graph(skeleton)
¶
Return a graph representation of the skeleton.
Source code in sleap/sleap_io_adaptors/skeleton_utils.py
to_subgraph_view(graph)
¶
Return a view on the subgraph of body nodes and edges.