sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

Query_159

rq turtle/ttl

Cell lines with a *RAS (HRAS, NRAS, KRAS) in 'p.Gly12'

Use at


PREFIX cello: <https://purl.expasy.org/cellosaurus/rdf/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?cl ?cl_name ?status ?seqvar_class ?seqvar_label ?zygozity ?gene_ac ?gene_name  where {
  #values ( ?seqvar_class ?gene_ac_xsd ) { ( cello:GeneDeletion "HGNC:1787") } # HGNC accession of CDKN2A
  ?cl cello:recommendedName ?cl_name .
  ?cl cello:hasSequenceVariationInfo ?annot .
  ?annot cello:variationStatus ?status .
  ?annot cello:hasTarget ?seqvar .
  optional { ?seqvar cello:zygosity ?zygozity . }
  ?seqvar a ?seqvar_class .
  ?seqvar rdfs:label ?seqvar_label .
  ?seqvar cello:ofGene ?gene .
  ?gene cello:isIdentifiedByXref ?xref .
  ?xref cello:accession ?gene_ac .
  ?xref rdfs:label ?gene_name .
  filter(contains(?seqvar_label, 'p.Gly12')) 	# matches p.Gly12 anywere in the mutation label
  filter(regex(?gene_name, '.*RAS')) 			# matches any character followed with RAS, i.e. HRAS, NRAS, KRAS
}
order by ?cl_name
limit 5000
    
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?annot")
  v4("?cl"):::projected 
  v1("?cl_name"):::projected 
  v10("?gene")
  v12("?gene_ac"):::projected 
  v2("?gene_name"):::projected 
  v7("?seqvar")
  v9("?seqvar_class"):::projected 
  v3("?seqvar_label"):::projected 
  v6("?status"):::projected 
  v11("?xref")
  v8("?zygozity"):::projected 
  f0[["regex(?gene_name,'.*RAS')"]]
  f0 --> v2
  f1[["contains(?seqvar_label,'p.Gly12')"]]
  f1 --> v3
  v4 --"cello:recommendedName"-->  v1
  v4 --"cello:hasSequenceVariationInfo"-->  v5
  v5 --"cello:variationStatus"-->  v6
  v5 --"cello:hasTarget"-->  v7
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v7 -."cello:zygosity".->  v8
  end
  v7 --"a"-->  v9
  v7 --"rdfs:label"-->  v3
  v7 --"cello:ofGene"-->  v10
  v10 --"cello:isIdentifiedByXref"-->  v11
  v11 --"cello:accession"-->  v12
  v11 --"rdfs:label"-->  v2