Skip to content

Commit 9ddf68e

Browse files
committed
Synced dashboard features, refactors
1 parent 77fbfdb commit 9ddf68e

File tree

21 files changed

+537
-358
lines changed

21 files changed

+537
-358
lines changed

flask-backend/src/modules/analyses.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -159,17 +159,18 @@ def __generate_analyses_name(assembly_name, analyses_type):
159159
try:
160160
connection, cursor, error = connect()
161161
cursor.execute(
162-
f"SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA='{DB_NAME}' AND TABLE_NAME='analyses'"
162+
"SELECT MAX(id) FROM analyses"
163163
)
164164
auto_increment_counter = cursor.fetchone()[0]
165+
print(auto_increment_counter)
165166

166167
if not auto_increment_counter:
167168
next_id = 1
168169
else:
169-
next_id = auto_increment_counter
170+
next_id = auto_increment_counter + 1
170171

171-
cursor.execute("ALTER TABLE analyses AUTO_INCREMENT = %s", (next_id + 1,))
172-
connection.commit()
172+
# cursor.execute("ALTER TABLE analyses AUTO_INCREMENT = %s", (next_id + 1,))
173+
# connection.commit()
173174
except Exception as err:
174175
return 0, 0, createNotification(message=str(err))
175176

mysql/create_gnom_db.sql

+42
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,48 @@ CREATE TABLE IF NOT EXISTS `gnom_db`.`tags` (
506506
ENGINE = InnoDB;
507507

508508

509+
-- -----------------------------------------------------
510+
-- Table `gnom_db`.`taxaminerDiamond`
511+
-- -----------------------------------------------------
512+
CREATE TABLE `taxaminerDiamond` (
513+
`qseqid` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
514+
`sseqid` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
515+
`pident` FLOAT NULL DEFAULT NULL,
516+
`length` INT(10) NULL DEFAULT NULL,
517+
`mismatch` INT(10) NULL DEFAULT NULL,
518+
`gapopen` INT(10) NULL DEFAULT NULL,
519+
`qstart` INT(10) NULL DEFAULT NULL,
520+
`qend` INT(10) NULL DEFAULT NULL,
521+
`sstart` INT(10) NULL DEFAULT NULL,
522+
`send` INT(10) NULL DEFAULT NULL,
523+
`evalue` FLOAT NULL DEFAULT NULL,
524+
`bitscore` FLOAT NULL DEFAULT NULL,
525+
`taxids` VARCHAR(1000) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
526+
`taxname` VARCHAR(200) NULL DEFAULT NULL COLLATE 'utf8mb4_0900_ai_ci',
527+
`analysisID` INT(10) NULL DEFAULT NULL,
528+
`assemblyID` INT(10) NULL DEFAULT NULL,
529+
INDEX `Index 1` (`qseqid`, `analysisID`, `assemblyID`) USING BTREE
530+
)
531+
COLLATE='utf8mb4_0900_ai_ci'
532+
ENGINE=InnoDB
533+
;
534+
535+
536+
-- -----------------------------------------------------
537+
-- Table `gnom_db`.`taxaminerDiamond`
538+
-- -----------------------------------------------------
539+
CREATE TABLE `settingsTaxaminer` (
540+
`analysisID` INT(10) NOT NULL DEFAULT '0',
541+
`userID` INT(10) NOT NULL DEFAULT '0',
542+
`custom_fields` JSON NULL DEFAULT NULL,
543+
PRIMARY KEY (`analysisID`, `userID`) USING BTREE
544+
)
545+
COLLATE='utf8mb4_0900_ai_ci'
546+
ENGINE=InnoDB
547+
;
548+
549+
550+
509551
-- -----------------------------------------------------
510552
-- Table `gnom_db`.`runningTasks`
511553
-- -----------------------------------------------------

react-frontend/package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"@types/react-select": "^5.0.1",
1010
"bcryptjs": "2.4.3",
1111
"bootstrap": "^5.2.1",
12+
"bootstrap-icons": "^1.10.3",
1213
"classnames": "2.3.1",
1314
"grommet-icons": "4.7.0",
1415
"node-polyfill-webpack-plugin": "1.1.4",
@@ -49,7 +50,8 @@
4950
"rules": {
5051
"@typescript-eslint/explicit-module-boundary-types": "off",
5152
"@typescript-eslint/no-unused-vars": "off",
52-
"no-use-before-define": "off"
53+
"no-use-before-define": "off",
54+
"@typescript-eslint/ban-types": "off"
5355
},
5456
"overrides": [
5557
{
@@ -100,6 +102,9 @@
100102
"@types/node": "16.11.17",
101103
"@types/plotly.js": "^1.54.18",
102104
"@types/react": "17.0.38",
105+
"@types/react-bootstrap-table-next": "^4.0.18",
106+
"@types/react-bootstrap-table2-filter": "^1.3.4",
107+
"@types/react-bootstrap-table2-paginator": "^2.1.2",
103108
"@types/react-dom": "17.0.11",
104109
"@types/react-plotly.js": "^2.5.1",
105110
"@types/uuid": "^8.3.3",

react-frontend/src/api/index.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AssemblyInterface, AssemblyTagInterface } from "../tsInterfaces/tsInter
44
import { Observable, of } from "rxjs";
55
import { fromFetch } from "rxjs/fetch";
66
import { catchError, switchMap } from "rxjs/operators";
7-
import { request } from "http";
87

98
// =============================== users =============================== //
109
// USER AUTHENTIFCATION
@@ -1759,7 +1758,7 @@ export function fetchTaxaminerMain (
17591758
})
17601759
}
17611760

