Closed dridk closed 4 years ago
happy to see that you finally got my idea !
To handle operator chaining, you will have to define operator precedance and proper AST generation/compilation. Can be dull, maybe unwanted.
I have recipes for that ; take a look at this.
Some example of VQL :
SELECT chr,pos FROM all WHERE genotype("sacha").is_hetero == True AND phenotype("sacha").blue_eye =True
CREATE setA = SELECT FROM all WHERE gene=CFTR ;
CREATE setB = all - (setA & setB)
DELETE setA
SET truc=3
SET genome=hg19
CREATE mother = SELECT FROM all WHERE genotype("mother").isHomo OR genotype("mother").isHetero;
CREATE father = SELECT FROM all WHERE genotype("father").isHomo OR genotype("mother").isHetero;
CREATE child = SELECT FROM all WHERE genotype("child").isHetero;
CREATE denovo = child - (mother & father) ;
CREATE mother = SELECT FROM all WHERE genotype("mother").isHetero
CREATE father = SELECT FROM all WHERE genotype("father").isHetero
CREATE child = SELECT FROM all WHERE genotype("child").isHomo;
CREATE recesive = child & (mother & father) ;
CREATE malade = SELECT FROM all WHERE phenotype("*").blue_eye = True AND genotype(*).isHetero
Grammar proposition :
CREATE setA FROM variant WHERE pos = 3
Model:
Selection|Creation;
Selection:
select=SelectClause from=FromClause where=WhereClause?
;
Creation:
'CREATE' id=ID from=FromClause where=WhereClause?
;
SelectClause:
'SELECT' columns*=Field[',']
;
FromClause:
'FROM' table=ID
;
WhereClause:
'WHERE' expression=Expr
;
Why not just use current VQL grammar and allow to use either SELECT or CREATE as first token ?
Yes.. I can factorize the grammar
It would be greate to have a grammar to create set . For instance, to select de novo mutation ( present only in child )
It will perform the following query :