1:- module(uniprot,
    2          [
    3           protein/1,
    4           disease_annotation/1,
    5           has_disease_annotation/2,
    6           natural_variant_annotation/1,
    7           has_natural_variant_annotation/2,
    8           transmembrane_annotation/1,
    9           has_transmembrane_annotation/2,
   10
   11           mnemonic/2,
   12           encoded_by/2,
   13
   14           ann_begin/3,
   15
   16           in_taxon/2,
   17           in_human/1,
   18
   19           reviewed/1,
   20           annotation/2,
   21           database/2,
   22
   23           substitution/2,
   24
   25           xref/2,
   26           xref_interpro/2,
   27           xref_panther/2,
   28           xref_pro/2,
   29           is_interpro/1,
   30           is_panther/1,
   31           is_pro/1,
   32           has_full_name/2,
   33
   34           pref_label/2,
   35           recommended_name/2
   36           ]).   37
   38:- use_module(library(sparqlprog/ontologies/faldo)).   39:- use_module(library(sparqlprog)).   40
   41
   42:- rdf_register_prefix(up,'http://purl.uniprot.org/core/').   43:- rdf_register_prefix(updb,'http://purl.uniprot.org/database/').   44:- rdf_register_prefix(uniprot,'http://purl.uniprot.org/uniprot/').   45:- rdf_register_prefix(uptaxon,'http://purl.uniprot.org/taxonomy/').   46:- rdf_register_prefix(skos, 'http://www.w3.org/2004/02/skos/core#').   47:- rdf_register_prefix(embl_csd, 'http://purl.uniprot.org/embl-cds/').   48
   49
   50:- sparql_endpoint( uniprot, 'http://sparql.uniprot.org/sparql').   51
   52protein(C) :- rdf(C,rdf:type,up:'Protein').
   53
   54disease_annotation(A) :- rdf(A,rdf:type,up:'Disease_Annotation').
   55has_disease_annotation(P,A) :- annotation(P,A),rdf(A,rdf:type,up:'Disease_Annotation').
   56
   57natural_variant_annotation(A) :- rdf(A,rdf:type,up:'Natural_Variant_Annotation').
   58has_natural_variant_annotation(P,A) :- annotation(P,A),rdf(A,rdf:type,up:'Natural_Variant_Annotation').
   59
   60transmembrane_annotation(A) :- rdf(A,rdf:type,up:'Transmembrane_Annotation').
   61has_transmembrane_annotation(P,A) :- annotation(P,A),rdf(A,rdf:type,up:'Transmembrane_Annotation').
   62
   63
   64mnemonic(C,N) :- rdf(C,up:mnemonic,N).
   65encoded_by(P,G) :- rdf(P,up:encodedBy,G).
   66
   67recommended_name(P,N) :- rdf(P,up:recommendedName,N).
   68has_full_name(P,X) :- rdf(P,up:recommendedName,N), rdf(N,up:fullName,X).
   69
   70% for genes only
   71pref_label(E,N) :- rdf(E,skos:prefLabel,N).
   72
   73in_taxon(P,T) :- rdf(P,up:organism,T).
   74
   75annotation(P,A) :- rdf(P,up:annotation,A).
   76database(X,D) :- rdf(X,up:database,D).
   77
   78    
   79ann_range(P,B,E,R) :-
   80        rdf(P,up:range,I),
   81        begin_coord(I,B,R),
   82        end_coord(I,E,R).
   83ann_begin(P,B,R) :-
   84        rdf(P,up:range,I),
   85        begin_coord(I,B,R).
   86
   87substitution(A,S) :- rdf(A,up:substitution,S).
   88
   89xref(P,X) :- rdf(P,rdfs:seeAlso,X).
   90
   91:- srule(xref_interpro,[protein:uniprotPurl, xref:interproPurl ],
   92         'Maps protein to domain').   93
   94/*
   95
   96  too slow
   97  
   98xref_interpro(P,D) :- xref(P,D),str_starts(str(D),'http://purl.uniprot.org/interpro/').
   99xref_panther(P,F) :- xref(P,F),str_starts(str(F),'http://purl.uniprot.org/panther/').
  100xref_pro(P,X) :- xref(P,X),str_starts(str(X),'http://purl.obolibrary.org/obo/PR_').
  101*/
  102
  103xref_interpro(P,X) :- xref(P,X),is_interpro(X).
  104xref_panther(P,X) :- xref(P,X),is_panther(X).
  105xref_pro(P,X) :- xref(P,X),is_pro(X).
  106
  107is_interpro(X) :- database(X,updb:'InterPro').
  108is_panther(X) :- database(X,updb:'PANTHER').
  109is_pro(X) :- database(X,updb:'PRO').
  110
  111
  112
  113% convenience
  114in_human(P) :- rdf(P,up:organism,uptaxon:'9606').
  115
  116reviewed(P) :- rdf(P,up:reviewed,true^^xsd:boolean).
  117
  118
  119/*
  120
  121  in_human(P),annotation(P,A),ann_begin(A,B,R),substitution(A,\"F\")
  122
  123  
  124  */