1762-
// ==== Taxaminer Metadate ==== //
1761+
// ==== Taxaminer Metadata ==== //
17631762
export function fetchTaxaminerMetadata (
17641763
assembly_id: number,
17651764
taxaminer_id: number,
@@ -1769,7 +1768,7 @@ export function fetchTaxaminerMetadata (
17691768
return fetch(
17701769
`${process.env.REACT_APP_API_ADRESS}/taxaminer/summary?assemblyID=${assembly_id}&analysisID=${taxaminer_id}&userID=${userID}&token=${token}`
17711770
)
1772-
.then(response => response.text())
1771+
.then(response => response.json())
17731772
.then((data: any) => data.payload)
17741773
.catch((error) => {
17751774
console.error(error);

react-frontend/src/screens/MainRouter/components/AssemblyInformation/components/TaxonomicAssignmentDashboard/dashboard.tsx

+47-22
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ import React from 'react';
22
import Row from 'react-bootstrap/Row';
33
import Col from 'react-bootstrap/Col'
44
import Container from 'react-bootstrap/esm/Container';
5-
import { Tabs, Tab } from "react-bootstrap";
5+
import { Tabs, Tab, Card } from "react-bootstrap";
66
import { DataSetSelector } from './sidebar/DataSet/dataset_selector';
77
import SelectionView from './sidebar/selection/selection';
88
import { DataSetMeta } from './sidebar/DataSet/dataset_metadata';
99
import Scatter3D from './scatterplot3d/scatter3d';
1010
import PCAPlot from './sidebar/PCAPlot/PCAPlot';
1111
import { FilterUI } from './sidebar/Filters/filterui';
1212
import Table from './sidebar/DiamondTable/diamondtable';
13-
import { TableView } from './tableview/TableView';
1413
import ScatterMatrix from './sidebar/ScatterMatrix/ScatterMatrix';
1514

1615
// Stylesheet
1716
import 'bootstrap/dist/css/bootstrap.min.css';
1817
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';
2020

2121

2222
interface State {
@@ -36,6 +36,7 @@ interface State {
3636
token: string
3737
fields: string[]
3838
g_options: { label: string; value: string; }[]
39+
customFields: any[]
3940
scatter_points: any
4041
is_loading: boolean
4142
}
@@ -71,6 +72,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
7172
token: token,
7273
fields: [],
7374
g_options: [],
75+
customFields: [],
7476
scatter_points: [],
7577
is_loading: false
7678
}
@@ -88,22 +90,20 @@ class TaxaminerDashboard extends React.Component<Props, State> {
8890
this.setState({is_loading: true})
8991
this.setState({dataset_id: id}, () => {
9092
fetchTaxaminerScatterplot(this.props.assembly_id, id, this.state.userID, this.state.token)
91-
.then(data => {
93+
.then(data => {
9294
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[]) {
9597
for (const row of chunk) {
9698
const key = row.g_name as string
97-
// @ts-ignore
98-
main_data[key] = row
99+
(main_data as any)[key] = row
99100
}
100101
}
101102
this.setState({data: main_data})
102103

103104
// Infer fields from first row
104105
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]]
107107
this.setState( { fields: Object.keys(proto_row) })
108108
}
109109

@@ -113,7 +113,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
113113
))
114114
this.setState({g_options: gene_options})
115115
});
116-
})
116+
})
117117
.finally(() => {
118118
console.log("Finished loading")
119119
this.setState({is_loading: false})
@@ -183,6 +183,16 @@ class TaxaminerDashboard extends React.Component<Props, State> {
183183
this.setState({filters: values})
184184
}
185185

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+
186196
/**
187197
* Uses the scatter data from the main plot to slave the scatter matrix
188198
* @param values
@@ -212,16 +222,29 @@ class TaxaminerDashboard extends React.Component<Props, State> {
212222
<Col>
213223
<Tabs>
214224
<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+
225248
<SelectionView
226249
is_loading={this.state.is_loading}
227250
row={this.state.selected_row}
@@ -230,7 +253,8 @@ class TaxaminerDashboard extends React.Component<Props, State> {
230253
assemblyID={this.props.assembly_id}
231254
analysisID={this.state.dataset_id}
232255
userID={this.state.userID}
233-
token={this.state.token}/>
256+
token={this.state.token}
257+
passCustomFields={this.setCustomFields}/>
234258
</Tab>
235259
<Tab eventKey="Filter" title="Filters">
236260
<FilterUI
@@ -288,6 +312,7 @@ class TaxaminerDashboard extends React.Component<Props, State> {
288312
token={this.state.token}
289313
assemblyID={this.props.assembly_id}
290314
row={this.state.selected_row}
315+
customFields={this.state.customFields}
291316
/>
292317
<br/>
293318
<br/>

0 commit comments

Comments
 (0)