Exercise 8 of 17

Combine multiple conditions

Fixed training server

Count the sequences from Germany that belong to B.1.1.7 (including sublineages) and carry at least 2 of these three nucleotide mutations: T at position 241, T at position 3037, G at position 23403.

The output should have this shape:

count
-----
1234

Write a query and run it. The result is compared with the reference answer without considering row order.

Loading query editor…
Explanation

Filter the table to sequences from Germany in lineage B.1.1.7 or its sublineages. Use nOf to require at least two of the three nucleotide changes, then use groupBy without grouping columns to count the remaining rows.

Reference answer
default
  .filter(
    country = 'Germany'
    && pangoLineage.lineage('B.1.1.7', includeSublineages:=true)
    && nOf(2, {
         nucleotideEquals(position:=241, symbol:='T', sequenceName:='main'),
         nucleotideEquals(position:=3037, symbol:='T', sequenceName:='main'),
         nucleotideEquals(position:=23403, symbol:='G', sequenceName:='main')
       })
  )
  .groupBy({count:=count()})