about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-12-15 21:22:56 +0300
committerMunyoki Kilyungi2023-12-15 21:22:56 +0300
commit03df1227c41918f85951d0ab50d6572d7a8a340a (patch)
tree5aa33d76d94ea7dba0a7481287da20177946c7f4
parentfab7b1003ee8fd37c5e139ee661bf6b3f25005e3 (diff)
downloadgn-transform-databases-03df1227c41918f85951d0ab50d6572d7a8a340a.tar.gz
Use URI encoding for symbol-based resource link URLs.
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
-rwxr-xr-xexamples/genelist.scm38
1 files changed, 26 insertions, 12 deletions
diff --git a/examples/genelist.scm b/examples/genelist.scm
index 0ec9ed1..2d07944 100755
--- a/examples/genelist.scm
+++ b/examples/genelist.scm
@@ -9,7 +9,8 @@
              (transform strings)
              (transform sql)
              (transform triples)
-             (transform special-forms))
+             (transform special-forms)
+             (web uri))
 
 
 (define-transformer genelist
@@ -93,7 +94,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "https://www.ebi.ac.uk/gwas/search?query="
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:ebiGwasLink"))
                "")))
     (set dct:references
@@ -110,7 +112,8 @@
                         "http://mouse.brain-map.org/search/show?search_type=gene&search_term="
                         "a gnc:abaLink"
                         (if (string=? species "mouse")
-                            (string-trim-both symbol)
+                            (uri-encode
+                             (string-trim-both symbol))
                             geneId)))
                "")))
     (set dct:references
@@ -126,7 +129,8 @@
                 (format #f
                         "<~0@*~a~1@*~a~2@*~a~3@*~a> .~%<~0@*~a~1@*~a~2@*~a~3@*~a> ~4@*~a"
                         "https://rgd.mcw.edu/rgdweb/elasticResults.html?term="
-                        symbol
+                        (uri-encode
+                         (string-trim-both symbol))
                         "&category=Gene&species="
                         (string-capitalize species)
                         "a gnc:rgdLink"))
@@ -171,7 +175,10 @@
                      (string=? species "homo-sapiens")))
                (string->symbol
                 (format #f "<~0@*~a/~1@*~a/~2@*~a> .~%<~0@*~a/~1@*~a/~2@*~a> ~3@*~a"
-                        "https://genemania.org/search" species (string-trim-both symbol)
+                        "https://genemania.org/search"
+                        species
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:genemaniaLink"))
                "")))
     (set dct:references
@@ -182,7 +189,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "http://www.pantherdb.org/genes/geneList.do?searchType=basic&fieldName=all&organism=all&listType=1&fieldValue="
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:PantherLink"))
                "")))
     (set dct:references
@@ -193,7 +201,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "http://string-db.org/newstring_cgi/show_network_section.pl?identifier="
-                        symbol
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:stringLink"))
                "")))
     (set dct:references
@@ -204,7 +213,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "https://www.gtexportal.org/home/gene/"
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:gtexLink"))
                "")))
     (set dct:references
@@ -215,7 +225,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "http://www.proteinatlas.org/search/"
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:proteinAtlasLink"))
                "")))
     (set gnt:chromosome (field GeneList Chromosome))
@@ -324,7 +335,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "http://string-db.org/newstring_cgi/show_network_section.pl?identifier="
-                        symbol
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:stringLink"))
                "")))
     (set dct:references
@@ -335,7 +347,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "https://www.gtexportal.org/home/gene/"
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:gtexLink"))
                "")))
     (set dct:references
@@ -346,7 +359,8 @@
                 (format #f
                         "<~0@*~a~1@*~a> .~%<~0@*~a~1@*~a> ~2@*~a"
                         "http://www.proteinatlas.org/search/"
-                        (string-trim-both symbol)
+                        (uri-encode
+                         (string-trim-both symbol))
                         "a gnc:proteinAtlasLink"))
                "")))
     (set rdf:type 'gnc:GeneSymbol)