diff --git a/gn/data/dataset.scm b/gn/data/dataset.scm
index afe75ba..6c2e6af 100644
--- a/gn/data/dataset.scm
+++ b/gn/data/dataset.scm
@@ -31,25 +31,38 @@
(assoc-ref (get-dataset db probesetfreeze-id) "Name"))
(define (get-dataid-from-publishxrefid id)
- "Get the internal dataid from publishxref - which is the same as used in the GN2 web interface"
+ "Get the internal dataid from publishxref - which is the same as used in the GN2 web interface. Only matches a PublishXRef backed by a public, non-confidential PublishFreeze."
(call-with-db
(lambda (db)
- (let [(query (string-append "SELECT Id,PhenotypeId,DataId FROM PublishXRef WHERE Id=" id " AND InbredSetId=1 LIMIT 1"))]
+ (let [(query (string-append "SELECT PublishXRef.Id,PublishXRef.PhenotypeId,PublishXRef.DataId "
+ "FROM PublishXRef, PublishFreeze "
+ "WHERE PublishXRef.Id=" id " AND PublishXRef.InbredSetId=1 "
+ "AND PublishFreeze.InbredSetId=PublishXRef.InbredSetId "
+ "AND PublishFreeze.public>0 AND PublishFreeze.confidentiality<1 LIMIT 1"))]
(dbi-query db query)
(pk (int-to-string (assoc-ref (get-row db) "DataId")))))))
(define (get-bxd-publish-list)
+ "List PublishXRef records for BXD (InbredSetId=1) that are backed by a public, non-confidential PublishFreeze."
(call-with-db
(lambda (db)
- (let [(query "SELECT Id,PhenotypeId,DataId FROM PublishXRef WHERE InbredSetId=1")]
+ (let [(query (string-append "SELECT PublishXRef.Id,PublishXRef.PhenotypeId,PublishXRef.DataId "
+ "FROM PublishXRef, PublishFreeze "
+ "WHERE PublishXRef.InbredSetId=1 "
+ "AND PublishFreeze.InbredSetId=PublishXRef.InbredSetId "
+ "AND PublishFreeze.public>0 AND PublishFreeze.confidentiality<1"))]
(dbi-query db query)
(get-rows db '())))))
(define* (get-bxd-publish-values-list dataid #:optional used-for-mapping?)
- "Returns dict of name values , e.g. [{\"Name\":\"C57BL/6J\",\"value\":9.136},{\"Name\":\"DBA/2J\",\"value\":4.401},{\"Name\":\"BXD9\",\"value\":4.36}, ... used-for-mapping? skips the founders and maybe other unmappable inds. Note, currently unused."
+ "Returns dict of name values , e.g. [{\"Name\":\"C57BL/6J\",\"value\":9.136},{\"Name\":\"DBA/2J\",\"value\":4.401},{\"Name\":\"BXD9\",\"value\":4.36}, ... used-for-mapping? skips the founders and maybe other unmappable inds. Note, currently unused. Only matches data backed by a public, non-confidential PublishFreeze."
(call-with-db
(lambda (db)
- (let [(query (string-append "SELECT Strain.Name, PublishData.value FROM Strain, PublishData WHERE PublishData.Id=" dataid " and Strain.Id=StrainID;"))]
+ (let [(query (string-append "SELECT Strain.Name, PublishData.value FROM Strain, PublishData, PublishXRef, PublishFreeze "
+ "WHERE PublishData.Id=" dataid " AND PublishXRef.DataId=PublishData.Id "
+ "AND PublishFreeze.InbredSetId=PublishXRef.InbredSetId "
+ "AND PublishFreeze.public>0 AND PublishFreeze.confidentiality<1 "
+ "AND Strain.Id=StrainID;"))]
(dbi-query db query)
(if used-for-mapping?
(remove null? (pk (get-rows-apply db
@@ -62,10 +75,14 @@
)))))
(define* (get-bxd-publish-dataid-name-value-dict dataid #:optional used-for-mapping?)
- "Returns dict of name values, e.g. (((\"C57BL/6J\" . 9.136) (\"DBA/2J\" . 4.401) (\"BXD9\" . 4.36) ... used-for-mapping? skips the founders and maybe other unmappable inds."
+ "Returns dict of name values, e.g. (((\"C57BL/6J\" . 9.136) (\"DBA/2J\" . 4.401) (\"BXD9\" . 4.36) ... used-for-mapping? skips the founders and maybe other unmappable inds. Only matches data backed by a public, non-confidential PublishFreeze."
(call-with-db
(lambda (db)
- (let [(query (string-append "SELECT Strain.Name, PublishData.value FROM Strain, PublishData WHERE PublishData.Id=" dataid " and Strain.Id=StrainID;"))]
+ (let [(query (string-append "SELECT Strain.Name, PublishData.value FROM Strain, PublishData, PublishXRef, PublishFreeze "
+ "WHERE PublishData.Id=" dataid " AND PublishXRef.DataId=PublishData.Id "
+ "AND PublishFreeze.InbredSetId=PublishXRef.InbredSetId "
+ "AND PublishFreeze.public>0 AND PublishFreeze.confidentiality<1 "
+ "AND Strain.Id=StrainID;"))]
(dbi-query db query)
(if used-for-mapping?
(remove null? (pk (get-rows-apply db
|