UNPKG

phylogician-ts

Version:

Module to read, manipulate and write phylogenetic trees. Written in TypeScript

118 lines (117 loc) 2.96 kB
import { IPhylogicianOptions, ISvgParams } from './interfaces'; import { Tree } from './Tree'; import { LogLevelDescType } from 'loglevel-colored-prefix'; declare class Phylogician { tree: Tree; options: IPhylogicianOptions; private svgParams; private scale; private layout; private logger; private logLevel; private nodeIndexOrder; private tooltip; private tooltipNodeId; /** * Creates an instance of Phylogician. * @memberof Phylogician */ constructor(options?: IPhylogicianOptions, loglevel?: LogLevelDescType); /** * Builds a Tree from newick. * * @param {string} data * @returns {Phylogician} * @memberof Phylogician */ data(data: string): Phylogician; /** * Set positions of nodes and labels according to a layout type. * * @param {string} layoutType * @returns {Phylogician} * @memberof Phylogician */ setLayout(layoutType: string): Phylogician; /** * Draws tree in browser * * @param {string} divId * @returns {HTMLDivElement} * @memberof Phylogician */ draw(divId: string): Phylogician; /** * Update Tree representation * * @returns {Phylogician} * @memberof Phylogician */ update(): Phylogician; /** * Set svg parameters and update tree". * * @param {ISvgParams} parameters * @returns * @memberof Phylogician */ setSvgParameters(parameters: ISvgParams): Phylogician; /** * Scale or not the tree by branch lengths * * @returns {Phylogician} * @memberof Phylogician */ toggleScale(): Phylogician; /** * It sets the font size of all labels. It recalculates the tree and updates * * @param {string} fontSize * @returns * @memberof Phylogician */ setFontSizeAllLabels(fontSize: string): this; /** * Changes to display or hide the labels of all nodes. * (not tested) * * @returns {Phylogician} * @memberof Phylogician */ showAllLabels(show: boolean): Phylogician; /** * Changes to display or hide the labels of leafs only. * * @returns {Phylogician} * @memberof Phylogician */ showLeafLabels(show: boolean): Phylogician; /** * Ladderize the tree or sub-tree. * * @param {number} nodeId * @returns * @memberof Phylogician */ ladderize(nodeId: number): this; /** * Change the color of the node ids passed. * * @param {number[]} nodeIds * @param {string} color * @returns * @memberof Phylogician */ markNodes(nodeIds: number[], color: string): this; private calcLabelHeighOffSet; private nodeHoverIn; private nodeHoverOut; /** * Draw tooltip () * * @returns {this} * @memberof Phylogician */ private drawTooltip; } export { Phylogician };