# Bio.Nexus.Nodes module

Linked list functionality for use in Bio.Nexus.

Provides functionality of a linked list. Each node has one (or none) predecessor, and an arbitrary number of successors. Nodes can store arbitrary data in a NodeData class.

Subclassed by Nexus.Trees to store phylogenetic trees.

Bug reports to Frank Kauff (fkauff@biologie.uni-kl.de)

exception Bio.Nexus.Nodes.ChainException

  Bases: `Exception`

  Provision for the management of Chain exceptions.

  __firstlineno__ = 22
  __static_attributes__ = ()

exception Bio.Nexus.Nodes.NodeException

  Bases: `Exception`

  Provision for the management of Node exceptions.

  __firstlineno__ = 26
  __static_attributes__ = ()

class Bio.Nexus.Nodes.Chain

  Bases: `object`

  Stores a list of nodes that are linked together.

  __init__() → None

    Initialize a node chain.

  all_ids() → list[int]

    Return a list of all node ids.

  add(node: Node, prev: int | None = None) → int

    Attach node to another.

  collapse(id)

    Delete node from chain and relinks successors to predecessor.

  kill(id)

    Kill a node from chain without caring to what it is connected.

  unlink(id)

    Disconnect node from his predecessor.

  link(parent, child)

    Connect son to parent.

  is_parent_of(parent, grandchild)

    Check if grandchild is a subnode of parent.

  trace(start, finish)

    Return a list of all node_ids between two nodes (excluding start, including end).

  __annotate_func__ = None
  __annotations_cache__ = {'chain': 'dict[int, Node]'}
  __firstlineno__ = 30
  __static_attributes__ = ('chain', 'id')

class Bio.Nexus.Nodes.Node(data=None)

  Bases: `object`

  A single node.

  __init__(data=None)

    Represent a node with one predecessor and multiple successors.

  set_id(id)

    Set the id of a node, if not set yet.

  get_id()

    Return the node’s id.

  get_succ()

    Return a list of the node’s successors.

  get_prev()

    Return the id of the node’s predecessor.

  add_succ(id)

    Add a node id to the node’s successors.

  remove_succ(id)

    Remove a node id from the node’s successors.

  set_succ(new_succ)

    Set the node’s successors.

  set_prev(id)

    Set the node’s predecessor.

  get_data()

    Return a node’s data.

  set_data(data)

    Set a node’s data.

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 125
  __static_attributes__ = ('data', 'id', 'prev', 'succ')

Biopython v: 1.86

Versions
  Previous
  Latest
  Develop

Biopython Project
  Homepage
  On GitHub