Information
Package | gql |
Description | Query language for interpreting genome SNPs |
Node Version | >= 0.4 |
Compatibility
This query language is for use with the genomejs JSON format. See the dna2json repository for more information.
Just a reminder: deletions are represented as -
!
Usage
This example will create a query that determines if a person is sickle cell effected.
var gql = ;var dna = ; var query = gql; var isMatch = ;console; // true or false
API
All of these APIs return a boolean-returning function that acts as the truth test. These functions take in one argument, a DNA-JSON object. You can nest as deep as you want, or be as basic as you want.
For example, checking if a person is immune to norovirus is pretty simple:
var dna = ; var query = gql;var isImmune = ;
Conditions
exact(id, genotype)
Evaluates to true if this was the only allele observed.
q; // will only match genotype Dq; // will only match genotype AT
has(id, genotype)
Evaluates to true if the allele was observed at all.
q; // will match GA, GAT, AB, etc.
exists(id)
Evaluates to true if any allele has been observed.
q;
doesntExist(id)
Evaluates to true if no allele has been observed.
q;
not(condition)
Inverts the result of another condition.
// evaluates to true if rs2032651 != AAvar query = q; ; // true ; // false
only(id, allele)
Evaluates to true if only the allele was observed at the specified position.
q; // will match A, AA, AAA, etc.
Aggregate Conditions
or(conditions...)
Evaluates to true if any of the given condition functions evaluate to true.
q;
and(conditions...)
Evaluates to true if all of the given condition functions evaluate to true.
q;
atLeast(number, conditions...)
Evaluates to true if the number of given condition functions evaluating to true is equal to or greater than the given number.
q;
none(conditions...)
Evaluates to true if all of the given condition functions evaluate to false.
q;
LICENSE
(MIT License)
Copyright (c) 2013 Fractal contact@wearefractal.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.