SARS-CoV-2-Queries

litHumanCoronavirusesGeneCounts.rq

Code examples: curl

SPARQL

SELECT ?virus ?virusLabel ?gene ?geneLabel ?count WITH {
  SELECT ?virus ?gene (COUNT(DISTINCT ?work) AS ?count) WHERE {
    VALUES ?virus {
      wd:Q82069695 # SARS-CoV-2
      wd:Q16983360 # HKU1
      wd:Q16991954 # OC43
      wd:Q8351095  # NL63 
      wd:Q16983356 # 229E 
      wd:Q4902157  # MERS-CoV
      wd:Q278567   # SARS-CoV
    }
    ?gene wdt:P703 ?virus ; wdt:P31 wd:Q7187 .
    ?work wdt:P921 ?gene .
  } GROUP BY ?virus ?gene
} AS %ARTICLES WHERE {
  INCLUDE %ARTICLES
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
}
ORDER BY DESC(?count)

run or edit

Output

virus gene count
human Coronavirus NL63 (edit) membrane protein (edit) 7
SARS-CoV-2 (edit) ORF8 protein (edit) 6
human Coronavirus NL63 (edit) nucleocapsid protein (edit) 3
human Coronavirus NL63 (edit) envelope protein (edit) 3
human Coronavirus NL63 (edit) spike protein (edit) 3
SARS-CoV-2 (edit) ORF7b (edit) 3
human Coronavirus NL63 (edit) ORF1a polyprotein;ORF1ab polyprotein (edit) 2
human Coronavirus NL63 (edit) protein 3 (edit) 2
Human coronavirus 229E (edit) nucleocapsid protein (edit) 2
Human coronavirus 229E (edit) surface glycoprotein (edit) 2
Human coronavirus OC43 (edit) spike surface glycoprotein (edit) 2
SARS-CoV-2 (edit) nucleocapsid phosphoprotein (edit) 2
SARS-CoV-2 (edit) ORF3a protein-encoding gene (edit) 2
SARS-CoV-2 (edit) surface glycoprotein (edit) 2
SARSr-CoV (edit) matrix protein (edit) 1
Human coronavirus 229E (edit) envelope protein (edit) 1
Human coronavirus 229E (edit) membrane protein (edit) 1
Human coronavirus 229E (edit) 4b protein (edit) 1
Human coronavirus 229E (edit) 4a protein (edit) 1
Human coronavirus HKU1 (edit) membrane glycoprotein (edit) 1
Human coronavirus HKU1 (edit) hemagglutinin-esterase glycoprotein (edit) 1
Human coronavirus HKU1 (edit) ORF1a polyprotein;ORF1ab polyprotein (edit) 1
Human coronavirus HKU1 (edit) nucleocapsid phosphoprotein (edit) 1
Human coronavirus HKU1 (edit) envelope protein (edit) 1
Human coronavirus HKU1 (edit) spike glycoprotein (edit) 1
Human coronavirus OC43 (edit) membrane protein (edit) 1
Human coronavirus OC43 (edit) I protein;nucleocapsid protein (edit) 1
Human coronavirus OC43 (edit) ns2 (edit) 1
SARS-CoV-2 (edit) ORF7a protein (edit) 1
SARS-CoV-2 (edit) membrane glycoprotein (edit) 1
SARS-CoV-2 (edit) envelope protein (edit) 1
SARS-CoV-2 (edit) ORF1a polyprotein;ORF1ab polyprotein (edit) 1

Code examples

curl

curl -s https://raw.githubusercontent.com/egonw/SARS-CoV-2-Queries/master/sparql/litHumanCoronavirusesGeneCounts.rq | sed 's+<lang/>+en+' > litHumanCoronavirusesGeneCounts.rq

curl -H "Accept: text/tab-separated-values" -G https://query.wikidata.org/bigdata/namespace/wdq/sparql --data-urlencode query@litHumanCoronavirusesGeneCounts.rq

This SPARQL query is available under CCZero.