aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-01-08 17:54:25 +0300
committerBonfaceKilz2024-01-08 19:23:10 +0300
commit6af08eac91a8b0d79e0cd7054e2a57e3e34c902a (patch)
tree3963f99086ebdd6c6773fc4ae753c1d5cd83fe0b
parent44b44116f53919b809033b6318467c20aa80d1b7 (diff)
downloadgenenetwork3-6af08eac91a8b0d79e0cd7054e2a57e3e34c902a.tar.gz
Optionally fetch dataset metadata if provided during probeset fetch.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rw-r--r--gn3/api/metadata.py30
1 files changed, 27 insertions, 3 deletions
diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py
index b3caa11..913d16a 100644
--- a/gn3/api/metadata.py
+++ b/gn3/api/metadata.py
@@ -896,7 +896,8 @@ CONSTRUCT {
@metadata.route("/probesets/<name>", methods=["GET"])
-def probesets(name):
+@metadata.route("/probesets/<dataset>/<name>", methods=["GET"])
+def probesets(name, dataset=""):
"""Fetch a probeset's metadata given it's name"""
try:
_query = Template("""
@@ -905,8 +906,12 @@ $prefix
CONSTRUCT {
?probeset ?predicate ?object ;
dct:references ?probesetResource ;
- dct:references ?resource .
- ?resource rdfs:label ?resourceLabel ;
+ dct:references ?resource ;
+ gnt:belongsToSpecies ?speciesShortName ;
+ gnt:belongsToGroup ?groupName ;
+ gnt:hasTissue ?tissueName ;
+ gnt:belongsToDataset ?datasetFullName .
+ ?resource rdfs:label ?resourceLabel ;
rdfs:comments ?resourceComments .
?probesetResource rdfs:label ?probesetResourceLabel ;
rdfs:comments ?probesetResourceComments .
@@ -936,6 +941,22 @@ CONSTRUCT {
?probesetResourceLink rdfs:label ?probesetResourceLabel ;
rdfs:comments ?probesetResourceComments .
} .
+ OPTIONAL {
+ ?dataset rdf:type dcat:Dataset ;
+ (rdfs:label|dct:identifier|skos:prefLabel) "HC_M2_0606_P" ;
+ (skos:altLabel|skos:prefLabel) ?datasetFullName .
+ } .
+ OPTIONAL {
+ ?dataset gnt:hasTissue ?tissue .
+ ?tissue rdfs:label ?tissueName .
+ } .
+ OPTIONAL {
+ ?inbredSet ^skos:member gnc:Set ;
+ ^gnt:belongsToGroup ?dataset ;
+ rdfs:label ?groupName ;
+ xkos:generalizes ?species .
+ ?species gnt:shortName ?speciesShortName .
+ } .
}
""").substitute(prefix=RDF_PREFIXES, name=name)
_context = {
@@ -953,6 +974,9 @@ CONSTRUCT {
"dct": "http://purl.org/dc/terms/",
"description": "dct:description",
"geneID": "gnt:hasGeneId",
+ "group": "gnt:belongsToGroup",
+ "dataset": "gnt:belongsToDataset",
+ "tissue": "gnt:hasTissue",
"kgID": "gnt:hasKgID",
"location": "gnt:location",
"mb": "gnt:mb",