Documentation ¶
Overview ¶
Kmer indexing package based on Bob Edgar and Gene Meyers' approach used in PALS.
Currently limited to Kmers of 15 nucleotides due to int constraints in Go.
Index ¶
- Variables
- func Distance(a, b map[Kmer]float64) (dist float64)
- func GCof(k int, kmer Kmer) float64
- func Stringify(k int, kmer Kmer) string
- type Eval
- type Index
- func (self *Index) Build()
- func (self *Index) Check() (ok bool, found int)
- func (self *Index) ComplementOf(kmer Kmer) (c Kmer)
- func (self *Index) Finger() (f []Kmer)
- func (self *Index) FingerAt(p int) int
- func (self *Index) ForEachKmerOf(s *seq.Seq, start, end int, f Eval) (err error)
- func (self *Index) GCof(kmer Kmer) float64
- func (self *Index) GetK() int
- func (self *Index) GetPositionsKmer(kmer Kmer) (positions []int, err error)
- func (self *Index) GetPositionsString(kmertext string) (positions []int, err error)
- func (self *Index) GetSeq() *seq.Seq
- func (self *Index) KmerFrequencies() (map[Kmer]int, bool)
- func (self *Index) KmerIndex() (map[Kmer][]int, bool)
- func (self *Index) KmerOf(kmertext string) (kmer Kmer, err error)
- func (self *Index) NormalisedKmerFrequencies() (map[Kmer]float64, bool)
- func (self *Index) Pos() (p []int)
- func (self *Index) PosAt(p int) int
- func (self *Index) StringKmerIndex() (map[string][]int, bool)
- func (self *Index) Stringify(kmer Kmer) string
- type Kmer
Constants ¶
This section is empty.
Variables ¶
var Debug = false // Set Debug to true to prevent recovering from panics in ForEachKmer f Eval function.
var MaxKmerLen = 15
var (
MinKmerLen = 4 // default minimum
)
Functions ¶
Types ¶
type Index ¶
Kmer index type
func (*Index) Build ¶
func (self *Index) Build()
Build the Kmer position table destructively replacing Kmer frequencies
func (*Index) Check ¶
Confirm that a Build() is correct. Returns boolean indicating this and the number of kmers indexed.
func (*Index) ComplementOf ¶
Reverse complement a Kmer
func (*Index) FingerAt ¶
Returns the value of the finger slice at p. This signifies the absolute kmer frequency of the Kmer(p) if called before Build() and points to the relevant position lookup if called after.
func (*Index) ForEachKmerOf ¶
Applies the f Eval func to all kmers in s from start to end. Returns any panic raised by f as an error.
func (*Index) GetPositionsKmer ¶
Return an array of positions for the Kmer kmer
func (*Index) GetPositionsString ¶
Return an array of positions for the Kmer string kmertext
func (*Index) KmerFrequencies ¶
Return a map containing absolute Kmer frequencies and true if called before Build(). If called after Build returns a nil map and false.
func (*Index) KmerIndex ¶
Returns a Kmer-keyed map containing slices of kmer positions and true if called after Build, otherwise nil and false.
func (*Index) KmerOf ¶
Convert a string of bases into a Kmer, returns an error if string length does not match word length
func (*Index) NormalisedKmerFrequencies ¶
Return a map containing relative Kmer frequencies and true if called before Build(). If called after Build returns a nil map and false.
func (*Index) PosAt ¶
Returns the value of the pos slice at p. This signifies the position of the pth kmer if called after Build(). Not valid before Build() - will panic.
func (*Index) StringKmerIndex ¶
Returns a string-keyed map containing slices of kmer positions and true if called after Build, otherwise nil and false.