drawing

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultSettings = Settings{
	ShowLegend:     false,
	ShowLabels:     false,
	HideDisordered: false,
	HideMotifs:     false,
	HideAxis:       false,
	SolidFillOnly:  false,

	DomainLabelStyle: "truncated",

	SynonymousColor: "#0000ff",
	MutationColor:   "#ff0000",

	LollipopRadius: 4,
	LollipopHeight: 28,
	BackboneHeight: 14,
	MotifHeight:    18,
	DomainHeight:   24,
	Padding:        15,
	AxisPadding:    10,
	AxisHeight:     15,
	TextPadding:    5,
}

DefaultSettings contains the "standard" diagram output config and is used by the package-level Draw invocations.

View Source
var (
	FontName string
)

Functions

func BlendColorStrings

func BlendColorStrings(a, b string) string

BlendColorStrings blends two CSS #RRGGBB colors together with a straight average.

func DrawPNG

func DrawPNG(w io.Writer, dpi float64, changelist []string, g *data.GraphicResponse)

func DrawSVG

func DrawSVG(w io.Writer, changelist []string, g *data.GraphicResponse)

func LoadDefaultFont

func LoadDefaultFont() error

func LoadFont

func LoadFont(name, path string) error

Types

type Settings

type Settings struct {
	// ShowLegend adds a color-coding legend above the diagram.
	ShowLegend bool
	// ShowLabels adds mutation label text above lollipops markers.
	ShowLabels bool
	// HideDisordered hides disordered regions on the backbone even if motifs are shown.
	HideDisordered bool
	// HideMotifs hides motifs in the output image.
	HideMotifs bool
	// HideAxis hides the amino acid position axis in the output image.
	HideAxis bool

	// SolidFillOnly ensures no patterns are used in output files.
	SolidFillOnly bool

	// DomainLabelStyle determines how to deal with domain labels that do not fit
	// within the colored domain blocks. Values are "off", "fit" (only labels that
	// fully fit), and "truncated" (default, remove text to fit within).
	DomainLabelStyle string

	// SynonymousColor is the #RRGGBB color to use for synonymous mutations.
	SynonymousColor string
	// MutationColor is the #RRGGBB color to use for non-synonymous mutations.
	MutationColor string

	// LollipopRadius is the size of the marker at the top of the "stick".
	LollipopRadius float64
	// LollipopHeight is the length of the "stick" connecting the backbone to the marker.
	LollipopHeight float64
	// BackboneHeight is the thickness of the amino acid backbone.
	BackboneHeight float64
	// MotifHeight is the thickness of a motif region.
	MotifHeight float64
	// DomainHeight is the thickness of a domain region.
	DomainHeight float64
	// Padding is the amount of whitespace added to each side of the image.
	Padding float64
	// AxisPadding is the amount of whitespace added between the axis and backbone.
	AxisPadding float64
	// AxisHeight is the height of the axis tick lines.
	AxisHeight float64
	// TextPadding is the amount of whitespace between the axis line and text.
	TextPadding float64

	// GraphicWidth is the width of the image, if <=0 then it will be automatically
	// determined based on the image contents.
	GraphicWidth float64

	// GraphicHeight is automatically determined based on configured options.
	GraphicHeight float64
	// contains filtered or unexported fields
}

Settings contains all the configurable options for lollipop diagram generation.

func (*Settings) AutoWidth

func (s *Settings) AutoWidth(g *data.GraphicResponse) float64

AutoWidth automatically determines the best width to use to fit all available domain names into the plot.

func (*Settings) DrawPNG

func (s *Settings) DrawPNG(w io.Writer, dpi float64, changelist []string, g *data.GraphicResponse)

DrawPNG writes PNG image to w, with the provided changes in changelist and domain/region information in g. If GraphicWidth=0, then AutoWidth is called to determine the best diagram width to fit all labels.

func (*Settings) DrawSVG

func (s *Settings) DrawSVG(w io.Writer, changelist []string, g *data.GraphicResponse)

DrawSVG writes the SVG XML document to w, with the provided changes in changelist and domain/region information in g. If GraphicWidth=0, the AutoWidth is called to determine the best diagram width to fit all labels.

func (*Settings) MeasureFont added in v1.5.3

func (x *Settings) MeasureFont(s string, sz int) int

MeasureFont returns the pixel width of the string s at font size sz. It tries to use system Arial font if possible, but falls back to a conservative ballpark estimate otherwise.

type Tick

type Tick struct {
	Pos int
	Pri int
	Cnt int
	Col string
	// contains filtered or unexported fields
}

func (*Tick) Radius

func (t *Tick) Radius(s *Settings) float64

type TickSlice

type TickSlice []Tick

func (TickSlice) Len

func (t TickSlice) Len() int

implement sort interface

func (TickSlice) Less

func (t TickSlice) Less(i, j int) bool

func (TickSlice) NextBetter

func (t TickSlice) NextBetter(i, maxDist int) int

func (TickSlice) Swap

func (t TickSlice) Swap(i, j int)

Jump to

Keyboard shortcuts

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