Documentation ¶
Overview ¶
Package phylotree implements a phylogenetic tree based on SNP and Y-STR mutations.
Index ¶
- Constants
- type Clade
- func (c *Clade) AddSample(sample Sample)
- func (c *Clade) AddSubclade(clade Clade)
- func (c *Clade) CalculateAge(gentime, calibration, offset float64)
- func (c *Clade) CalculateDistances(mutationRates genetic.YstrMarkers, distance genetic.DistanceFunc)
- func (c *Clade) CalculateModalHaplotypes()
- func (c *Clade) CalculateModalHaplotypesParsimony(statistics *genetic.MarkerStatistics, processingStage int, ...)
- func (c *Clade) InsertPersons(persons []*genetic.Person)
- func (c *Clade) Inspect(searchTerms []string) string
- func (c *Clade) Persons() []*genetic.Person
- func (c *Clade) RecalculateAge(gentime, calibration, offset float64)
- func (c *Clade) String() string
- func (c *Clade) Subclade(cladeName string) *Clade
- func (c *Clade) Trace(STRs []string) string
- type Element
- type Sample
Constants ¶
const Uncertain = -1
Uncertain is used for uncertain or unknown values.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Clade ¶
type Clade struct { Element Samples []Sample Subclades []Clade // AgeSTR shows when this Clade has formed ybp // according to a calculation using Y-STR mutations. AgeSTR float64 // STRCountDownstream is the average number of downstream STR mutations. STRCountDownstream float64 // Sigma2 is the squared standard deviation of STRCountDownstream. Sigma2 float64 // TMRCA_STR is the time to the most recent common Ancestor // for all downstream samples. TMRCA_STR float64 // TMRCAlower and TMRCAupper are the lower and upper bounds // of the 95% confidence interval. TMRCAlower float64 TMRCAupper float64 }
Clade models a haplogroup or subclade. A clade represents a node of the phylogenetic tree.
func NewFromFile ¶
NewFromFile parses a text file to create a tree. The return value Clade is the root node of the tree.
func (*Clade) AddSubclade ¶
func (*Clade) CalculateAge ¶
CalculateAge calculates the age and TMRCA for this Clade. It fills the following variables insise Clade: TMRCA_STR, AgeSTR, STRCountDownstream. gentime is the generation time in years. calibration is a calibration factor that is multiplied to the result. offset is added to all calculated ages to account for the ages of living persons. YFull currently uses an offset of 60 years.
func (*Clade) CalculateDistances ¶
func (c *Clade) CalculateDistances(mutationRates genetic.YstrMarkers, distance genetic.DistanceFunc)
CalculateDistances calculated the genetic distances between the modal haplotype of this clade and it's downstream members.
func (*Clade) CalculateModalHaplotypes ¶
func (c *Clade) CalculateModalHaplotypes()
CalculateModalHaplotypes calculates the modal haplotype for this clade and all subclades.
func (*Clade) CalculateModalHaplotypesParsimony ¶
func (c *Clade) CalculateModalHaplotypesParsimony(statistics *genetic.MarkerStatistics, processingStage int, isInfiniteAlleles bool)
CalculateModalHaplotypesParsimony calculates all modal haplotypes for this clade, using a method of maximum parsimony.
Processing stages:
0: Return without doing anything. 1: Calculate haplotypes that satisfy the maximum parsimony criterion. 2: Calculate average haplotypes using real numbers. 3: Mark results that do not have a nearest neighbor among real mutation values as Uncertain. This stage is only for visualization and debugging. 4: Replace uncertain values in the top node by using the nearest and smallest real mutation neighbor. Recalculate the tree top down to find values for previously uncertain values.
func (*Clade) InsertPersons ¶
InsertPersons traverses the tree and adds the appropriate person to a leaf if the ID of the sample and the person's ID are identical.
func (*Clade) Inspect ¶
Inspect looks at this clade and all subclades. If any of the tree nodes' SNPs match one of the search terms, a string representation of the element is added to the result.
func (*Clade) Persons ¶
Persons returns a list of all persons who belong to this clade. This includes the calculated modal haplotypes.
func (*Clade) RecalculateAge ¶
RecalculateAge performs a top town recalculation for the age and TMRCA values of this clade's subclades. The recalculation calculates a new calibration factor for each subclade so that the age of the subclade equals the TMRCA value of it's parent. This way a sublcade can never be older than it's parent.
type Element ¶
type Element struct { SNPs []string // STRCount is the number of unique STR mutations for this element. STRCount float64 // Person may be a real person from sample data // or a virtual ancestor (modal haplotype). // This may be nil. Person *genetic.Person }
Element is a node or leaf of the tree.