LineageAlignment
public struct LineageAlignment
The LineageAlignment
struct parses the contents of a lineage tree and aligns
its nodes in a succession of columns
based on each node’s rank in a way in
which all the nodes with the same rank end up in the same column, while the
ones without rank are placed in columns between the closest ranked columns.
Once generated, the alignment can be used with various purposes, such as serving as a model to draw the tree in a view.
-
The
See moreLineageAlignment.Cell
struct wraps a lineage tree node and the properties related to its position and dimensions in the alignment.Declaration
Swift
public struct Cell : CustomDebugStringConvertible
-
The
See moreLineageAlignment.Column
struct holds an array of cells that share the same position in the alignment’s rank hierarchy.Declaration
Swift
public struct Column : CustomDebugStringConvertible
-
The array of columns in the alignment, sorted by rank.
Declaration
Swift
public private(set) var columns: [Column]
-
Returns the index for a column matching a given rank in the column array. The index of a column with no rank cannot be determined using
nil
, since there might be multiple columns with no rank.Declaration
Swift
public func indexOfColumn(for rank: TaxonomicRank) -> Int
Parameters
rank
The rank to be looked for.
Return Value
The index of the column with the passed rank in the column array.
-
Returns only the columns that contain at least one row.
Declaration
Swift
public var cleanedUp: [Column] { get }
-
Initializes a new lineage alignment based on the nodes of a given lineage tree.
Declaration
Swift
public init(lineageTree: LineageTree, automaticallyCleanUp: Bool = true)
Parameters
lineageTree
The lineage tree from which to take the nodes and their connections.
automaticallyCleanUp
Set this parameter to
true
to automatically strip the columns that remain empty after the alignment process. Default value istrue
.