[0bdad5]: / inst / queries / transcriptExpression.xq

Download this file

30 lines (29 with data), 1.7 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
; transcriptExpression
(fn [transcripts studyA subtypeA studyB subtypeB dataset]
(let [tcgaTypes
(map :value (query {:select [:value]
:from [:code]
:join [:field [:= :field_id :field.id]
:dataset [:= :dataset_id :dataset.id]]
:where [:and [:= :dataset.name "TcgaTargetGTEX_phenotype.txt"]
[:= :field.name "_sample_type"]
[:not= :value ["Control Analyte" "Solid Tissue Normal"]]]}))
fetchSamples {
"tcga" (fn [subtype]
((xena-query {:select ["sampleID"]
:from ["TcgaTargetGTEX_phenotype.txt"]
:where [:and [:in "_study" ["TCGA"]]
[:in "_sample_type" tcgaTypes]
[:in "detailed_category" [subtype]]]}) "sampleID"))
"gtex" (fn [subtype]
((xena-query {:select ["sampleID"]
:from ["TcgaTargetGTEX_phenotype.txt"]
:where [:and [:in "_study" ["GTEX"]]
[:in "_sample_type" ["Normal Tissue"]]
[:in "_primary_site" [subtype]]]}) "sampleID"))}]
[(fetch [{:table dataset
:columns transcripts
:samples ((fetchSamples studyA) subtypeA)}])
(fetch [{:table dataset
:columns transcripts
:samples ((fetchSamples studyB) subtypeB)}])]))