Skip to content

Instantly share code, notes, and snippets.

@zhaofengli
Created July 8, 2017 21: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 zhaofengli/abbb5c3b7c9bfd911b6cc08af01cd0d4 to your computer and use it in GitHub Desktop.
Save zhaofengli/abbb5c3b7c9bfd911b6cc08af01cd0d4 to your computer and use it in GitHub Desktop.
SNPedia genoset criteria syntax
Start
= Comment* fc:FunctionCall Comment* { return fc }
// Function names must be at least 2 characters and must start with a lowercase letter
FunctionName
= first:[a-z] rest:[a-z0-9]i+ { return first + rest.join('') }
FunctionCall
= Ws name:FunctionName '(' Ws args:ArgumentList Ws ')' { return { type: 'FunctionCall', name, args } }
/ Ws name:FunctionName { return { type: 'FunctionCall', name, arguments: [] } }
Argument
= FunctionCall
/ Genotype
/ Base
/ Number
ArgumentList
= first:Argument rest:(Comment* Ws ',' Comment* Ws rlist:ArgumentList { return rlist })? (Ws ',')? { return rest === null ? [first] : [first].concat(rest); }
Base
= [AGCTD-]
Genotype
= allele1:Base ';' allele2:Base { return { type: 'Genotype', allele1, allele2 } }
Number
= n:[0-9]+ { return parseInt(n.join('')) }
Ws
= [ \t\r\n]*
Comment
= Ws '#' [^\r\n]* LineEnding? { return null }
/ '<!--' ( !'-->' . )* '-->'
LineEnding
= '\r\n'
/ '\r'
/ '\n'
and(
not(gs266),
atleast(2,
rs2032605(C),
rs2032606(G),
rs35460572(A),
rs2032603(A),
rs2032651(D;D),
rs2032651(A),
rs9341296(C),
rs9341296(T),
rs13304168(C),
rs13304168(T),
rs1118473(A),
rs1118473(G),
rs150173(A),
rs150173(C),
or(rs1558843(C;C),rs1558843(A;A)),
rs16980426(G),
rs16980426(T),
or(rs17222419(C;C),rs17222419(T;T)),
)
)
# [[rs1805007]](T;T),
# [[rs1805008]](T;T))
# [[rs1805009]](C;C),
or(
rs1805007(T;T),
rs1805008(T;T),
rs1805009(C;C)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment