Last active
October 4, 2015 21:29
-
-
Save andrawaag/6989c8c218862a912ef6 to your computer and use it in GitHub Desktop.
Differentially expressed Genes in a pathway on Insulin Signaling in case of Diabetes Mellitus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(SPARQL) | |
library(ggplot2) | |
wpSparql <- "http://sparql.wikipathways.org" | |
ebiSparql <- "https://www.ebi.ac.uk/rdf/services/atlas/sparql" | |
efoPathwaysQuery <- "PREFIX identifiers: <http://identifiers.org/ensembl/> | |
PREFIX atlas: <http://rdf.ebi.ac.uk/resource/atlas/> | |
PREFIX atlasterms: <http://rdf.ebi.ac.uk/terms/atlas/> | |
PREFIX efo: <http://www.ebi.ac.uk/efo/> | |
PREFIX foaf: <http://xmlns.com/foaf/0.1/> | |
PREFIX dcterms: <http://purl.org/dc/terms/> | |
SELECT DISTINCT ?pwIdentifier ?pwTitle ?dbxref ?experiment ?experimentPage ?experimentDescription ?difExpAnalysis ?expressionValue ?pvalue ?tstatistic WHERE { | |
SERVICE <https://www.ebi.ac.uk/rdf/services/atlas/sparql> { | |
VALUES ?efoValues {efo:EFO_0000400 efo:EFO_0001359 efo:EFO_0001360 } | |
VALUES ?pwIdentifier {<http://identifiers.org/wikipathways/WP481> } | |
?experiment dcterms:description ?experimentDescription . | |
?experiment foaf:page ?experimentPage . | |
?experiment atlasterms:hasAnalysis ?difExpAnalysis . | |
?difExpAnalysis atlasterms:hasExpressionValue ?value . | |
?factor rdf:type ?efoValues . | |
?value atlasterms:hasFactorValue ?factor . | |
?value atlasterms:isMeasurementOf ?probe . | |
?value atlasterms:pValue ?pvalue . | |
?value atlasterms:tStatistic ?tstatistic . | |
?value rdfs:label ?expressionValue . | |
?probe atlasterms:dbXref ?dbxref . | |
} | |
?pwElement dcterms:isPartOf ?pathway . | |
?pathway dc:title ?pwTitle . | |
?pathway dc:identifier ?pwIdentifier . | |
?pwElement wp:bdbEntrezGene ?dbxref . | |
} | |
" | |
tempResults <- SPARQL(wpSparql, efoPathwaysQuery) | |
tempResults$results$ensembl = gsub("\"", "", gsub(">","", gsub("<http://identifiers.org/ncbigene/", "", tempResults$results$dbxref))) | |
papertable <- as.matrix(tempResults$results) | |
View(papertable) | |
write.csv(papertable, "/tmp/WP481.csv") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment