Skip to content
@deckyard/mitoleaf

mitoleaf cheatsheet

jennifer
import "@deckyard/mitoleaf/" as mitoleaf;

Errors and input rules: mitoleaf. tools/check-docs.sh checks every signature, field and value on this page against the code.

mitoleaf

FunctionReturnsDoes
mitoleaf.parse(doc)Treeparses a phm XML document; motifs are stored unvalidated
mitoleaf.haplogroups(t)list of stringevery haplogroup, in document order
mitoleaf.has(t, hg)boolwhether hg is in the tree (exact, case-sensitive)
mitoleaf.node(t, hg)Nodeone haplogroup's node
mitoleaf.children(t, hg)list of stringdirect children, in document order
mitoleaf.motif(t, hg)list of stringthe tokens hg adds to its parent, verbatim
mitoleaf.path(t, hg)list of stringroot to hg, both included
mitoleaf.haplotype(t, hg)lineage.MtHaplotypemotifs accumulated from the root, back mutations applied
mitoleaf.distance(t, hg, h)intlineage.mtDistance from hg's haplotype to h
mitoleaf.assign(t, h)Matchnearest haplogroup to h; ties go to the first in document order
mitoleaf.parseMotifItem(token)MotifIteminterprets one motif token
ConstantTypeValueMeans
mitoleaf.WHOLE_GENOMEstring"1-16569"the one range of every phylogeny haplotype

mitoleaf.Node

FieldHolds
id as stringhaplogroup name, e.g. "L0a1b2a"
parent as stringparent haplogroup, "" at the root
motif as list of stringtokens this node adds to its parent, verbatim
children as list of stringchild haplogroups, in document order

mitoleaf.Tree

FieldHolds
root as stringroot haplogroup, "mt-MRCA" in the published tree
nodes as map of string to Nodehaplogroup name to node, in document order

mitoleaf.MotifItem

FieldHolds
reversion as booltrue for a back mutation (A263, -5899.1)
position as intrCRS position the token names
insertion as intn for the n-th base inserted after position, else 0
designation as stringnormalised rCRS form of a gain; for a back mutation the token, trimmed and upper-cased

mitoleaf.Match

FieldHolds
haplogroup as stringhaplogroup name
distance as intlineage.mtDistance from the observed haplotype