@@ -2,21 +2,21 @@ import React from 'react';
2
2
import Row from 'react-bootstrap/Row' ;
3
3
import Col from 'react-bootstrap/Col'
4
4
import Container from 'react-bootstrap/esm/Container' ;
5
- import { Tabs , Tab } from "react-bootstrap" ;
5
+ import { Tabs , Tab , Card } from "react-bootstrap" ;
6
6
import { DataSetSelector } from './sidebar/DataSet/dataset_selector' ;
7
7
import SelectionView from './sidebar/selection/selection' ;
8
8
import { DataSetMeta } from './sidebar/DataSet/dataset_metadata' ;
9
9
import Scatter3D from './scatterplot3d/scatter3d' ;
10
10
import PCAPlot from './sidebar/PCAPlot/PCAPlot' ;
11
11
import { FilterUI } from './sidebar/Filters/filterui' ;
12
12
import Table from './sidebar/DiamondTable/diamondtable' ;
13
- import { TableView } from './tableview/TableView' ;
14
13
import ScatterMatrix from './sidebar/ScatterMatrix/ScatterMatrix' ;
15
14
16
15
// Stylesheet
17
16
import 'bootstrap/dist/css/bootstrap.min.css' ;
18
17
import 'bootstrap-icons/font/bootstrap-icons.css' ;
19
- import { fetchTaxaminerMain , fetchTaxaminerScatterplot , fetchTaxaminerSeq } from '../../../../../../api' ;
18
+ import { fetchTaxaminerScatterplot , fetchTaxaminerSeq } from '../../../../../../api' ;
19
+ import { TableView } from './tableview' ;
20
20
21
21
22
22
interface State {
@@ -36,6 +36,7 @@ interface State {
36
36
token : string
37
37
fields : string [ ]
38
38
g_options : { label : string ; value : string ; } [ ]
39
+ customFields : any [ ]
39
40
scatter_points : any
40
41
is_loading : boolean
41
42
}
@@ -71,6 +72,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
71
72
token : token ,
72
73
fields : [ ] ,
73
74
g_options : [ ] ,
75
+ customFields : [ ] ,
74
76
scatter_points : [ ] ,
75
77
is_loading : false
76
78
}
@@ -88,22 +90,20 @@ class TaxaminerDashboard extends React.Component<Props, State> {
88
90
this . setState ( { is_loading : true } )
89
91
this . setState ( { dataset_id : id } , ( ) => {
90
92
fetchTaxaminerScatterplot ( this . props . assembly_id , id , this . state . userID , this . state . token )
91
- . then ( data => {
93
+ . then ( data => {
92
94
const main_data = { }
93
- this . setState ( { scatter_points : data } , ( ) => {
94
- for ( const chunk of this . state . scatter_points ) {
95
+ this . setState ( { scatter_points : data } , ( ) => {
96
+ for ( const chunk of data as unknown as any [ ] ) {
95
97
for ( const row of chunk ) {
96
98
const key = row . g_name as string
97
- // @ts -ignore
98
- main_data [ key ] = row
99
+ ( main_data as any ) [ key ] = row
99
100
}
100
101
}
101
102
this . setState ( { data : main_data } )
102
103
103
104
// Infer fields from first row
104
105
if ( main_data ) {
105
- // @ts -ignore
106
- const proto_row = main_data [ Object . keys ( main_data ) [ 0 ] ]
106
+ const proto_row = ( main_data as any ) [ Object . keys ( main_data ) [ 0 ] ]
107
107
this . setState ( { fields : Object . keys ( proto_row ) } )
108
108
}
109
109
@@ -113,7 +113,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
113
113
) )
114
114
this . setState ( { g_options : gene_options } )
115
115
} ) ;
116
- } )
116
+ } )
117
117
. finally ( ( ) => {
118
118
console . log ( "Finished loading" )
119
119
this . setState ( { is_loading : false } )
@@ -183,6 +183,16 @@ class TaxaminerDashboard extends React.Component<Props, State> {
183
183
this . setState ( { filters : values } )
184
184
}
185
185
186
+ /**
187
+ * Store custom fields of selection view globally
188
+ * @param values
189
+ */
190
+ setCustomFields = ( values : any ) => {
191
+ console . log ( values )
192
+ values = Array . from ( values )
193
+ this . setState ( { customFields : values } )
194
+ }
195
+
186
196
/**
187
197
* Uses the scatter data from the main plot to slave the scatter matrix
188
198
* @param values
@@ -212,16 +222,29 @@ class TaxaminerDashboard extends React.Component<Props, State> {
212
222
< Col >
213
223
< Tabs >
214
224
< Tab eventKey = "Overview" title = "Overview" >
215
- < DataSetSelector
216
- dataset_changed = { this . setDataset }
217
- analyses = { this . props . analyses }
218
- />
219
- < DataSetMeta
220
- assemblyID = { this . props . assembly_id }
221
- dataset_id = { this . state . dataset_id }
222
- userID = { this . state . userID }
223
- token = { this . state . token }
224
- metadata = { this . state . analysis } />
225
+ < Card className = 'm-2' >
226
+ < Card . Body >
227
+ < Card . Title > Dataset</ Card . Title >
228
+ < Tabs >
229
+ < Tab title = "Load Dataset" eventKey = "dataset-loader" >
230
+ < DataSetSelector
231
+ dataset_changed = { this . setDataset }
232
+ analyses = { this . props . analyses }
233
+ />
234
+ </ Tab >
235
+ < Tab title = "Metadata" eventKey = "dataset-meta" >
236
+ < DataSetMeta
237
+ assemblyID = { this . props . assembly_id }
238
+ dataset_id = { this . state . dataset_id }
239
+ userID = { this . state . userID }
240
+ token = { this . state . token }
241
+ metadata = { this . state . analysis } />
242
+ </ Tab >
243
+ </ Tabs >
244
+ </ Card . Body >
245
+ </ Card >
246
+
247
+
225
248
< SelectionView
226
249
is_loading = { this . state . is_loading }
227
250
row = { this . state . selected_row }
@@ -230,7 +253,8 @@ class TaxaminerDashboard extends React.Component<Props, State> {
230
253
assemblyID = { this . props . assembly_id }
231
254
analysisID = { this . state . dataset_id }
232
255
userID = { this . state . userID }
233
- token = { this . state . token } />
256
+ token = { this . state . token }
257
+ passCustomFields = { this . setCustomFields } />
234
258
</ Tab >
235
259
< Tab eventKey = "Filter" title = "Filters" >
236
260
< FilterUI
@@ -288,6 +312,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
288
312
token = { this . state . token }
289
313
assemblyID = { this . props . assembly_id }
290
314
row = { this . state . selected_row }
315
+ customFields = { this . state . customFields }
291
316
/>
292
317
< br />
293
318
< br />
0 commit comments