aboutsummaryrefslogtreecommitdiff
path: root/src/tol.ts
blob: bd299b3025dc00f92fcfde6d35fbf02523e9f007 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
 * Types for representing tree-of-life data
 */

// Represents a tree-of-life node
export class TolNode {
	otolId: string | null;
	children: string[];
	parent: string | null;
	tips: number;
	pSupport: boolean; // Indicates phylogenetic support
	commonName: null | string;
	imgName: null | string |
		[string, string] | [null, string] | [string, null]; // Pairs represent compound images
	iucn: null | string;
	constructor(children: string[] = [], parent = null, tips = 0, pSupport = false){
		this.otolId = null;
		this.children = children;
		this.parent = parent;
		this.tips = tips;
		this.pSupport = pSupport;
		this.commonName = null;
		this.imgName = null;
		this.iucn = null;
	}
}
// Maps TolNode names to TolNode objects
export type TolMap = Map<string, TolNode>;