Package: igv
NOTE - THIS PACKAGE IS DEPRECATED AND WILL NOT BE UPDATED.  The package is now distributed as igv-jupyter.igv Jupyter ExtensionIGV is an extension forJupyter Notebookwhich
wrapsigv.js.  With this
extension you can render igv.js in a cell and call its API from
the notebook. The extension exposes a python API that mimics the igv.js
Browser creation and control APIs.   Dictionaries are used for browser and track
configuration objects.   Track data can be loaded from local or remote
URLs,  or supplied directly as lists of objects.InstallationRequirements:python >= 3.6.4jupyter >= 4.2.0pipinstalligv# To install to configuration in your home directoryjupyterserverextensionenable--pyigv
jupyternbextensioninstall--pyigv
jupyternbextensionenable--pyigv# If using a virtual environment or conda (don't forget to activatejupyterserverextensionenable--pyigv--sys-prefix
jupyternbextensioninstall--pyigv--sys-prefix
jupyternbextensionenable--pyigv--sys-prefixUsageExamplesExample notebooks are available in the github repository.   To download without cloning the repository use
thislink.   Notebooks are available in the
"examples" directory.InitializationTo insert an IGV instance into a cell:(1) create an igv.Browser object,and (2) call showBrowser on the instance.Example:importigvb=igv.Browser({"genome":"hg19"})The igv.Browser initializer takes a configuration object which is converted to JSON and passed to the igv.js
createBrowser function.   The configuration object is described in theigv.js documentation.To instantiate the client side IGV instance in a cell call show()b.show()TracksTo load a track pass a track configuration object to load_track().  Track configuration
objects are described in theigv.js documentation.
The configuration object will be converted to JSON and passed to the igv.js browser
instance.Data for the track can be loaded by URL or passed directly as an array of JSON objects.Remote URLb.load_track({"name":"Segmented CN","url":"https://data.broadinstitute.org/igvdata/test/igv-web/segmented_data_080520.seg.gz","format":"seg","indexed":False})Local FileTracks can be loaded from local files using the Jupyter web server by prepending "files" to the path.  The path
is relative to the notebook file.b.load_track({"name":"Local VCF","url":"files/data/example.vcf","format":"vcf","type":"variant","indexed":False})Embedded FeaturesFeatures can also be passed directly to tracks.b.load_track({"name":"Copy number","type":"seg","displayMode":"EXPANDED","height":100,"isLog":True,"features":[{"chr":"chr20","start":1233820,"end":1235000,"value":0.8239,"sample":"TCGA-OR-A5J2-01"},{"chr":"chr20","start":1234500,"end":1235180,"value":-0.8391,"sample":"TCGA-OR-A5J3-01"}]})NavigationZoom in by a factor of 2b.zoom_in()Zoom out by a factor of 2b.zoom_out()Jump to a specific locusb.search('chr1:3000-4000')Jump to a specific gene.  This uses the IGV search web service, which currently supports a limited number of genomes:  hg38, hg19, and mm10.
To configure a custom search service see theigv.js documentationb.search('myc')SVG outputSaving the current IGV view as an SVG image requires two calls.b.get_svg()b.display_svg()EventsNote: This is an experimental feature.deflocuschange(data):b.locus=datab.on("locuschange",locuschange)b.zoom_in()returnb.locusDevelopmentTo build and install from source:pythonsetup.pybuild
pipinstall-e.
jupyternbextensioninstall--pyigv
jupyternbextensionenable--pyigvCreating a conda environmentcondacreate-ntestpython=3.7.1
condaactivatetestcondainstallpip
condainstalljupyter