events

package
v0.0.0-...-616f46f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2016 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Undef = iota
	Vic
	SympU
	SympL
	SympR
	PointL
	PointR
	FoundL
	FoundR
)

Variables

This section is empty.

Functions

func Events

func Events() []int

Events makes an event slice.

Types

type Eval

type Eval struct {
	Vics  int // Number of vicariant events
	Symp  int // Number of sympatry events
	Point int // Number of punctual sympatry events
	Found int // Number of founder events
}

Eval store the evaluation of a given reconstruction.

type Node

type Node struct {
	Node *tree.Node
	Fill bitfield.Bitfield
	Obs  bitfield.Bitfield
	SetL int
	SetR int
	Cost float64
	Flag int
}

A Node is a reconstruction of a node.

type Recons

type Recons struct {
	ID     string
	Tree   *tree.Tree
	Raster *raster.Raster
	Rec    []Node

	UseLen bool

	// events costs
	Size     float64
	SympSize float64
	VicC     float64
	SympC    float64
	PointC   float64
	FoundC   float64
}

A Recons is a reconstruction of a given raster in a particular tree.

func OR

func OR(r *raster.Raster, t *tree.Tree, size, sympSize float64, useLen bool) *Recons

OR creates an OR reconstruction based on raster and tree data. If scaled is true, then the cost at each node will be scaled by the ancestral distribution.

func Read

func Read(in io.Reader, ras *raster.Raster, ts []*tree.Tree, size, sympSize float64, useLen bool) ([]*Recons, error)

Read reads a reconstruction from one or most trees in tsv format from an input stream.

func (*Recons) Copy

func (r *Recons) Copy(cp *Recons)

Copy copies the content of cp into reconstruction r.

func (*Recons) Cost

func (r *Recons) Cost() float64

Cost returns the cost of a given reconstruction.

func (*Recons) DownPass

func (r *Recons) DownPass(n int) float64

DownPass optimize the path from node n to root.

func (*Recons) Evaluate

func (r *Recons) Evaluate() Eval

Evaluate returns an evaluation of a reconstruction.

func (*Recons) IsDiff

func (r *Recons) IsDiff(cp *Recons) bool

IsDiff returns true if the the reconstruction r is different from reconstruction cp.

func (*Recons) MakeCopy

func (r *Recons) MakeCopy() *Recons

MakeCopy creates a new copy of a reconstruction.

func (*Recons) Randomize

func (r *Recons) Randomize(prob int, evs []int)

Randomize randomizes the reconstruction using the indicated probability (as percentage).

func (*Recons) SetFoundCost

func (r *Recons) SetFoundCost(c float64)

SetFoundCost sets a new founder cost and updates the reconstruction.

func (*Recons) SetPointCost

func (r *Recons) SetPointCost(c float64)

SetPointCost sets a new point cost and updates the reconstruction.

func (*Recons) SetSympCost

func (r *Recons) SetSympCost(c float64)

SetSympCost sets a new sympatry cost and updates the reconstruction.

func (*Recons) SetVicCost

func (r *Recons) SetVicCost(c float64)

SetVicCost sets a new vicariance cost and updates the reconstruction.

func (*Recons) Write

func (r *Recons) Write(out io.Writer, header bool) error

Write writes a reconstruction in csv format on a given output stream. If header is false, no header will be printed.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL