aboutsummaryrefslogtreecommitdiff
path: root/gn3/db
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-10-20 16:37:56 +0300
committerBonfaceKilz2023-10-27 13:45:32 +0300
commitc4b77143cd763d70931871645d6eb976272d3165 (patch)
treecc2df514480134326561b6148ccd120997cc8f1b /gn3/db
parentcf67b6f54a52f06a6e244c242c3e3d221e8f059a (diff)
downloadgenenetwork3-c4b77143cd763d70931871645d6eb976272d3165.tar.gz
Implement "GET /metadata/phenotypes/:name".
* gn3/api/metadata.py: Delete gn3.db.rdf.get_phenotype_metadata. (phenotype): Rename this to ... (phenotypes): ... this and implement update logic. * gn3/db/rdf.py (get_phenotype_metadata): Delete. Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'gn3/db')
-rw-r--r--gn3/db/rdf.py47
1 files changed, 0 insertions, 47 deletions
diff --git a/gn3/db/rdf.py b/gn3/db/rdf.py
index ae0ec29..c8a5017 100644
--- a/gn3/db/rdf.py
+++ b/gn3/db/rdf.py
@@ -85,50 +85,3 @@ def get_url_local_name(string: str) -> str:
url = urlparse(string)
return unquote(url.path).rpartition("/")[-1]
return string
-
-
-def get_phenotype_metadata(
- sparql_conn: SPARQLWrapper, name: str
-):
- """Return info about a phenotype with a given NAME"""
- __metadata_query = """
-$prefix
-
-CONSTRUCT {
- ?phenotype ?pPredicate ?pValue .
- ?phenotype ?publicationTerm ?publicationValue .
- ?phenotype gn:speciesName ?speciesName .
- ?phenotype gn:inbredSetName ?inbredSetBinomialName .
- ?phenotype gn:datasetName ?datasetFullName .
-} WHERE {
- ?phenotype ?pPredicate ?pValue .
- OPTIONAL {
- ?phenotype gn:phenotypeOfPublication ?publication .
- ?publication ?publicationTerm ?publicationValue .
- } .
- OPTIONAL {
- ?phenotype gn:phenotypeOfDataset ?dataset .
- ?dataset gn:name ?datasetFullName .
- ?dataset gn:datasetOfInbredSet ?inbredSet .
- ?inbredSet gn:binomialName ?inbredSetBinomialName .
- ?inbredSet gn:inbredSetOfSpecies ?species .
- ?species gn:displayName ?speciesName .
- } .
- FILTER( ?phenotype = phenotype:$name ) .
- MINUS {
- ?phenotype rdf:type ?pValue .
- }
- MINUS {
- ?publication rdf:type ?publicationValue .
- }
-}
-"""
- result: MonadicDict = MonadicDict()
- for key, value in sparql_query(
- sparql_conn,
- Template(__metadata_query)
- .substitute(name=name,
- prefix=RDF_PREFIXES)
- )[0].items():
- result[key] = value
- return result