Documentation ¶
Overview ¶
Package cmodel provides codon evolution models.
Index ¶
- type AggMode
- type BaseModel
- func (m *BaseModel) Copy() (newM *BaseModel)
- func (m *BaseModel) ExpBranch(br int)
- func (m *BaseModel) ExpBranches()
- func (m *BaseModel) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *BaseModel) GetFloatParameters() optimize.FloatParameters
- func (m *BaseModel) GetOptimizeBranchLengths() bool
- func (m *BaseModel) GetTreeString() string
- func (m *BaseModel) Likelihood() (lnL float64)
- func (m *BaseModel) NEBPosterior(classes []float64) (res []float64)
- func (m *BaseModel) PrintPosterior(posterior []float64)
- func (m *BaseModel) ReorderAlignment()
- func (m *BaseModel) SetAdaptive(as *optimize.AdaptiveSettings)
- func (m *BaseModel) SetAggregationMode(mode AggMode)
- func (m *BaseModel) SetMaxBranchLength(maxBrLen float64)
- func (m *BaseModel) SetOptimizeBranchLengths()
- func (m *BaseModel) Summary() interface{}
- type BranchSite
- func (m *BranchSite) BEBPosterior() (res []float64)
- func (m *BranchSite) Copy() optimize.Optimizable
- func (m *BranchSite) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *BranchSite) GetNClass() int
- func (m *BranchSite) GetParameters() (kappa float64, omega0, omega2 float64, p0, p1 float64)
- func (m *BranchSite) SetDefaults()
- func (m *BranchSite) SetParameters(kappa float64, omega0, omega2 float64, p0, p1 float64)
- func (m *BranchSite) Summary() interface{}
- type BranchSiteGamma
- func (m *BranchSiteGamma) BEBPosterior() (res []float64)
- func (m *BranchSiteGamma) Copy() optimize.Optimizable
- func (m *BranchSiteGamma) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *BranchSiteGamma) GetNClass() int
- func (m *BranchSiteGamma) GetParameters() (kappa float64, omega0, omega2 float64, p0, p1 float64, alphas, alphac float64, ...)
- func (m *BranchSiteGamma) SetDefaults()
- func (m *BranchSiteGamma) SetParameters(kappa float64, omega0, omega2 float64, p0, p1 float64, alphas, alphac float64, ...)
- func (m *BranchSiteGamma) Summary() interface{}
- type Data
- type M0
- type M0G
- func (m *M0G) Copy() optimize.Optimizable
- func (m *M0G) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *M0G) GetNClass() int
- func (m *M0G) GetParameters() (kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, ...)
- func (m *M0G) SetDefaults()
- func (m *M0G) SetParameters(kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, ...)
- type M2
- func (m *M2) Copy() optimize.Optimizable
- func (m *M2) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *M2) GetNClass() int
- func (m *M2) GetParameters() (p0, p1prop, omega0, omega2, kappa, alphas, alphac float64)
- func (m *M2) SetDefaults()
- func (m *M2) SetParameters(p0, p1prop, omega0, omega2, kappa, alphas, alphac float64)
- func (m *M2) Summary() interface{}
- type M8
- func (m *M8) Copy() optimize.Optimizable
- func (m *M8) Final(neb, beb, codonRates, siteRates, codonOmega bool)
- func (m *M8) GetNClass() int
- func (m *M8) GetParameters() (p0, p, q, kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, ...)
- func (m *M8) SetDefaults()
- func (m *M8) SetParameters(p0, p, q, kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, ...)
- func (m *M8) Summary() interface{}
- type Model
- type TreeOptimizable
- type TreeOptimizableSiteClass
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggMode ¶
type AggMode int
AggMode is a type specifying aggregation mode.
const ( // No aggregation. AggNone AggMode = iota // Aggregation on all the positions. All non-observed states // are aggregated. AggObserved // Aggregation on absolutely conserved positions. All // non-observed states are aggregated. AggFixed // Aggregation on all the positions. All non-observed states // are aggregated. More general implementation. AggObservedNew // Aggregation on all the positions. Similar to observed, but // a set of non-aggregated states is shuffled between the // alignment positions. AggRandom )
Aggregation modes.
type BaseModel ¶
type BaseModel struct {
// contains filtered or unexported fields
}
BaseModel stores tree and alignment. Matrices and site classes are stored and cached as well.
func NewBaseModel ¶
NewBaseModel creates a new base Model.
func (*BaseModel) ExpBranch ¶
ExpBranch exponentiates a signle branch. This uses eigen decomposed matrices.
func (*BaseModel) ExpBranches ¶
func (m *BaseModel) ExpBranches()
ExpBranches sxponentiates all branches in the tree.
func (*BaseModel) Final ¶
Final performs analysis after optimization is complete. This implementation does nothing. This method should be implemented.
func (*BaseModel) GetFloatParameters ¶
func (m *BaseModel) GetFloatParameters() optimize.FloatParameters
GetFloatParameters returns all the optimization parameters.
func (*BaseModel) GetOptimizeBranchLengths ¶
GetOptimizeBranchLengths returns true if branch-length optimization is enabled.
func (*BaseModel) GetTreeString ¶
GetTreeString returns tree in a newick format.
func (*BaseModel) Likelihood ¶
Likelihood calculates tree likelihood.
func (*BaseModel) NEBPosterior ¶
NEBPosterior returns array (slice) of posterior probabilities for a given classes.
func (*BaseModel) PrintPosterior ¶
PrintPosterior prints results of posterior analysis.
func (*BaseModel) ReorderAlignment ¶
func (m *BaseModel) ReorderAlignment()
ReorderAlignment reorders codon alignment so order of nodes and sequences are the same. This allows faster access to sequences by their index in the array.
func (*BaseModel) SetAdaptive ¶
func (m *BaseModel) SetAdaptive(as *optimize.AdaptiveSettings)
SetAdaptive enables adaptive mode (for adaptive MCMC).
func (*BaseModel) SetAggregationMode ¶
SetAggregationMode changes the aggregation mode.
func (*BaseModel) SetMaxBranchLength ¶
SetMaxBranchLength changes the maximum branch length for the optimization.
func (*BaseModel) SetOptimizeBranchLengths ¶
func (m *BaseModel) SetOptimizeBranchLengths()
SetOptimizeBranchLengths enables branch-length optimization.
type BranchSite ¶
type BranchSite struct { *BaseModel // contains filtered or unexported fields }
BranchSite is an implementation of the branch-site model.
func NewBranchSite ¶
func NewBranchSite(data *Data, fixw2 bool) (m *BranchSite)
NewBranchSite creates a new BranchSite model.
func (*BranchSite) BEBPosterior ¶
func (m *BranchSite) BEBPosterior() (res []float64)
BEBPosterior returns BEB posterior values.
func (*BranchSite) Copy ¶
func (m *BranchSite) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*BranchSite) Final ¶
func (m *BranchSite) Final(neb, beb, codonRates, siteRates, codonOmega bool)
Final prints NEB results (only if with positive selection).
func (*BranchSite) GetNClass ¶
func (m *BranchSite) GetNClass() int
GetNClass returns number of site classes.
func (*BranchSite) GetParameters ¶
func (m *BranchSite) GetParameters() (kappa float64, omega0, omega2 float64, p0, p1 float64)
GetParameters returns the model parameter values.
func (*BranchSite) SetDefaults ¶
func (m *BranchSite) SetDefaults()
SetDefaults sets the default initial parameter values.
func (*BranchSite) SetParameters ¶
func (m *BranchSite) SetParameters(kappa float64, omega0, omega2 float64, p0, p1 float64)
SetParameters sets the model parameter values.
func (*BranchSite) Summary ¶
func (m *BranchSite) Summary() interface{}
Summary returns the run summary (site posterior for NEB and BEB).
type BranchSiteGamma ¶
type BranchSiteGamma struct { *BaseModel // contains filtered or unexported fields }
BranchSiteGamma is an implementation of the branch-site model with gamma rates variation.
func NewBranchSiteGamma ¶
func NewBranchSiteGamma(data *Data, fixw2 bool, ncatsg, ncatcg int, proportional bool) (m *BranchSiteGamma)
NewBranchSiteGamma creates a new BranchSiteGamma model.
func (*BranchSiteGamma) BEBPosterior ¶
func (m *BranchSiteGamma) BEBPosterior() (res []float64)
BEBPosterior returns BEB posterior values.
func (*BranchSiteGamma) Copy ¶
func (m *BranchSiteGamma) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*BranchSiteGamma) Final ¶
func (m *BranchSiteGamma) Final(neb, beb, codonRates, siteRates, codonOmega bool)
Final prints NEB results (only if with positive selection).
func (*BranchSiteGamma) GetNClass ¶
func (m *BranchSiteGamma) GetNClass() int
GetNClass returns number of site classes.
func (*BranchSiteGamma) GetParameters ¶
func (m *BranchSiteGamma) GetParameters() (kappa float64, omega0, omega2 float64, p0, p1 float64, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, rs1c, rs2c, ps1c, ps2c float64)
GetParameters returns the model parameter values.
func (*BranchSiteGamma) SetDefaults ¶
func (m *BranchSiteGamma) SetDefaults()
SetDefaults sets the default initial parameter values.
func (*BranchSiteGamma) SetParameters ¶
func (m *BranchSiteGamma) SetParameters(kappa float64, omega0, omega2 float64, p0, p1 float64, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, rs1c, rs2c, ps1c, ps2c float64)
SetParameters sets the model parameter values.
func (*BranchSiteGamma) Summary ¶
func (m *BranchSiteGamma) Summary() interface{}
Summary returns the run summary (site posterior for NEB and BEB).
type Data ¶
Data stores data for the codon model
func GetTreeAlignment ¶
GetTreeAlignment returns a tree and alignment for testing purposes.
func NewData ¶
func NewData(gCodeID int, alignmentFileName string, treeFileName string, cFreq string) (*Data, error)
NewData creates a new Data.
func (*Data) GetNClass1 ¶
GetNClass1 returns number of nodes with class=1.
func (*Data) SetCodonFreqFromFile ¶
SetCodonFreqFromFile sets codon frequency from file.
func (*Data) SetForegroundBranch ¶
SetForegroundBranch sets the foreground branch in a tree.
type M0 ¶
type M0 struct { *BaseModel // contains filtered or unexported fields }
M0 is an implementation of M0 model.
func (*M0) Copy ¶
func (m *M0) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*M0) GetParameters ¶
GetParameters returns the model parameter values.
func (*M0) SetDefaults ¶
func (m *M0) SetDefaults()
SetDefaults sets the default initial parameter values.
func (*M0) SetParameters ¶
SetParameters sets the model parameter values.
func (*M0) UpdateMatrix ¶
func (m *M0) UpdateMatrix()
UpdateMatrix updates Q-matrix after change in the model parameter values.
type M0G ¶
type M0G struct { *BaseModel // contains filtered or unexported fields }
M0G is an implementation of M0G model.
func (*M0G) Copy ¶
func (m *M0G) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*M0G) GetParameters ¶
func (m *M0G) GetParameters() (kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, rs1c, rs2c, ps1c, ps2c float64)
GetParameters returns the model parameter values.
func (*M0G) SetDefaults ¶
func (m *M0G) SetDefaults()
SetDefaults sets the default initial parameter values.
type M2 ¶
type M2 struct { *BaseModel // contains filtered or unexported fields }
M2 is an implementation of M1a & M2a models.
func (*M2) Copy ¶
func (m *M2) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*M2) GetParameters ¶
GetParameters returns the model parameter values.
func (*M2) SetDefaults ¶
func (m *M2) SetDefaults()
SetDefaults sets the default initial parameter values.
func (*M2) SetParameters ¶
SetParameters sets the model parameter values.
type M8 ¶
type M8 struct { *BaseModel // contains filtered or unexported fields }
M8 is an implementation of M8 model.
func (*M8) Copy ¶
func (m *M8) Copy() optimize.Optimizable
Copy makes a copy of the model preserving the model parameter values.
func (*M8) GetParameters ¶
func (m *M8) GetParameters() (p0, p, q, kappa, omega, alphas, alphac float64, rs1s, rs2s, ps1s, ps2s float64, rs1c, rs2c, ps1c, ps2c float64)
GetParameters returns the model parameter values.
func (*M8) SetDefaults ¶
func (m *M8) SetDefaults()
SetDefaults sets the default initial parameter values.
type Model ¶
type Model interface { // GetNClass returns number of site classes. GetNClass() int // contains filtered or unexported methods }
Model is an interface for the model. It provides information about number of classes and allows adding parametes.
type TreeOptimizable ¶
type TreeOptimizable interface { optimize.Optimizable // SetOptimizeBranchLengths enables branch-length optimization. SetOptimizeBranchLengths() // GetOptimizeBranchLengths returns true if branch-length // optimization is enabled. GetOptimizeBranchLengths() bool // SetAdaptive enables adaptive MCMC for the TreeOptimizable. SetAdaptive(*optimize.AdaptiveSettings) // SetMaxBranchLength changes the maximum branch length for // the optimization. SetMaxBranchLength(float64) // SetAggregationMode changes the aggregation mode. SetAggregationMode(AggMode) // GetTreeString returns tree in a newick format. GetTreeString() string // Final performs analysis after optimization is complete. Final(neb, beb, codonRates, siteRates, codonOmega bool) // Summary returns summary of the object for JSON export. Summary() interface{} }
TreeOptimizable is an extension of optimize.Optimizable which includes tree-related methods.
type TreeOptimizableSiteClass ¶
type TreeOptimizableSiteClass interface { TreeOptimizable // GetNClass returns number of site classes. GetNClass() int }
TreeOptimizableSiteClass is a special case of TreeOptimizable which has site-classes.