sparql-examples

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

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

003

Filter the positive ionization mode features of Melochia umbellate annotated as [M+H]+ by SIRIUS to keep the ones for which a feature in negative ionization mode is detected with the same retention time (± 3 seconds) and a mass corresponding to the [M-H]- adduct (± 5 ppm).

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX emi: <https://purl.org/emi#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>

SELECT DISTINCT ?feature ?rt ?pm ?feature_opp ?rt_opp ?pm_opp
WHERE {
    VALUES ?ppm {
        "5"^^xsd:decimal # m/z tolerance
    }
    VALUES ?rt_tol {
        "0.05"^^xsd:decimal # RT tolerance (minute)
    }
    ?sample a emi:ExtractSample ;
        sosa:isSampleOf* ?organe .
    ?organe emi:inTaxon ?taxon .
    ?taxon rdfs:label "melochia umbellata" .
    ?sample sosa:isFeatureOfInterestOf ?lcms .
    ?lcms a emi:LCMSAnalysisPos ;
        sosa:hasResult ?feature_list .
    ?feature_list emi:hasLCMSFeature ?feature .
    ?feature emi:hasParentMass ?pm ;
        emi:hasRetentionTime ?rt ;
        emi:hasAnnotation ?sirius .
	?sirius a emi:StructuralAnnotation ;
        prov:wasGeneratedBy ?activiy .
    ?activiy prov:wasAssociatedWith <https://bio.informatik.uni-jena.de/software/sirius> .
    ?sirius emi:hasAdduct ?adduct .
    FILTER(regex(str(?adduct), "[M+H]+"))
    ?sample sosa:isFeatureOfInterestOf ?lcms_opp .
    ?lcms_opp a emi:LCMSAnalysisNeg ;
        sosa:hasResult ?feature_list_opp .
    ?feature_list_opp emi:hasLCMSFeature ?feature_opp .
	?feature_opp emi:hasParentMass ?pm_opp ;
        emi:hasRetentionTime ?rt_opp .
    FILTER(((?rt - ?rt_tol) < ?rt_opp) && ((?rt + ?rt_tol) > ?rt_opp))
    FILTER((?pm_opp > ((?pm - 2.014) - ((?ppm * 0.000001) * (?pm - 2.014)))) && (?pm_opp < ((?pm - 2.014) + ((?ppm * 0.000001) * (?pm - 2.014)))))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v15("?activiy")
  v7("?adduct")
  v13("?feature"):::projected 
  v12("?feature_list")
  v17("?feature_list_opp")
  v18("?feature_opp"):::projected 
  v11("?lcms")
  v16("?lcms_opp")
  v9("?organe")
  v2("?pm"):::projected 
  v1("?pm_opp"):::projected 
  v8("?ppm")
  v4("?rt"):::projected 
  v6("?rt_opp"):::projected 
  v8("?rt_tol")
  v8("?sample")
  v14("?sirius")
  v10("?taxon")
  c9(["melochia umbellata"]):::literal 
  c20([https://bio.informatik.uni-jena.de/software/sirius]):::iri 
  c5(["emi:ExtractSample"]):::iri 
  c17(["emi:StructuralAnnotation"]):::iri 
  c22(["emi:LCMSAnalysisNeg"]):::iri 
  c11(["emi:LCMSAnalysisPos"]):::iri 
  f0[["?pm_opp > ?pm - '2.014^^xsd:decimal' - ?ppm * '0.000001^^xsd:decimal' * ?pm - '2.014^^xsd:decimal'?pm_opp < ?pm - '2.014^^xsd:decimal' + ?ppm * '0.000001^^xsd:decimal' * ?pm - '2.014^^xsd:decimal'"]]
  f0 --> v1
  f0 --> v2
  f0 --> v8
  f1[["?rt - ?rt_tol < ?rt_opp?rt + ?rt_tol > ?rt_opp"]]
  f1 --> v4
  f1 --> v8
  f1 --> v6
  f2[["regex(str(?adduct),'#91;M+H#93;+')"]]
  f2 --> v7
  bind3[/VALUES ?ppm/]
  bind3-->v8
  bind30(["5^^xsd:decimal"])
  bind30 --> bind3
  bind4[/VALUES ?rt_tol/]
  bind4-->v8
  bind40(["0.05^^xsd:decimal"])
  bind40 --> bind4
  v8 --"a"-->  c5
  v8 --"sosa:isSampleOf"-->  v9
  v9 --"emi:inTaxon"-->  v10
  v10 --"rdfs:label"-->  c9
  v8 --"sosa:isFeatureOfInterestOf"-->  v11
  v11 --"a"-->  c11
  v11 --"sosa:hasResult"-->  v12
  v12 --"emi:hasLCMSFeature"-->  v13
  v13 --"emi:hasParentMass"-->  v2
  v13 --"emi:hasRetentionTime"-->  v4
  v13 --"emi:hasAnnotation"-->  v14
  v14 --"a"-->  c17
  v14 --http://www.w3.org/ns/prov#wasGeneratedBy-->  v15
  v15 --http://www.w3.org/ns/prov#wasAssociatedWith-->  c20
  v14 --"emi:hasAdduct"-->  v7
  v8 --"sosa:isFeatureOfInterestOf"-->  v16
  v16 --"a"-->  c22
  v16 --"sosa:hasResult"-->  v17
  v17 --"emi:hasLCMSFeature"-->  v18
  v18 --"emi:hasParentMass"-->  v1
  v18 --"emi:hasRetentionTime"-->  v6