dna

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GAP_COUNT_NONE     = 0
	GAP_COUNT_INTERNAL = 1
	GAP_COUNT_ALL      = 2
)
View Source
const (
	NT_DIST_OVER = 100000
)

Variables

This section is empty.

Functions

func BuildWeightsDirichlet

func BuildWeightsDirichlet(al align.Alignment) []float64

Returns a vector of weights following a Dirichlet distribution D(n ; 1,...,1)

with n alignment length

func BuildWeightsGamma

func BuildWeightsGamma(al align.Alignment) []float64

Return a normalized vector of weights following a Gamma distribution

func DistMatrix

func DistMatrix(al align.Alignment, weights []float64, model DistModel, range1Min, range1Max, range2Min, range2Max int,
	gamma bool, alpha float64, cpus int) (outmatrix [][]float64, err error)

DistMatrix computes a matrix distance, with weights associated to each alignment positions If weights == nil, then all weights are considered 1 range1, range2: To restrict the computation to the distances between these ranges of sequence IDS, based [range1Min,range1Max] vs. [range2Min, range2Max] If range1Min, range1Max, range2Min or range2Max are -1, then computes the usual half matrix

func SimPlotDistances added in v0.4.0

func SimPlotDistances(al align.Alignment, refseq string, distmodel string, windowsize, windowstep int, group bool, splitsep string, splitfield int) (sp []struct {
	WindowStart, WindowEnd int
	CompSeq                string
	Distance               float64
}, err error)

Compute the distance for each windows between the reference sequence and all the other sequences. Can be used to draw a simplot If group is true Then extract group name from the sequence names, using splitfield and splitsep Sequences are grouped and distance from refseq is computed as the average with each group

Types

type DistModel

type DistModel interface {
	InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) error
	Distance(seq1 []uint8, seq2 []uint8, weigths []float64) (float64, error)
	Sequence(i int) ([]uint8, error)
}

func Model

func Model(modelType string, removegaps bool) (model DistModel, err error)

Returns the right model depending on the args

type F81Model

type F81Model struct {
	// contains filtered or unexported fields
}

func NewF81Model

func NewF81Model(removegaps bool) *F81Model

func (*F81Model) Distance

func (m *F81Model) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

Distance computes F81 distance between 2 sequences

func (*F81Model) InitModel

func (m *F81Model) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*F81Model) Sequence added in v0.3.4

func (m *F81Model) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

type F84Model

type F84Model struct {
	// contains filtered or unexported fields
}

func NewF84Model

func NewF84Model(removegaps bool) *F84Model

func (*F84Model) Distance

func (m *F84Model) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

computes F84 distance between 2 sequences

func (*F84Model) InitModel

func (m *F84Model) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*F84Model) Sequence added in v0.3.4

func (m *F84Model) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

type JCModel

type JCModel struct {
	// contains filtered or unexported fields
}

func NewJCModel

func NewJCModel(removegaps bool) *JCModel

func (*JCModel) Distance

func (m *JCModel) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

Distance computes JC69 distance between 2 sequences

func (*JCModel) InitModel

func (m *JCModel) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*JCModel) Sequence added in v0.3.4

func (m *JCModel) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

type K2PModel

type K2PModel struct {
	// contains filtered or unexported fields
}

func NewK2PModel

func NewK2PModel(removegaps bool) *K2PModel

func (*K2PModel) Distance

func (m *K2PModel) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

computes K2P distance between 2 sequences

func (*K2PModel) InitModel

func (m *K2PModel) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*K2PModel) Sequence added in v0.3.4

func (m *K2PModel) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

type PDistModel

type PDistModel struct {
	// contains filtered or unexported fields
}

func NewPDistModel

func NewPDistModel(removegaps bool) *PDistModel

func (*PDistModel) Distance

func (m *PDistModel) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (diff float64, err error)

computes p-distance between 2 sequences

func (*PDistModel) InitModel

func (m *PDistModel) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*PDistModel) Sequence added in v0.3.4

func (m *PDistModel) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

func (*PDistModel) SetCountGapMutations

func (m *PDistModel) SetCountGapMutations(countgapmut int) (err error)

func (*PDistModel) SetRemoveAmbiguous added in v0.3.4

func (m *PDistModel) SetRemoveAmbiguous(removeAmbiguous bool)

SetRemoveAmbiguous sets removeAmbiguous model variable if true, ambiguous positions are removed for the normalisation by the length for example: N vs. A : position not taken into account in length (can not decide wether there is a difference) R vs. Y : position taken into account in length (we know there is a difference)

type RawDistModel

type RawDistModel struct {
	// contains filtered or unexported fields
}

Like pdist, but without Normalization by the number of sites

func NewRawDistModel

func NewRawDistModel(removegaps bool) *RawDistModel

func (*RawDistModel) Distance

func (m *RawDistModel) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (diff float64, err error)

Distance computes the number of differences between 2 sequences These differences include gaps vs. nt

func (*RawDistModel) InitModel

func (m *RawDistModel) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*RawDistModel) Sequence added in v0.3.4

func (m *RawDistModel) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

func (*RawDistModel) SetCountGapMutations

func (m *RawDistModel) SetCountGapMutations(countgapmut int) (err error)

type TN82Model

type TN82Model struct {
	// contains filtered or unexported fields
}

func NewTN82Model

func NewTN82Model(removegaps bool) *TN82Model

func (*TN82Model) Distance

func (m *TN82Model) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

Distance computes TN82 distance between 2 sequences

func (*TN82Model) InitModel

func (m *TN82Model) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*TN82Model) Sequence added in v0.3.4

func (m *TN82Model) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

type TN93Model

type TN93Model struct {
	// contains filtered or unexported fields
}

func NewTN93Model

func NewTN93Model(removegaps bool) *TN93Model

func (*TN93Model) Distance

func (m *TN93Model) Distance(seq1 []uint8, seq2 []uint8, weights []float64) (float64, error)

computes TN93 distance between 2 sequences

func (*TN93Model) InitModel

func (m *TN93Model) InitModel(al align.Alignment, weights []float64, gamma bool, alpha float64) (err error)

func (*TN93Model) Sequence added in v0.3.4

func (m *TN93Model) Sequence(i int) (seq []uint8, err error)

Sequence returns the ith sequence of the alignment encoded in int

Jump to

Keyboard shortcuts

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