Following query shows the genes located on a particular chromosome of D. melanogaster
const intermine = require('imjs');
const flymine = new intermine.Service({ root: 'www.flymine.org/query' })
flymine.rows({
from: 'Gene',
select: [
'Gene.chromosome.primaryIdentifer',
'Gene.organism.name'
]
where: [
['Gene.chromosome.primaryIdentifier', '=', '2L'],
['Gene.organism.name', '=', 'Drosophila melanogaster']
]
}).then(result => {
// Do something with the result
}).catch(err => {
// Error handling goes here
})
Template is a pre-defined query, that allows you to search the database without having to construct your own query or understanding underlying data structure. Templates generally represent some common use case scenario of the mine.
const intermine = require('imjs');
const flymine = new intermine.Service({ root: 'www.flymine.org/query' })
flymine.fetchTemplates().then(templates => {
// Print the names of the templates
Objects.keys(templates).forEach(k => console.log(k))
})
flymine.templateQuery('GO_Gene').then(query => {
// Do something with the template
console.log(query.model.name);
})