Exemple #1
0
// Create a new CGR defined by the kmerindex index and background color.
func NewCGR(index *kmerindex.Index, background color.HSVA) *CGR { // should generalise the BG color
	max := 0
	f := func(index *kmerindex.Index, _, kmer int) {
		if freq := index.FingerAt(kmer); freq > max {
			max = freq
		}
	}
	index.ForEachKmerOf(index.Seq, 0, index.Seq.Len(), f)

	k := uint(index.GetK())

	return &CGR{
		RGBA:       image.NewRGBA(image.Rect(0, 0, 1<<k, 1<<k)),
		Index:      index,
		Max:        max,
		BackGround: background,
	}
}