User talk:Pathwaybot/query examples

Request for queries edit

We are constantly looking for possible ways to combine life science data on Wikidata. Please issue any request for a SPARQL query on pathway data here, we will try to generate the relevant SPARQL query for your request(s)

Hello Pathwaybot! Egon:@Egon_Willighagen: and I:@DeSl: created this query:

\#Query to show genes and proteins encoded by genes, which are linked to a disease with OMIM ID.

SELECT DISTINCT ?pw ?pwLabel ?gene ?geneLabel ?omim ?disease ?diseaseLabel WHERE {

 ?pw wdt:P2410 ?wpid .
 { ?pw wdt:P527 ?gene . }
 UNION 
 { ?pw wdt:P527 ?protein . ?gene wdt:P688 ?protein }
 ?gene wdt:P492 ?omim .
 ?disease wdt:P492 ?omim ;
          wdt:P31 wd:Q12136 .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} ORDER BY DESC(?pw)


And a new Query from Egon:@Egon_Willighagen: and me:@DeSl:: (btw this query cannot be done for all species, we reached a time out. Perhaps the query should be optimized even more.)

\#Displays proteins with their associated component of the cell in which this protein is present SELECT DISTINCT ?protein ?proteinLabel ?cell ?cellLabel WITH {

 SELECT DISTINCT ?protein WHERE {
   ?protein wdt:P31 wd:Q8054 ; #instance of protein
            wdt:P703 wd:Q15978631 . #Restricted to species: homo sapiens
 }

} AS %result WHERE {

 INCLUDE %result
 ?protein wdt:P681 ?cell .
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} ORDER BY ?protein


And another query (this time I:@DeSl: made it myself :) ). This query lists all genes related to the biological process 'Brain development'.

\#Displays proteins which are associated with Brain development SELECT DISTINCT ?protein ?proteinLabel WHERE {

   ?protein wdt:P31 wd:Q8054  ;#instance of protein
          wdt:P703 wd:Q15978631 . #for species: Homo Sapiens
 
   ?protein wdt:P682 wd:Q14330969 #Biological process: brain development
       
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} ORDER BY ?protein


Another query, describing which amino acids are in Wikidata and in pathways from WPs linked to Wikidata.

\#defaultView:BubbleChart SELECT ?ID ?IDLabel (COUNT(DISTINCT ?PWID) AS ?count) WHERE{

?ID wdt:P279 wd:Q8066 .
?PWID wdt:P31 wd:Q4915012 . 
?PWID wdt:P527 ?ID . 
 

SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?ID ?IDLabel

Return to the user page of "Pathwaybot/query examples".