aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2024-05-13 12:17:41 +0200
committerPjotr Prins2024-05-13 12:17:41 +0200
commit3bd6904ce66c28363bb535cc7d66d5403a388739 (patch)
tree5661a13334d9dd9848491495ed9194f5f916b9c6
parent8294b95324af7cb86b4abec6ee9d09b8684f137e (diff)
downloadgn-guile-3bd6904ce66c28363bb535cc7d66d5403a388739.tar.gz
Preparing BXD named for strain output in JSON
-rw-r--r--gn/data/strains.scm7
-rwxr-xr-xscripts/precompute/list-traits-to-compute.scm7
2 files changed, 12 insertions, 2 deletions
diff --git a/gn/data/strains.scm b/gn/data/strains.scm
index 7854cfe..06255e3 100644
--- a/gn/data/strains.scm
+++ b/gn/data/strains.scm
@@ -14,6 +14,7 @@
#:export (
strain-id-names
+ bxd-name
is-a-bxd?
has-bxd?
bxd-strain-id-names
@@ -38,7 +39,7 @@ used-for-mapping? will say whether the strains/individuals are used for mapping.
(define* (bxd-strain-id-names #:key (used-for-mapping? #f))
- "Return assoc list of tuples of strain id + names. Same as strain-id-names, but just for the BXD
+ "Return assoc list of tuples of strain id + names. Same as strain-id-names, but just for the BXD.
used-for-mapping? will say whether the strains/individuals are used for mapping. Always True, FIXME"
(filter (lambda (l) l)
@@ -53,6 +54,10 @@ used-for-mapping? will say whether the strains/individuals are used for mapping.
(define memo-bxd-strain-id-names
(memoize bxd-strain-id-names))
+(define (bxd-name strain-id)
+ "Return the name matching strain ID"
+ (assoc-ref (memo-bxd-strain-id-names) strain-id))
+
(define (is-a-bxd? strain-id)
"Is a strain a member of the BXD? For speed we memoize tuples from the DB. Note that we check the DB list, as
well as the name. This won't work for the parents. We do it this way because the GN table is wrong."
diff --git a/scripts/precompute/list-traits-to-compute.scm b/scripts/precompute/list-traits-to-compute.scm
index 07e80e9..d85a51f 100755
--- a/scripts/precompute/list-traits-to-compute.scm
+++ b/scripts/precompute/list-traits-to-compute.scm
@@ -77,7 +77,12 @@ When that is the case we might as well write the phenotype file because we have
(define (write-json id recs)
(display id)
(newline)
- (display (scm->json (reverse recs)))
+ (write (scm->json recs))
+ (write (scm->json (map (lambda (r)
+ r
+ )
+ recs)))
+ (newline)
)
(define (write-phenotypes first-id num batch-size)