Skip to content
helgathorv edited this page Apr 20, 2016 · 24 revisions

The singleton Browser object implements the API to the IGV application. The object is created by calling the function igv.createBrowser with 2 arguments: (1) an element in which to insert the browser (usually a div), and (2) a JSON-like object defining the browser's initial state. Once created, the browser object is accessible via the global object igv.browser.

browser = igv.createBrowser(div, options);

The options object can be used to set a reference genome, track defaults, and an initial genome locus, as well as control some aspects of the user interface. Most fields are optional or have defaults. An example:

options = {
        reference: {
            id: "hg19",
            fastaURL: "//igv.broadinstitute.org/genomes/seq/1kg_v37/human_g1k_v37_decoy.fasta",
            cytobandURL: "//igv.broadinstitute.org/genomes/seq/b37/b37_cytoband.txt"
        },

        trackDefaults: {
            palette: ["#00A0B0", "#6A4A3C", "#CC333F", "#EB6841"],
            bam: {
                coverageThreshold: 0.2,
                coverageQualityWeight: true
            }
        },

        tracks: [
            {
                name: "Genes",
                url: "//igv.broadinstitute.org/annotations/hg19/genes/gencode.v18.collapsed.bed",
                index: "//igv.broadinstitute.org/annotations/hg19/genes/gencode.v18.collapsed.bed.idx",
                displayMode: "EXPANDED"
            }
        ]
    };

Browser config object

Option Description Default
reference Object defining reference sequence. See below.
showKaryo If true, whole-genome karyotype view is displayed. false
showNavigation If true, show basic navigation controls (search, zoom in, zoom out). true
tracks Array of configuration objects defining tracks initially displayed when app launches.
trackDefaults Embedded object defining default settings for specific track types (see table below).
locus Initial genomic location
flanking Distance (in bp) to pad sides of gene when navigating. 1000
search Object defining a web service for supporting search by gene or other annotation. See table below. Optional
apiKey Google API key. Optional

Reference Genome

Option Description Default
id UCSC or other id string. Optional but recommended.
fastaURL URL to an indexed FASTA file. Required if id is not in the hosted list below
indexURL URL to a FASTA index (.fai file). Optional .fai
cytobandURL URL to a cytoband ideogram file in UCSC format. Optional
indexed Flag indicating if the FASTA is indexed. Optional true

Hosted genomes. FASTA, index, and cytoband URLs can be ommitted for genomes in this list.

  • hg19
  • hg18

Search

Option Description Default
url URL to search service. The URL should include the string $FEATURE$. This string will be replaced by the symbol being searched for at runtime. Required
coords Indicates genomic coordinate convention used. Possible values are 0 and 1 1
chrField JSON field name for the chromosome property chromosome
startField JSON field name for the start position property start
endField JSON field name for the end position property end

Clone this wiki locally