163_canonical_isoform_does_not_need_to_be_dash_1

rq turtle/ttl

Find reviewed proteins whose canonical isoform does not end in -1, ordered by the highest isoform number used as the canonical sequence. UniProt's up:sequence points to whichever isoform was chosen as canonical, which is not always isoform -1

Use at

PREFIX up: <http://purl.uniprot.org/core/>
PREFIX uniprotkb: <http://purl.uniprot.org/uniprot/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>

SELECT
  ?protein
  (?sequence AS ?canonicalIsoform)
  ?isoformCount
WHERE
{
  GRAPH <http://sparql.uniprot.org/uniprot> {
    ?protein up:reviewed true .
    ?protein up:sequence ?sequence .
    ?sequence a up:Simple_Sequence .
    OPTIONAL {
      ?sequence a up:External_Sequence .
      BIND(true AS ?isExternalSequence)
      BIND(SUBSTR(STR(?protein), STRLEN(STR(uniprotkb:))) AS ?proteinAc)
      FILTER(CONTAINS(STR(?sequence), ?proteinAc))
    }
    FILTER(?isExternalSequence || !BOUND(?isExternalSequence))
  }
  BIND(xsd:int(STRAFTER(STR(?sequence), "-")) AS ?isoformCount)
} ORDER BY DESC(?isoformCount)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?canonicalIsoform")
  v6("?isExternalSequence")
  v6("?isoformCount"):::projected 
  v5("?protein"):::projected 
  v6("?proteinAc")
  v3("?sequence"):::projected 
  c2(["true^^xsd:boolean"]):::literal 
  c7(["up:External_Sequence"]):::iri 
  c6(["up:Simple_Sequence"]):::iri 
  f0[["(?isExternalSequence || not bound(?isExternalSequence))"]]
  f0 --> v6
  v5 --"up:reviewed"-->  c2
  v5 --"up:sequence"-->  v3
  v3 --"a"-->  c6
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."a".->  c7
    bind1[/"'true^^xsd:boolean'"/]
    bind1 --as--o v6
    bind2[/"substring(str(?protein),string-length(str('uniprotkb:')))"/]
    v5 --o bind2
    bind2 --as--o v6
  end
  bind3[/"http://www.w3.org/2001/XMLSchema#int(substring-after(str(?sequence),'-'))"/]
  v3 --o bind3
  bind3 --as--o v6
  bind4[/"?sequence"/]
  v3 --o bind4
  bind4 --as--o v6