166_batch_annotate_gene_list

rq turtle/ttl

Given a batch list of UniProt accessions, retrieve one row per entry with its recommended protein name, function description, and reviewed status in a single query. This is the classic 'annotate my differential-expression gene list' BioMart workflow (attributes=c("name","description","reviewed") in one getBM() call)

Use at

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

SELECT
  ?protein
  ?recommendedName
  (GROUP_CONCAT(?function; separator='\n') AS ?functions) ?reviewed
WHERE {
  VALUES ?protein { uniprotkb:P04637 uniprotkb:P01308 uniprotkb:Q13613 }
  ?protein up:reviewed ?reviewed .
  OPTIONAL {
    ?protein up:recommendedName ?name .
  }
  OPTIONAL {
    FILTER(!BOUND(?name))
    ?protein up:submittedName ?name .
  }
  ?name up:fullName ?recommendedName .
  OPTIONAL {
    ?protein up:annotation ?functionAnnotation .
    ?functionAnnotation a up:Function_Annotation ;
      rdfs:comment ?function .
  }
} GROUP BY ?protein ?recommendedName ?reviewed
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?function"):::projected 
  v5("?functionAnnotation")
  v7("?functions")
  v1("?name")
  v2("?protein"):::projected 
  v4("?recommendedName"):::projected 
  v3("?reviewed"):::projected 
  c7(["up:Function_Annotation"]):::iri 
  bind0[/VALUES ?protein/]
  bind0-->v2
  bind00(["uniprotkb:P04637"])
  bind00 --> bind0
  bind01(["uniprotkb:P01308"])
  bind01 --> bind0
  bind02(["uniprotkb:Q13613"])
  bind02 --> bind0
  v2 --"up:reviewed"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."up:recommendedName".->  v1
  end
  subgraph optional1["(optional)"]
  style optional1 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."up:submittedName".->  v1
  end
  v1 --"up:fullName"-->  v4
  subgraph optional2["(optional)"]
  style optional2 fill:#bbf,stroke-dasharray: 5 5;
    v2 -."up:annotation".->  v5
    v5 --"a"-->  c7
    v5 --"rdfs:comment"-->  v6
  end
  bind2[/"?function"/]
  v6 --o bind2
  bind2 --as--o v7