Showing posts with label SPARQL. Show all posts
Showing posts with label SPARQL. Show all posts

Monday, April 23, 2012

Gene Wiki SPARQL endpoint

Thanks to Leyla and Alex Garcia-Castro from UniProt and Florida State University respectively, we now have access to a SPARQL endpoint for the data in the Gene Wiki.  Access it live here:
http://virtuoso.idiginfo.org/sparql
(update on 4-28-12 , that is down and a live one is currently available at
http://199.102.237.69:8890/sparql
)

Here is one query that you might like to try that finds gene-disease links that we have mined from the text:

PREFIX wiki: <http://genewikiplus.org/wiki/Special:URIResolver/>
PREFIX property: <http://genewikiplus.org/wiki/Special:URIResolver/Property-3A> 
SELECT ?gene ?disease ?gene_name ?disease_name ?doid
WHERE {
 ?gene property:Is_associated_with_disease ?disease .
 ?gene property:HasSNP ?snp .
 ?snp property:Is_associated_with_disease ?disease .
 ?gene rdfs:label ?gene_name .
 ?disease rdfs:label ?disease_name .
 ?disease rdf:type ?disease_cat .
 ?disease_cat property:HasDOID ?doid .
 ?gene rdf:type wiki:Category-3AHuman_proteins .
}

How it works in brief

  1. Articles from the Gene Wiki and from SNPedia are transferred to genewikiplus.org
  2. As they go in, they are converted into a semi-structured form that enables queries in semantic media wiki.
  3. We dump the entire thing out as one giant RDF file.
  4. Leyla loads the RDF into their Virtuoso server (and performs some enhancements such as linking directly to UniProt RDF).
  5. and wa la!
(More details about the generation of the genewiki+ are available in this soon-to-be-published paper about the SNPedia mashup and this paper about Semantic Wiki Links in Wikipedia.)

Cool next steps

The RDF has OWL:sameAs links between all the Gene Wiki entries and their RDF equivalents in DBpedia and in UniProt's RDF representation.  It should be possible to explore connections that span these three (four including SNPedia) resources using Linked Data technologies like Virtuoso's Sponger.

Go forth! Play with our data!




Wednesday, March 10, 2010

bio2rdf 2 biogps

Last Friday I had the pleasure of having lunch with with Andrew Su of the Genomics Institute of the Novartis Foundation.  Among other things, he introduced me to one of his projects called BioGPS.  BioGPS  is an interesting, kind of minimalist approach to gene-based data integration.  Essentially, it allows you to register gene-related 'plugins' that other users can assemble like an iGoogle home page.  Each plugin amounts to an html-producing url that contains  one of a variety of gene ids as a parameter.  So you might have a plugin for ncbi gene, another for kegg, etc. and they are all displayed together using a very smooth, interactive iframe canvas.

This is clearly useful to many people (they get about 150,000 pageviews/month) but its flexibility is limited by the way it currently accesses information - simply by gathering HTML from existing web pages.  Since many pages have overlapping content there is inevitably (screen)wasteful duplication in the aggregate view.  As others have said before, a little bit of semantic web could go a long way to improving this resource - and, because of the way the system is built and the way SPARQL endpoints work, its very easy to do it.

So, the idea is that you could take a sparql endpoint (that yields html as an option), write a query with a gene as a parameter, capture the url that contains the query and then you have a very specific kind of plugin that only shows precisely what information you want.  By assembling a collection of these you could produce a view on the gene information space that was very precisely tailored to individual needs.

I made a simple example of this pattern with the plugin "OMIM disorders where gene is linked to pathogenesis" which you can see in their plugin library.

It hits this endpoint
http://atlas.bio2rdf.org/sparql

with this query
 PREFIX omim: PREFIX rdfs: select distinct ?OMIM_disorder where { ?s omim:PATHOGENESIS ?o . ?o bif:contains "VEGF" . ?s rdf:type omim:GeneticDisorder . ?s rdfs:label ?OMIM_disorder }

where the VEGF would be replaced by the gene that you were researching.

Here is an example BioGPS view composed of four plugins.  My bio2rdf-sparql example is there on the top right.


To really do this properly, I think you would want to build a little helper application that would help users  compose the queries and would allow for some basic formatting options for presenting the results of these SPARQLing BioGPS plugins.

