# How to retrieve the yeast locus tag from uniprot via sparql?

Let's say I want to retrieve the yeast-specific identifier for a certain protein, in the example below it will be P00330 which I would like to link to YOL086C.

When I go to uniprot's sparql UI and type

PREFIX up:<http://purl.uniprot.org/core/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>

SELECT *
WHERE
{
Bind(<http://purl.uniprot.org/uniprot/P00330> as ?protein).
?protein rdfs:seeAlso ?db .
?db up:database <http://purl.uniprot.org/database/SGD> .

}


it returns

protein db
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446


How would I now go on and find the YOL086C? When I add the line

?db ?p ?o


to the query above, I don't see anything that would directly lead me to the identifier.

I also tried to access another database

?db2 up:database <http://purl.uniprot.org/database/EuPathDB>


but this returns all kind of databases while I am interested only in the FungiDB. How could I select this one?

How could I link the two IDs to each other?

Ok, figured it out by looking at the scheme uniprot provides:

PREFIX up:<http://purl.uniprot.org/core/>

SELECT ?protein ?yeast_id
WHERE
{
Bind(<http://purl.uniprot.org/uniprot/P00330> as ?protein).
?protein up:encodedBy ?gene .
?gene up:locusName ?yeast_id
}


So one starts at the accession number in the middle and then uses the path to the actual locusName.

Also the path via the database works fine, I just did not use the seeAlso correctly (protein was only bound to db but not to db2, that's why it returned all entries):

PREFIX up:<http://purl.uniprot.org/core/>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>

SELECT ?protein ?db ?db2
WHERE
{
Bind(<http://purl.uniprot.org/uniprot/P00330> as ?protein).
?protein rdfs:seeAlso ?db .
?protein rdfs:seeAlso ?db2 .
?db up:database <http://purl.uniprot.org/database/SGD> .
?db2 up:database <http://purl.uniprot.org/database/EuPathDB>

}


This will return the desired output (one would still have to process the db2 entry, of course):

protein db  db2
http://purl.uniprot.org/uniprot/P00330  http://purl.uniprot.org/sgd/S000005446  http://purl.uniprot.org/eupathdb/FungiDB:YOL086C

• I am really happy to see you found your answer! Could we use this as an example query on the sparql endpoint itself? Mar 13 '18 at 13:45
• @Jerven: feel free to use it, sure! I just updated my answer to show that also the path via the database works fine; I just used it wrong.
– Cleb
Mar 13 '18 at 14:02