A set of SPARQL examples that are used in different TGX resources
Exports pathway-gene associations formatted as input for CyTargetLinker, a Cytoscape app for link set analysis. Returns pathway names and IDs paired with HGNC gene symbols and Entrez Gene IDs.
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX fn: <http://www.w3.org/2005/xpath-functions#>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>
select distinct (str(?title) as ?PathwayName) (str(?wpid) as ?PathwayID) (fn:substring(?genename,37) as ?GeneName) (fn:substring(?ncbiGeneId,34) as ?GeneID) where {
?gene a wp:DataNode ;
dcterms:identifier ?id ;
dcterms:isPartOf ?pathwayRes ;
wp:bdbEntrezGene ?ncbiGeneId ;
wp:bdbHgncSymbol ?genename .
?pathwayRes a wp:Pathway ;
dcterms:identifier ?wpid ;
dc:title ?title .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v11("?GeneID")
v10("?GeneName")
v9("?PathwayID")
v8("?PathwayName")
v1("?gene")
v5("?genename"):::projected
v2("?id")
v4("?ncbiGeneId"):::projected
v3("?pathwayRes")
v7("?title"):::projected
v6("?wpid"):::projected
c2(["wp:DataNode"]):::iri
c7(["wp:Pathway"]):::iri
v1 --"a"--> c2
v1 --"dcterms:identifier"--> v2
v1 --"dcterms:isPartOf"--> v3
v1 --"wp:bdbEntrezGene"--> v4
v1 --"wp:bdbHgncSymbol"--> v5
v3 --"a"--> c7
v3 --"dcterms:identifier"--> v6
v3 --"dc:title"--> v7
bind0[/"str(?title)"/]
v7 --o bind0
bind0 --as--o v8
bind1[/"str(?wpid)"/]
v6 --o bind1
bind1 --as--o v9
bind2[/"substring(?genename,'37^^xsd:integer')"/]
v5 --o bind2
bind2 --as--o v10
bind3[/"substring(?ncbiGeneId,'34^^xsd:integer')"/]
v4 --o bind3
bind3 --as--o v11