about summary refs log tree commit diff
path: root/examples/dump-tissue.scm
diff options
context:
space:
mode:
authorMunyoki Kilyungi2023-05-15 21:20:50 +0300
committerBonfaceKilz2023-05-26 08:40:22 +0300
commitafaa6b096ec0df7055faafbe7f89917f734b3897 (patch)
tree2c16dc1550468018e14bd4407b5344f895b90331 /examples/dump-tissue.scm
parent79975a5dc78daa03b43d37b3fe636265c148abc0 (diff)
downloadgn-transform-databases-afaa6b096ec0df7055faafbe7f89917f734b3897.tar.gz
Replace dump.scm with separete dumps for several tables
Signed-off-by: Munyoki Kilyungi <me@bonfacemunyoki.com>
Diffstat (limited to 'examples/dump-tissue.scm')
-rwxr-xr-xexamples/dump-tissue.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/dump-tissue.scm b/examples/dump-tissue.scm
new file mode 100755
index 0000000..3d55383
--- /dev/null
+++ b/examples/dump-tissue.scm
@@ -0,0 +1,66 @@
+#! /usr/bin/env guile
+!#
+
+(use-modules (srfi srfi-1)
+             (srfi srfi-26)
+             (ice-9 match)
+             (ice-9 regex)
+             (dump strings)
+             (dump sql)
+             (dump triples)
+             (dump special-forms))
+
+
+
+(define %connection-settings
+  (call-with-input-file (list-ref (command-line) 1)
+    read))
+
+(define %dump-directory
+  (list-ref (command-line) 2))
+
+
+
+(define-dump dump-tissue
+  ;; The Name and TissueName fields seem to be identical. BIRN_lex_ID
+  ;; and BIRN_lex_Name are mostly NULL.
+  (tables (Tissue))
+  (schema-triples
+   (gn:name rdfs:range rdfs:Literal))
+  ;; Hopefully the Short_Name field is distinct and can be used as an
+  ;; identifier.
+  (triples (string->identifier "tissue" (field Tissue Short_Name))
+    (set rdf:type 'gn:tissue)
+    (set gn:name (field Tissue Name))))
+
+
+
+(call-with-target-database
+ %connection-settings
+ (lambda (db)
+   (with-output-to-file (string-append %dump-directory "dump-tissue.ttl")
+     (lambda ()
+       (prefix "chebi:" "<http://purl.obolibrary.org/obo/CHEBI_>")
+       (prefix "dct:" "<http://purl.org/dc/terms/>")
+       (prefix "foaf:" "<http://xmlns.com/foaf/0.1/>")
+       (prefix "generif:" "<http://www.ncbi.nlm.nih.gov/gene?cmd=Retrieve&dopt=Graphics&list_uids=>")
+       (prefix "gn:" "<http://genenetwork.org/>")
+       (prefix "hgnc:" "<http://bio2rdf.org/hgnc:>")
+       (prefix "homologene:" "<https://bio2rdf.org/homologene:>")
+       (prefix "kegg:" "<http://bio2rdf.org/ns/kegg#>")
+       (prefix "molecularTrait:" "<http://genenetwork.org/molecular-trait/>")
+       (prefix "nuccore:" "<https://www.ncbi.nlm.nih.gov/nuccore/>")
+       (prefix "omim:" "<https://www.omim.org/entry/>")
+       (prefix "owl:" "<http://www.w3.org/2002/07/owl#>")
+       (prefix "phenotype:" "<http://genenetwork.org/phenotype/>")
+       (prefix "pubchem:" "<https://pubchem.ncbi.nlm.nih.gov/>")
+       (prefix "pubmed:" "<http://rdf.ncbi.nlm.nih.gov/pubmed/>")
+       (prefix "rdf:" "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>")
+       (prefix "rdfs:" "<http://www.w3.org/2000/01/rdf-schema#>")
+       (prefix "taxon:" "<http://purl.uniprot.org/taxonomy/>")
+       (prefix "uniprot:" "<http://purl.uniprot.org/uniprot/>")
+       (prefix "up:" "<http://purl.uniprot.org/core/>")
+       (prefix "xsd:" "<http://www.w3.org/2001/XMLSchema#>")
+       (newline)
+       (dump-tissue db))
+     #:encoding "utf8")))