phylogician-ts
Version:
Module to read, manipulate and write phylogenetic trees. Written in TypeScript
288 lines (287 loc) • 6.69 kB
TypeScript
import { IDisplayNameChunks, IDisplayNameUserChunks, IOptionsViz } from './interfaces';
export declare class TreeNode {
name: string;
branchLength: number | null;
children: number[];
parent: number | null;
reverseLadderized: boolean;
readonly id: number;
protected displayNameChunks: IDisplayNameChunks[];
protected displayNameUserChunks: IDisplayNameUserChunks[];
protected viz: IOptionsViz;
protected root: boolean;
/**
* Creates an instance of TreeNode.
* @param {string} name
* @param {(number|null)} branchLength
* @memberof TreeNode
*/
constructor(name: string, branchLength: number | null, id: number);
/**
* Sets parent to the Tree node.
*
* @param {Tree} parent
* @returns {TreeNode}
* @memberof Tree
*/
setParentNodeId(parent: number): this;
/**
* Returns parent of the node
*
* @returns {(number | null)}
* @memberof TreeNode
*/
getParentNodeId(): number | null;
/**
* Returns true if the node is leaf
*
* @returns {boolean}
* @memberof TreeNode
*/
isLeaf(): boolean;
/**
* Sets node to be root
*
* @memberof TreeNode
*/
setAsRoot(): this;
/**
* Sets node to not be root
*
* @memberof TreeNode
*/
unsetAsRoot(): this;
/**
*
*
* @returns {boolean}
* @memberof TreeNode
*/
isRoot(): boolean;
/**
* Returns the size of the node
*
* @returns {number}
* @memberof TreeNode
*/
getNodeSize(): number;
/**
* Changes the node size
*
* @param {number} size
* @memberof TreeNode
*/
setNodeSize(size: number): this;
/**
* Returns the color of the node
*
* @returns {string} node color
* @memberof TreeNode
*/
getNodeColor(): string;
/**
* Changes the node color.
*
* @param {string} color
* @memberof TreeNode
*/
setNodeColor(color: string): this;
/**
* Returns the shape of the node
*
* @returns {string} node shape
* @memberof TreeNode
*/
getNodeShape(): string;
/**
* Changes the node shape.
*
* @param {string} shape
* @memberof TreeNode
*/
setNodeShape(shape: string): this;
/**
* Returns the position X of the node
*
* @returns {number} position X
* @memberof TreeNode
*/
getPosX(): number;
/**
* Changes the position X of the node.
*
* @param {number} x
* @memberof TreeNode
*/
setPosX(x: number): this;
/**
* Returns the position Y of the node
*
* @returns {number} position Y
* @memberof TreeNode
*/
getPosY(): number;
/**
* Changes the position Y of the node.
*
* @param {number} y
* @memberof TreeNode
*/
setPosY(y: number): this;
/**
* Returns the position "r" of the node (for Circular layout)
*
* @returns {number} position R
* @memberof TreeNode
*/
getPosR(): number;
/**
* Changes the position "r" of the node (for Circular layout).
*
* @param {number} r
* @memberof TreeNode
*/
setPosR(r: number): this;
/**
* Returns the position "a" of the node (for Circular layout)
*
* @returns {number} position Y
* @memberof TreeNode
*/
getPosA(): number;
/**
* Changes the position "a" of the node (for Circular layout).
*
* @param {number} a
* @memberof TreeNode
*/
setPosA(a: number): this;
/**
* Sets the branch path of the node.
*
* @param {string} path
* @memberof TreeNode
*/
setBranchPath(path: string | null): this;
/**
* Gets the branch path of the node.
*
* @returns {string}
* @memberof TreeNode
*/
getBranchPath(): string;
/**
* Sets the branch path of the node.
*
* @param {string} path
* @memberof TreeNode
*/
setBranchColor(color: string): this;
/**
* Gets the branch path of the node.
*
* @returns {string}
* @memberof TreeNode
*/
getBranchColor(): string;
/**
* Returns the width of the label of the node
*
* @returns {number}
* @memberof TreeNode
*/
getLabelWidth(): number;
/**
* Sets the width of the label of the node
*
* @param {number} width
* @memberof TreeNode
*/
setLabelWidth(width: number): this;
/**
* Returns the height of the label of the node
*
* @returns {number}
* @memberof TreeNode
*/
getLabelHeight(): number;
/**
* Sets the height of the label of the node
*
* @param {number} height
* @memberof TreeNode
*/
setLabelHeight(height: number): this;
/**
* Returns the color of the label of the node
*
* @returns {string}
* @memberof TreeNode
*/
getDefaultLabelColor(): string;
/**
* Sets the color of the label of the node
*
* @param {string} height
* @memberof TreeNode
*/
setDefaultLabelColor(height: string): this;
/**
* Sets the font size of the label of the node.
*
* @param {string} fontSize
* @memberof TreeNode
*/
setDefaultFontSize(fontSize: string): this;
/**
* Gets the font size of the label of the node.
*
* @returns {string}
* @memberof TreeNode
*/
getDefaultFontSize(): string;
/**
* Sets if label should be displayed or hidden
*
* @param {boolean} showLabel
* @memberof TreeNode
*/
setShowLabel(showLabel: boolean): this;
/**
* Gets if display is hidden or not.
*
* @returns {string}
* @memberof TreeNode
*/
getShowLabel(): boolean;
/**
* Sets name to be displayed in tree in chuncks with different styles
*
* @param {string} displayName
* @returns {this}
* @memberof TreeNode
*/
setDisplayNameChunks(displayNameList: IDisplayNameUserChunks[]): this;
/**
* Gets the display name chunks.
*
* @returns {string}
* @memberof TreeNode
*/
getDisplayNameChunks(): IDisplayNameChunks[];
/**
* Sets name to be displayed in tree (default same as .name with default parameters)
*
* @param {string} displayName
* @returns {this}
* @memberof TreeNode
*/
setDisplayName(displayName: string): this;
/**
* Gets the name to be displayed in tree.
*
* @returns {string}
* @memberof TreeNode
*/
getDisplayName(): string;
}