kmercolor

package
v0.0.0-...-25502c3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2012 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package to represent k-mer sequences as a color

Index

Constants

View Source
const (
	H = 1 << iota
	S
	V
	A
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CGR

type CGR KmerRainbow

A CGR produces a Chaos Game Representation of a sequence. Deschavanne (1999).

func NewCGR

func NewCGR(index *kmerindex.Index, background color.HSVA) *CGR

Create a new CGR defined by the kmerindex index and background color.

func (*CGR) Paint

func (self *CGR) Paint(vary int, desch bool, block, size int) (i *image.RGBA, err error)

Render the rainbow based on block of sequence in the index with the given size. Vary specifies which color values change in response to kmer frequency. Setting desch to true specifies using the ordering described in Deschavanne (1999).

func (*CGR) SubImage

func (self *CGR) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the original image visible through r. The returned value shares pixels with the original image.

type KmerColor

type KmerColor struct {
	color.HSVA
	// contains filtered or unexported fields
}

A KmerColor represents a kmerindex.Kmer as an HSVA, mapping the numberical value of the Kmer to a hue.

func New

func New(k int) (c *KmerColor)

Make a new KmerColor initialising the Kmer length to k.

func (*KmerColor) A

func (self *KmerColor) A(a float64) *KmerColor

Set the A value of the underlying HSVA and return the reciever.

func (*KmerColor) ColorRange

func (self *KmerColor) ColorRange(low, high imagecolor.Color)

Define the range of hues used by the KmerColor. imagecolor.Color is an alias to the core library image/color package to avoid a name conflict.

func (*KmerColor) Kmer

func (self *KmerColor) Kmer(kmer kmerindex.Kmer) *KmerColor

Set the Kmer to kmer and return the receiver.

func (*KmerColor) RGBA

func (self *KmerColor) RGBA() (r, g, b, a uint32)

Satisfy the color.Color interface. RGBA maps the kmer value to a color with the hue between the low and high color values.

func (*KmerColor) S

func (self *KmerColor) S(s float64) *KmerColor

Set the S value of the underlying HSVA and return the reciever.

func (*KmerColor) V

func (self *KmerColor) V(v float64) *KmerColor

Set the V value of the underlying HSVA and return the reciever.

type KmerRainbow

type KmerRainbow struct {
	*image.RGBA
	Index      *kmerindex.Index
	Max        int
	BackGround color.HSVA
}

A KmerRainbow produces an image reflecting the kmer distribution of a sequence.

func NewKmerRainbow

func NewKmerRainbow(r image.Rectangle, index *kmerindex.Index, background color.HSVA) *KmerRainbow

Create a new KmerRainbow defined by the rectangle r, kmerindex index and background color.

func (*KmerRainbow) Paint

func (self *KmerRainbow) Paint(vary int, block, size, left, right int) (i *image.RGBA, err error)

Render the rainbow based on block of sequence in the index with the given size. Left and right define the extent of the rendering. Vary specifies which color values change in response to kmer frequency.

func (*KmerRainbow) SubImage

func (self *KmerRainbow) SubImage(r image.Rectangle) image.Image

SubImage returns an image representing the portion of the original image visible through r. The returned value shares pixels with the original image.

Jump to

Keyboard shortcuts

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