Skip to content

Instantly share code, notes, and snippets.

@lubianat
Created February 15, 2022 17:23
Show Gist options
  • Save lubianat/0d1afafff6e21e1af01e70b3b08911c1 to your computer and use it in GitHub Desktop.
Save lubianat/0d1afafff6e21e1af01e70b3b08911c1 to your computer and use it in GitHub Desktop.
Wikidata Query for diseases related to beta cells via genes in common
SELECT
?cellTypeLabel ?diseaseLabel
(COUNT(DISTINCT ?diseaseGene) AS ?count)
(GROUP_CONCAT(DISTINCT ?geneLabel; SEPARATOR=", ") AS ?genes)
WHERE
{
wd:Q101405087 wdt:P8872 ?diseaseGene .
?disease wdt:P2293 ?diseaseGene .
wd:Q101405087 rdfs:label ?cellTypeLabel .
?disease rdfs:label ?diseaseLabel .
?diseaseGene rdfs:label ?geneLabel .
FILTER (LANG (?cellTypeLabel) = "en")
FILTER (LANG (?diseaseLabel) = "en")
FILTER (LANG (?geneLabel) = "en")
}
GROUP BY
?diseaseLabel ?cellTypeLabel
ORDER BY
DESC(?count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment