Comments (5)
Hi, I think I may have figured out what was wrong with my isSickleCellAffected.js file. I need to instead create the query method there, constructed of gql methods, and then export it, like this:
const gql = require('gql');
module.exports = function() {
let query = gql.or([
gql.exact('rs334', 'TT'),
gql.exact('i3003137', 'AA')
]);
return query;
};
However, after doing this I instead get a TypeError saying query.stream() is not a function.
from gql.
@pvjones Not sure what version you're using, but all of the streaming stuff got removed a long time ago - you should check out the new API docs. It's more performant to load the SNP-JSON ahead of time as an object than to stream it through, so the format of the JSON and querying was changed.
So you would basically do this:
main.js
:
const dna = require('./some-genome.json')
const query = require('./isSickleCellAffected')
const matches = query(dna) // true or false
isSickleCellAffected.js
:
const gql = require('gql')
module.exports = gql.or([
gql.exact('rs334', 'TT'),
gql.exact('i3003137', 'AA')
]);
GQL is a light querying language that basically just does object checks. If you have any advanced logic (percentages, etc.) you can check the object yourself.
You could rewrite the same thing as:
dna.rs334 === 'TT' || dna.i3003137 === 'AA'
from gql.
Hey, I can't thank you enough for the help! This works like a charm now.
Next I'm going to work on a percentage-based query. If I can get this figured out, I'd like to make a bunch of these genoset files. I may (with the help of a colleague) attempt to scrape SNPedia and automate the creation of many more. If this ends up working out, would I be able to submit these for the community somewhere?
Thanks again!
from gql.
@pvjones Yep! You can publish them on NPM as genoset-*
and tag them like so (most important is the genoset ID and genoset
)
Here's the full boilerplate for a genoset module: https://github.com/genomejs/genoset-boilerplate - I'll make sure it's up to date with the latest additions now.
I'd love to get all of SNPedia published as modules that can be iterated on and used in cool projects.
from gql.
Actually no need for the boilerplate repo (deleted it), you can use this as a reference if needed: https://github.com/genomejs/genoset-norovirus
from gql.
Related Issues (8)
- Publish 0.3.0 to npm HOT 8
- naming conventions HOT 2
- Testing for deletions HOT 16
- Offer .json format export. HOT 6
- Meaning of `-` in gs syntax HOT 15
- Non-boolean results e.g. percentages HOT 3
- Can this be used to look for genes? HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gql.