Last active
January 31, 2017 18:14
-
-
Save nathandunn/8449f35d59bdcb0d67e80b6db012b303 to your computer and use it in GitHub Desktop.
Grabs nclist from remote and local server data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JBrowse - Retrieve data outside of browser</title> | |
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> | |
<link rel="stylesheet" type="text/css" href="css/genome.css"> | |
<script type="text/javascript" src="src/dojo/dojo.js" data-dojo-config="async: 1, baseUrl: './src'"></script> | |
<script type="text/javascript" src="src/JBrowse/init.js"></script> | |
<style> | |
pre { | |
white-space: pre-wrap; | |
word-wrap: break-word; | |
} | |
</style> | |
<script> | |
// Require bare bones jbrowse components without using the main browser object | |
require([ | |
'JBrowse/Browser', | |
'JBrowse/Store/SeqFeature/GFF3Tabix', | |
'JBrowse/Store/SeqFeature/NCList', | |
'JBrowse/Model/SimpleFeature', | |
'JBrowse/Store/Sequence/StaticChunked', | |
'JBrowse/View/Export', | |
'JBrowse/View/Export/GFF3', | |
'JBrowse/View/Export/FASTA' | |
], | |
function (Browser, | |
GFF3Tabix, | |
NCList, | |
SimpleFeature, | |
StaticChunkedSequence, | |
ExportMixin, | |
GFF3Mixin, | |
FastaMixin) { | |
var getGFF = function (conf, region, callback) { | |
var conf = dojo.mixin({ | |
storeClass: 'JBrowse/Store/SeqFeature/NCList' | |
}, conf); | |
var store = new NCList(conf); | |
store.refSeq = {}; | |
store.refSeq.name = region.refseq; | |
var exp = new dojo.declare([ExportMixin, GFF3Mixin])({store: store}); | |
exp.exportRegion({ref: region.refseq, start: region.start, end: region.end}, callback); | |
}; | |
var getNCList = function (conf, region, callback) { | |
var conf = dojo.mixin({ | |
storeClass: 'JBrowse/Store/SeqFeature/NCList' | |
}, conf); | |
var store = new NCList(conf); | |
store.refSeq = {}; | |
store.refSeq.name = region.refseq; | |
var query = {ref: region.refseq, start: region.start, end: region.end}; | |
store.getFeatures(query, callback) | |
}; | |
// Initialize jbrowse instance in unittestmode so that it doesn't actually draw the browser to screen | |
var browser = new Browser({unitTestMode: true}); | |
// standard mode | |
// var region = {start: 110548, end: 113863, refseq: 'chrI'}; | |
// var url = 'jbrowse/sample_data/json/yeast/tracks/Genes/{refseq}/trackData.json'; | |
// CORS issues | |
// var region = {start: 724017, end: 726601, refseq: 'Group1.1'}; | |
// var url = 'https://genome.monarchinitiative.org/apollo/Honeybee/jbrowse/data/tracks/Official%20Gene%20Set%20v3.2/{refseq}/trackData.json'; | |
var region = {start: 6884146, end: 6889697, refseq: 'III'}; | |
// var url = 'http://www.wormbase.org/tools/genome/jbrowse/data/c_elegans_PRJNA13758/tracks/Curated_Genes/{refseq}/trackData.jsonz'; | |
var url = 'http://agrjbrowse.s3-website-us-east-1.amazonaws.com/WormBase/c_elegans_PRJNA13758/tracks/Curated_Genes/{refseq}/trackData.jsonz'; | |
getGFF({ | |
urlTemplate: url, | |
label: 'Genes', | |
browser: browser | |
}, region, function (features) { | |
document.getElementById('gff').innerHTML = features; | |
}); | |
getNCList({ | |
urlTemplate: url, | |
label: 'Genes', | |
browser: browser | |
}, region, function (features) { | |
document.getElementById('nclist').innerHTML += features; | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>JBrowse gff store access outside of browser</h1> | |
<pre id="gff"></pre> | |
<h1>JBrowse store nclist</h1> | |
<pre id="nclist"></pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment