Skip to content

Instantly share code, notes, and snippets.

@yochannah
Last active March 18, 2019 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yochannah/a0cace1bd91294881dad8486ba45d546 to your computer and use it in GitHub Desktop.
Save yochannah/a0cace1bd91294881dad8486ba45d546 to your computer and use it in GitHub Desktop.
sample flyatlas query
<!doctype html>
<html>
<head>
<meta name="description" content="Sample imjs query">
<script src="https://cdn.jsdelivr.net/npm/imjs@3.16.0/dist/im.js"></script>
</head>
<body>
<script>
var intermine = new imjs.Service({root: 'http://www.flymine.org/flymine/service/'});
var query = {
"name": "Gene_FlyAtlas",
"title": "Gene --> FlyAtlas expression data",
"comment": "06.06.07 updated to work from gene class - Philip",
"description": "For a given D. melanogaster gene, show expression data from FlyAtlas.",
"constraintLogic": "A and B",
"from": "Gene",
"select": [
"secondaryIdentifier",
"symbol",
"microArrayResults.mRNASignal",
"microArrayResults.mRNASignalSEM",
"microArrayResults.presentCall",
"microArrayResults.enrichment",
"microArrayResults.affyCall",
"microArrayResults.dataSets.name",
"microArrayResults.tissue.name",
"microArrayResults.type",
"microArrayResults.value",
"microArrayResults.scale",
"microArrayResults.isControl"
],
"orderBy": [
{
"path": "secondaryIdentifier",
"direction": "ASC"
}
],
"where": [
{
"path": "microArrayResults",
"type": "FlyAtlasResult"
},
{
"path": "organism.name",
"op": "=",
"value": "Drosophila melanogaster",
"code": "B",
"editable": false,
"switched": "LOCKED",
"switchable": false
},
{
"path": "Gene",
"op": "LOOKUP",
"value": "FBgn0011582",
"code": "A",
"editable": true,
"switched": "LOCKED",
"switchable": false
}
]
};
intermine.records(query).then(function(response) {
console.log(response)
});
</script>
</body>
</html>
//when embedded in HTML this would produce an im-table
//or just copy/paste the query var to re-use in your code.
var imtables = require('imtables');
var selector = '#some-elem';
var service = {root: 'http://www.flymine.org/flymine/service/'};
var query = {
"name": "Gene_FlyAtlas",
"title": "Gene --> FlyAtlas expression data",
"comment": "06.06.07 updated to work from gene class - Philip",
"description": "For a given D. melanogaster gene, show expression data from FlyAtlas.",
"constraintLogic": "A and B",
"from": "Gene",
"select": [
"secondaryIdentifier",
"symbol",
"microArrayResults.mRNASignal",
"microArrayResults.mRNASignalSEM",
"microArrayResults.presentCall",
"microArrayResults.enrichment",
"microArrayResults.affyCall",
"microArrayResults.dataSets.name",
"microArrayResults.tissue.name",
"microArrayResults.type",
"microArrayResults.value",
"microArrayResults.scale",
"microArrayResults.isControl"
],
"orderBy": [
{
"path": "secondaryIdentifier",
"direction": "ASC"
}
],
"where": [
{
"path": "microArrayResults",
"type": "FlyAtlasResult"
},
{
"path": "organism.name",
"op": "=",
"value": "Drosophila melanogaster",
"code": "B",
"editable": false,
"switched": "LOCKED",
"switchable": false
},
{
"path": "Gene",
"op": "LOOKUP",
"value": "FBgn0011582",
"code": "A",
"editable": true,
"switched": "LOCKED",
"switchable": false
}
]
};
imtables.loadTable(
selector, // Can also be an element, or a jQuery object.
{"start":0,"size":25}, // May be null
{service: service, query: query} // May be an imjs.Query
).then(
function (table) { console.log('Table loaded', table); },
function (error) { console.error('Could not load table', error); }
);
<!-- You can import this in the InterMine FlyMine querybuilder to see results -->
<query model="genomic" view="Gene.secondaryIdentifier Gene.symbol Gene.microArrayResults.mRNASignal Gene.microArrayResults.mRNASignalSEM Gene.microArrayResults.presentCall Gene.microArrayResults.enrichment Gene.microArrayResults.affyCall Gene.microArrayResults.dataSets.name Gene.microArrayResults.tissue.name Gene.microArrayResults.type Gene.microArrayResults.value Gene.microArrayResults.scale Gene.microArrayResults.isControl" sortOrder="Gene.secondaryIdentifier ASC" constraintLogic="A and B" name="Gene_FlyAtlas" >
<constraint path="Gene.microArrayResults" type="FlyAtlasResult" />
<constraint path="Gene.organism.name" op="=" value="Drosophila melanogaster" code="B" />
<constraint path="Gene" op="LOOKUP" value="FBgn0011582" code="A" />
</query>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment