Class: IO

IO

new IO(viewer)

Interface for reading and writing data to and from CGView

Name Type Description
viewer Viewer

Viewer

Members

viewerViewer

Get the viewer.

Methods

downloadFasta(fastaId, filename, options)

Download the map sequence in FASTA format.

Name Type Default Description
fastaId String

ID line for FASTA (i.e. text after '>')

filename String sequence.fa

Name for saved file

options Object

Options for FASTA (see Sequence.asFasta)

downloadImage(width, height, filename)

Download the currently visible map as a PNG image.

Name Type Default Description
width Number

Width of image

height Number

Height of image

filename String image.png

Name to save image file as

downloadJSON(filename, options)

Download the map as a JSON object

Name Type Default Description
filename String cgview.json

Name for saved file

options Object

Options passed to toJSON

downloadSVG(filename)

Download the currently visible map as a SVG image. Requires SVGContext external dependency: https://github.com/zenozeng/svgcanvas

Name Type Default Description
filename String image.svg

Name to save image file as

getSVG()

Return the currently visible map as a SVG string. Requires SVGCanvas external dependency: https://github.com/zenozeng/svgcanvas

loadJSON(data)

Load data from object literal or JSON string (Format details). The map data must be contained within a top level "cgview" property. Removes any previous viewer data and overrides options that are already set.

Name Type Description
data Object

JSON string or Object Literal

toJSON()

Return the CGView map as a JSON object. The JSON can later be loaded using loadJSON. See the JSON page for details on the JSON structure.

updateJSON(data)

Update old CGView JSON formats to the current version. The map data must be contained within a top level "cgview" property. This method will continue to call itself until the JSON is updated to the latest version.

Name Type Description
data Object

Object Literal