@@ -36,7 +36,6 @@ function GoslingGenomeViz({ dataKey, showPlot, filter }) {
36
36
"spacing" : 50 ,
37
37
"views" : getViews ( data [ "data" ] )
38
38
} ;
39
- console . log ( spec ) ;
40
39
setSpec ( spec ) ;
41
40
} catch ( error ) {
42
41
console . error ( "Error fetching data:" , error ) ;
@@ -64,6 +63,16 @@ function GoslingGenomeViz({ dataKey, showPlot, filter }) {
64
63
"opacity" : { "value" : 0.4 } ,
65
64
"size" : { "value" : 4 } ,
66
65
"tracks" : [ {
66
+ "tooltip" : [
67
+ { "field" : "start" , "type" : "genomic" , "alt" : "Gene Start" } ,
68
+ { "field" : "end" , "type" : "genomic" , "alt" : "Gene End" } ,
69
+ {
70
+ "field" : "locus_tag" ,
71
+ "type" : "nominal" ,
72
+ "alt" : "Locus Tag" ,
73
+ } ,
74
+ { "field" : "product" , "alt" : "Gene Product" } ,
75
+ ] ,
67
76
68
77
"dataTransform" : [
69
78
{ "type" : "filter" , "field" : "strand" , "oneOf" : "+" }
@@ -80,7 +89,9 @@ function GoslingGenomeViz({ dataKey, showPlot, filter }) {
80
89
81
90
}
82
91
83
- const createTSSTrack = ( data , strand , title = null ) => {
92
+ const createTSSTrack = ( data , aggregatedTSS , strand , title = null ) => {
93
+ console . log ( aggregatedTSS ) ;
94
+ console . log ( data ) ;
84
95
return [
85
96
{
86
97
"title" : title ,
@@ -90,61 +101,129 @@ function GoslingGenomeViz({ dataKey, showPlot, filter }) {
90
101
"type" : "json" ,
91
102
"genomicFields" : [ "superPos" ] ,
92
103
} ,
93
- // "row": { "field": "superStrand", "type": "nominal", "domain": ["+", "-"] },
94
- // "mark": "point",
95
- // "x": { "field": "superPos", "type": "genomic", "axis": "top" },
96
104
97
105
"color" : {
98
106
"field" : "mainClass" ,
99
107
"type" : "nominal" ,
100
-
101
108
"domain" : [ "Primary" , "Secondary" , "Internal" , "Antisense" , "Orphan" ] ,
102
109
"range" : [ "#7585FF" , "#FF8A85" , "#FFC785" , "#85FFD9" , "#B285FF" ] ,
103
110
"legend" : strand === "+"
104
111
} ,
105
- "tracks" : [ {
106
- "dataTransform" : [
107
- { "type" : "filter" , "field" : "superStrand" , "oneOf" : [ strand ] }
108
- ] ,
109
- "x" : { "field" : "superPos" , "type" : "genomic" , "axis" : strand === "+" ? "top" : "none" } ,
110
- "mark" : strand === "+" ? "triangleRight" : "triangleLeft" ,
111
- "style" : { "align" : strand === "+" ? "left" : "right" } ,
112
- "size" : { "value" : 15 } ,
113
- } ,
114
- {
115
- "data" : {
116
- "values" : data . filter ( d => filter . includes ( d [ "typeTSS" ] ) ) ,
117
- "type" : "json" ,
118
- "genomicFields" : [ "superPos" ] ,
119
- "binSize" : 10 ,
120
- } ,
121
- "dataTransform" : [
122
- { "type" : "filter" , "field" : "superStrand" , "oneOf" : [ strand ] }
123
- ] ,
124
- "x" : { "field" : "superPos" , "type" : "genomic" , "aggregate" : "bin" , "axis" : "none" } ,
125
- "xe" : { "field" : "superPos" , "type" : "genomic" } ,
126
- // "size": { "value": 10 },
127
- "y" : {
128
- "field" : "mainClass" , "type" : "nominal" , "axis" : "none" ,
129
- "domain" : [ "Primary" , "Secondary" , "Internal" , "Antisense" , "Orphan" ] ,
130
- "range" : [ 50 , 50 , 50 , 50 , 50 ] ,
131
- "aggregate" : "count"
132
-
133
- } ,
134
- "mark" : "bar" ,
135
- // "y": { "type": "quantitative", "axis": "none" },
136
- } ]
112
+ "tracks" : [
113
+ {
114
+
115
+ "dataTransform" : [
116
+ { "type" : "filter" , "field" : "superStrand" , "oneOf" : [ strand ] }
117
+ ] ,
118
+ "x" : { "field" : "superPos" , "type" : "genomic" , "axis" : strand === "+" ? "top" : "none" } ,
119
+ "mark" : strand === "+" ? "triangleRight" : "triangleLeft" ,
120
+ "style" : { "align" : strand === "+" ? "left" : "right" } ,
121
+ "size" : { "value" : 15 } ,
122
+ "tooltip" : [
123
+ { "field" : "superPos" , "type" : "genomic" , "alt" : "TSS Position" } ,
124
+ {
125
+ "field" : "mainClass" ,
126
+ "type" : "nominal" ,
127
+ "alt" : "Main TSS class" ,
128
+ } ,
129
+ { "field" : "classesTSS" , "alt" : "All TSS classes" } ,
130
+ ] ,
131
+ "visibility" : [
132
+ {
133
+ "operation" : "LT" ,
134
+ "measure" : "zoomLevel" ,
135
+ "threshold" : 50000 ,
136
+ "transitionPadding" : 500 ,
137
+ "target" : "mark"
138
+ }
139
+ ]
140
+ } , ...[
141
+ { "GT" : 50000 , "LT" : 200000 , "size" : 5000 } ,
142
+ { "GT" : 200000 , "LT" : 500000 , "size" : 10000 } ,
143
+ { "GT" : 500000 , "LT" : null , "size" : 50000 } ] . map ( ( { GT , LT , size } ) => {
144
+ console . log ( GT , LT , size ) ;
145
+ return {
146
+ "data" : {
147
+ "values" : aggregatedTSS [ size ] . filter ( d => filter . includes ( d [ "typeTSS" ] ) ) ,
148
+ "type" : "json" ,
149
+ "genomicFields" : [ "binStart" , "binEnd" ] ,
150
+ } ,
151
+ "dataTransform" : [
152
+ { "type" : "filter" , "field" : "strand" , "oneOf" : [ strand ] }
153
+ ] ,
154
+ "x" : { "field" : "binStart" , "type" : "genomic" , "axis" : strand === "+" ? "top" : "none" , } ,
155
+ "xe" : { "field" : "binEnd" , "type" : "genomic" , } ,
156
+ "mark" : "bar" ,
157
+ "y" : { "field" : "count" , "type" : "quantitative" } ,
158
+ "color" : {
159
+ "field" : "mainClass" ,
160
+ "type" : "nominal" ,
161
+ "domain" : [ "Primary" , "Secondary" , "Internal" , "Antisense" , "Orphan" ] ,
162
+ "range" : [ "#7585FF" , "#FF8A85" , "#FFC785" , "#85FFD9" , "#B285FF" ] ,
163
+ "legend" : false
164
+ } ,
165
+ "tooltip" : [
166
+ { "field" : "binStart" , "type" : "genomic" , "alt" : "Bin start" } ,
167
+ {
168
+ "field" : "mainClass" ,
169
+ "type" : "nominal" ,
170
+ "alt" : "Main TSS class" ,
171
+ } ,
172
+ { "field" : "count" , "alt" : "Number of TSS" } ,
173
+ { "field" : "binEnd" , "alt" : "Bin end" } ,
174
+ ] ,
175
+ "visibility" : [
176
+ {
177
+ "operation" : "GT" ,
178
+ "measure" : "zoomLevel" ,
179
+ "threshold" : GT ,
180
+ "transitionPadding" : 10 ,
181
+ "target" : "mark"
182
+ } ,
183
+ {
184
+ "operation" : "LT" ,
185
+ "measure" : "zoomLevel" ,
186
+ "threshold" : LT ,
187
+ "transitionPadding" : 10 ,
188
+ "target" : "mark"
189
+ }
190
+ ]
191
+ }
192
+ } )
193
+
194
+ ,
195
+ // {
196
+ // "data": {
197
+ // "values": [{ "test": 1, "binStart": 12, "binEnd": 412 }],
198
+ // "type": "json",
199
+ // // "genomicFields": ["binStart", "binEnd"],
200
+
201
+ // },
202
+ // // "dataTransform": [
203
+ // // { "type": "filter", "field": "strand", "oneOf": [strand] }
204
+ // // ],
205
+ // // "x": { "field": "binStart", "type": "genomic", "axis": "none" },
206
+ // // "size": { "value": 1 },
207
+ // // "color": {
208
+ // // "field": "typeTSS",
209
+ // // "type": "nominal",
210
+ // // "domain": ["Primary", "Secondary", "Internal", "Antisense", "Orphan"],
211
+ // // "range": ["#7585FF", "#FF8A85", "#FFC785", "#85FFD9", "#B285FF"],
212
+ // // "legend": false
213
+ // // },
214
+ // "mark": "bar",
215
+ // }
216
+ ]
137
217
}
138
218
139
219
]
140
220
}
141
221
142
222
const createTracks = ( data , title ) => {
143
223
let geneTracks = createGeneTrack ( data [ "superGFF" ] ) ;
144
- let TSSTracks_plus = createTSSTrack ( data [ "TSS" ] , "+" , title ) ;
145
- let TSSTracks_minus = createTSSTrack ( data [ "TSS" ] , "-" ) ;
224
+ let TSSTracks_plus = createTSSTrack ( data [ "TSS" ] , data [ "aggregatedTSS" ] , "+" , title ) ;
225
+ let TSSTracks_minus = createTSSTrack ( data [ "TSS" ] , data [ "aggregatedTSS" ] , "-" ) ;
146
226
return TSSTracks_plus . concat ( geneTracks ) . concat ( TSSTracks_minus ) ;
147
-
148
227
}
149
228
150
229
const getViews = ( data ) => {
0 commit comments