Author: | Brent Pedersen |
---|---|
Release: | $Id$ |
Date: | December 09, 2013 |
Tags: | Python |
This code was written by Brent Pedersen.
Downloaded from https://github.com/brentp/bio-playground/blob/master/igv/igv.py on Nov.30 2011.
Bases: object
Simple wrapper to the IGV (http://www.broadinstitute.org/software/igv/home) socket interface (http://www.broadinstitute.org/software/igv/PortCommands)
requires:
- you have IGV running on your machine (launch with webstart here:
- you have enabled port communication in
View -> Preferences... -> Advanced
Successful commands return ‘OK’
example usage:
>>> igv = IGV() >>> igv.genome('hg19') 'OK'#>>> igv.load(‘http://www.broadinstitute.org/igvdata/1KG/pilot2Bams/NA12878.SLX.bam‘) ‘OK’ >>> igv.go(‘chr1:45,600-45,800’) ‘OK’
>>> igv.save('/tmp/r/region.svg')
'OK'
>>> igv.save('/tmp/r/region.png')
'OK'
>>> igv.go('muc5b')
'OK'
>>> igv.sort()
'OK'
>>> igv.save('muc5b.png')
'OK'
>>> print "\n".join(igv.commands)
snapshotDirectory /tmp/igv
genome hg19
goto chr1:45,600-45,800
snapshotDirectory /tmp/r
snapshot region.svg
snapshot region.png
goto muc5b
sort base
snapshot muc5b.png
Note, there will be some delay as the browser has to load the annotations at each step.
options is one of: base, position, strand, quality, sample, and readGroup.