Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

One of the first steps on clinical trials is the selection of the candidate eligible individuals for the study. The rules that an individual must match in order to be elected as a candidate usually involve complex queries combining clinical metadata and variants data, expressed as a list of filters with intersections (AND), unions (OR) and complementary complement (NOT).

Complex query

A complex query can be defined as a tree where each node is either a query or the intersection or union of a list of queries

To resolve solve the query, the tree has to be explored, resolve solve the leaves from the tree, and then join the results.

Query leaf node

Standard variant query.

Can be combined with sample and individual catalog query prepending queries pre-pending the query params with "sample.<sample-param>" or "individual.<individual-param>" respectively.

Code Block
languagejs
{
  "type" : QUERY,
  "query" : {
    "<query param 1>" : "<value>",
    "<query param 2>" : "<value>",
    ...
    "<query param n>" : "<value>",
  }
}

Complement node (NOT)

Code Block
languagejs
{
  "type" : COMPLEMENT 
  "nodes" : [ <node> ] 
}

Union node (OR)

Code Block
languagejs
{
   "type" : UNION
   "nodes" : [ <node1>, <node2>, ... ]
}

Intersection node (AND)

Code Block
languagejs
{
   "type" : INTERSECTION
  "nodes" : [ <node1>, <node2>, ... ]
}

Example

Plain text

Get all samples that have (a lof mutation in gene A and with HPO X) or ((a missense_variant mutation on gene B) and (a missense_variant on gene C) but not (a missense_variant on gene D))

This can be divided into 3 queries:

  • Q1
    • gene : A
    • ct : lof
    • hpo : X
  • Q2
    • gene : B
    • ct : missense_variant
  • Q3
    • gene : C
    • ct : missense_variant
  • Q4
    • gene : D
    • ct : missense_variant

These queries are combined with AND/OR like this:
Q1 OR (Q2 AND Q3 AND (NOT Q4))

Structured

This can be expressed in a JSON query like this:

{
  "type" : UNION
  "nodes" : [
    {
      "type" : QUERY,
      "query" : Q1
    } , {
      "type" : INTERSECTION
      "nodes" : [
        {
          "type" : QUERY
          "query" : Q2
        }, {
        {
          "type" : QUERY
          "query" : Q3
        }, {
          "type" : COMPLEMENT
          "nodes" : [{
            "type" : QUERY
            "query" : Q4
          }]
        },
      ]
    }
  ]
}

Implementation

Implementation details at opencga#1474.

Input

Parameters



Output

Files

Table of Contents:

Table of Contents
indent20px