genomejs / gql Goto Github PK
View Code? Open in Web Editor NEWGenome query language
License: MIT License
Genome query language
License: MIT License
I assume rs2032651(-;-)
translates to exists(…)
, and rs2032651(-;A)
to has(…, 'A')
. Would be nice to have this confirmed fo sho/documented somehow.
(;)
(;-;)
(;-A)
(A;-)
(D;D)
@contra can you please push 0.3.0 to NPM? Looks like and
operation is not available in 0.2.0.
Thanks.
Can this be used to look for a particular gene? For example I have this gene I am looking for:
http://www.snpedia.com/index.php/KCNQ2
How would I go about writing a query to see if this gene exists?
Hi, first off I want to say thanks for all the amazing work that has gone into these projects (specifically gql and dna2json). I'm just starting to learn JavaScript and NodeJS. I'd like to see if I can implement a simple app using these tools. If so, then down the road (as I learn more) I hope to put together a genoset-checking and SNP-mapping tool for a project I'm working on.
That was a long introduction -- TLDR; please forgive the neophyte-level questions.
I'm doing something wrong, in trying to follow along with the examples, because nodemon is logging 'TypeError: gql.query is not a function,' where I invoke it in a 'genoset' file.
checkSNPs.js
`const fs = require('fs');
const path = require('path');
const es = require('event-stream');
const JSONStream = require('JSONStream');
exports.forGenotype = (genosetFile, jsonFile) => {
let genosetDefinition = require(./queries/${genosetFile}
)
let query = genosetDefinition();
let jsonReadStream = fs.createReadStream(jsonFile)
let genoStream = query.stream();
jsonReadStream
.pipe(JSONStream.parse('*'))
.pipe(genoStream);
let count = 0;
genoStream.on('data'),
function(snp) {
console.log('Analyzed ', ++count, ' SNPs')
}
genoStream.on('end', function() {
console.log("There are", query.matches().length, "matches for genoset 228");
console.log("There is a", query.percentage(), "percent chance that genoset matches");
});
}`
And here's my 'genoset definition' file, isSickleCellAffected.js
`const gql = require('gql');
module.exports = function() {
let query = gql.query();
query.needs(0);
query.or(query.exact('rs334', 'TT'), query.exact('i3003137', 'AA'));
return query;
};`
http://www.snpedia.com/index.php/Gs122/criteria (I’m working on a repo for this one btw) is an example of a genoset for which each criterium has a certain weight that contributes to the end result.
# gs122 looks for increased risk of baldness based on
#
# rs6625163(A;A) 1.2 (increased risk of baldness)
# rs1160312(A;A) 2 (1.6x increased risk of Male Pattern Baldness.)
# rs1160312(A;G) 2 (1.6x increased risk of Male Pattern Baldness.)
# rs201571(T;T) 2 (more likely to go bald)
# rs6036025(G;G) 1.2 (more likely to go bald)
The number e.g. the 1.2
following rs6625163(A;A)
is the magnitude value as provided by SNPedia.
Should there be a way to give each criterium a weight in gql queries? If so, any ideas on what the API should look like? Discuss.
Hey,
right now it's not possible to really export the query to maybe use it with other modules.
I imagine the format like this:
{
"needs": 2,
"query": [
{"exact": ["rs2032611": "D"]},
{"has": "rs2032623"},
{"or": [
{"exact": ["rs2023651": "D"]},
{"has": "rs20334341"}
]}
]
}
Having this would probably mean to also use this format internally, because converting those nested functions wouldn't work otherwise.
What do you think about it? I could create a PR for it.
I've started putting together a curated collection of interesting genosets and SNPs (located here). If possible, I'd like to make this useful for others in the community.
SNPedia uses the 'genoset' nomenclature for combinations of SNPs. It seems like this is usually used for gql queries, naming them 'gs103', 'gs159', etc. Are there any conventions in the genomeJS community for naming gql queries that refer to a single SNP? There are many interesting ones, such as the much-discussed "warrior vs. worrier" SNP, rs4680. This simply checks for hetero- or homozygosity at a single location. So far I've just been naming these according to their dbSNP number. But is there a better way?
Another (hopefully related) question: some of these tests would really be conveniently suited for some sort of trinary output (there might be distinct 'meanings' for homozygous A, homozygous G, or heterozygous). Has anyone discussed alternative output formats compared to simple boolean? Or is the best approach to have three separate boolean-output gql queries--i.e. 'rs4680AA', 'rs4680GG', and 'rs4680AG'?
Thanks for bearing with my pedantic questions!
What would the appropriate gql method be for testing for a deletion? Forgive me if I just missed this, but I didn't see it in the documentation. From browsing dna2json, it appears that a deletion returns a null value for the rsid?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.