SARS-CoV-2-Queries

articleCountPerGene.rq

Code examples: curl

SPARQL

#defaultView:BarChart
SELECT ?gene ?geneLabel (COUNT(?work) AS ?count) WHERE {
  ?gene wdt:P703 wd:Q82069695 ; wdt:P31 wd:Q7187 .
  ?work wdt:P921 ?gene .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en,en". }
} GROUP BY ?gene ?geneLabel
  ORDER BY ASC(?geneLabel)

run or edit

Output

gene count
ORF1a polyprotein;ORF1ab polyprotein (edit) 1
ORF3a protein-encoding gene (edit) 2
ORF7a protein (edit) 1
ORF7b (edit) 3
ORF8 protein (edit) 6
envelope protein (edit) 1
membrane glycoprotein (edit) 1
nucleocapsid phosphoprotein (edit) 2
surface glycoprotein (edit) 2

Code examples

curl

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

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

This SPARQL query is available under CCZero.