Friday, September 12, 2008

freebase ED and sparql

So what do you do when the two papers you would like to finish and submit are sitting in the hands of co-authors?  Kayaking? Sleeping?  Surfing? today, no.  Hacking? today, yes.


While I wait, I decided to finally start working on bridges between freebase and our semantic tagging repository for ED for use after the data is collected. To get started, I wrote the code to answer this question: "what URIs have been tagged with the organism classification X or any of the sub classifications of X".  For example, has anyone tagged anything with magnoliopsida or any of its lower classifications, such as arabidopsis?

To do this, I needed to utilize the 'Higher classifications' (or of course 'Lower classifications') property of the Organism Classification Type.  Unfortunately, there is, thus far, no such thing as a generic transitive property in freebase as far as I can tell, so I built a brute force, recursive query that implements it myself.  I send the following with the '???' replaced with my starting point (e.g. 'magnoliopsida') to freebase as the rest of the URL starting with http://www.freebase.com/api/service/mqlread?queries= .
{"q1":{"query":
[{
"higher_classification" : "???",
"name" : null,
"guid" : null,
"type" : "/biology/organism_classification"
}]
}}

Freebase responds with the lower classifications of my query and then I repeat the process with these until either a maximum depth is reached or it bottoms out. If you know a better way to do this please let me know.

Once I have all of the guids for all of the lower classifications of my query, I send these over to get URIs tagged with any of them via a SPARQL query like this:
prefix tag: 
prefix rdfs:
select ?tagging ?tag
where {
{
?tagging tag:associatedTag ?tag .
?tag rdfs:isDefinedBy http://www.freebase.com/view/guid/9202a8c04000641f8000000000516f8d
}
UNION
{
?tagging tag:associatedTag ?tag .
?tag rdfs:isDefinedBy http://www.freebase.com/view/guid/9202a8c04000641f800000000003be00
}
UNION
{?
tagging tag:associatedTag ?tag .
?tag rdfs:isDefinedBy http://www.freebase.com/view/guid/9202a8c04000641f800000000572e4660
}
}

The query has as many UNIONs as topics to check for. (Note that you have to put URIs in SPARQL queries inside angle brackets - blogger was making this difficult for me to include). It works well enough, but if there are too many, I hit the max URL size limit (HTTP 414) so I set it up to send them in chunks and then reassemble the results.

Hacky? Yes. Successful for demo purposes? so far..

Any ideas about optimizing such activities most appreciated.

On the todo list:
  1. Assemble the must-tag list of web services for the upcoming biomoby/ED jamboree
  2. Build up an API-like library of queries like the above and normal queries like 'get all the URIs tagged by user X' so that we can more easily put up reasonable human interfaces for users of ED2.0. (Thanks to those that have already started using it!).  Note that any developers out there already have access to all of the data needed to build ED applications via HTTP calls to freebase and to our repository.  The library I speak of will be used by us and probably made public, but the real idea is for external developers to utilize SPARQL/MQL directly as that provides the most flexibility.
  3. Create mappings between bio-ontology classes and freebase topics.  Likely follow Shawn Simister's model for approaching this integration.  (He has some excellent ideas about SPARQL/MQL integration).
  4. Prepare for kayaking trip tomorrow
  5. Graduate before they cut off my funding...

Wednesday, August 1, 2007

Connotea + Semantic Web = E.D.

What do you get when you combine social tagging with terms from web-accessible ontologies?

E.D. the Entity Describer

ED helps people use terms from ontologies* as their connotea tags.
Is it useful, interesting, a total waste of time? I'm not really sure yet, but it seemed like it would be fun. If you have some time, please do give it a try and let me know what you think! Details about installation etc. here


* Here 'ontology' just refers to any OWL/RDF document. The 'terms' are the rdfs:labels for the classes or the actual class name if the labels are missing. E.D. only "understands" rdfs:label and rdfs:subClassOf. It would make more sense to follow a SKOS model as the only semantics we plan to use are "broader-than" and "narrower-than"; but, since the large majority of OWL ontologies that we are interested in use subClassOf even when they mean skos:narrowerThan , we do the same within E.D. Support for ontologies/thesauri that are encoded with the SKOS ontology will be added as the need arises.