schrodinger.ui.sequencealignment.tree_node module

Implementation of multiple sequence viewer TreeNode class.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.ui.sequencealignment.tree_node.TreeNode(level)[source]

Bases: object

The TreeNode class is a simple implementation of tree structure used to represent and display phylogenetic trees in the sequence viewer.

__init__(level)[source]

Initialize self. See help(type(self)) for accurate signature.

original_node

Corresponding node in the original tree.

maxLevel(level=0)[source]

Returns a maximum tree depth.

Parameters

level (int (optional)) – optional initial level

Return type

int

Returns

Maximum tree depth level.

findNode(x, y, radius)[source]

Finds a tree node at a specified position within a specified radius.

Parameters
  • x (int) – x coordinate

  • y (int) – y coordinate

  • radius (int) – node search radius (used as a Manhattan distance)

Return type

TreeNode

Returns

Tree node at (x, y) or None if node was not found there.

selectSequences()[source]

Recursively select all sequences within self.

hideSequences()[source]

Recursively hide all sequences within self.

sequencesVisible()[source]

Return True if any sequence within self is visible.

Returns

True if any sequence is visible

Return type

boolean

swap()[source]

Swaps tree branches.

getSequenceList(sequence_list)[source]

Builds a list of sequences by traversing the tree starting from self and appending the sequences to the sequence list.

Parameters

sequence_list (list of Sequence) – list of sequences to be extended

Return type

list of Sequence

Returns

built list of sequences

getVisibleTree()[source]

Return a subset of the tree that includes only the visible sequences. This method is used to actually draw the tree with branches that are partially hidden.

Return type

TreeNode

Returns

visible tree

buildSequenceList(sequence_group)[source]

Build a list of sequences using a given sequence group as a source.

Initially, the tree has no sequences associated with it. Every node has a name corresposing to a particular sequence index in the sequence group. This method finds these correspoding sequences in the sequence group and adds them to the node’s sequence list.

This method expects the sequence names to be in format used by fileio.load_clustal_file function, i.e. in format SEQxxxx where xxxx corresponds to a sequence index in the sequence group.

Parameters

sequence_group (SequenceGroup) – source sequence group