From 90910d3b56b74b674b522ec9941b8265271b9062 Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Wed, 13 Jun 2018 17:31:39 -0400
Subject: [PATCH 01/13] edit: per chads suggestions
---
src/containers/Fishers.js | 5 +++--
src/middleware/api.js | 25 ++++++++++++++++++-------
2 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/containers/Fishers.js b/src/containers/Fishers.js
index e62eec9..4d4cbde 100644
--- a/src/containers/Fishers.js
+++ b/src/containers/Fishers.js
@@ -47,7 +47,7 @@ const fdescrip = (step, nextStep, prevStep) => (
-
+
@@ -79,7 +79,8 @@ const fdescrip = (step, nextStep, prevStep) => (
Rationale:
Because analysis modules in biology tend to have different result
formats, graph storage allows comparisons between the results of
- different types without explicit joins. As in the above example, our
+ different types without explicit joins. We treat all nodes in the graph
+ database as available for anlaysis. As in the above example, our
O-type analysis was developed internally whereas the RGI tool was
developed by the CARD initiative doi: 10.1093/nar/gkw1004 .
diff --git a/src/middleware/api.js b/src/middleware/api.js
index cdfd72c..49f9c83 100644
--- a/src/middleware/api.js
+++ b/src/middleware/api.js
@@ -1,7 +1,7 @@
import React from 'react'
//const ROOT = window.location.protocol + '//' + 'spfy.enchartus.ca' + '/'
-const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
-// const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
+// const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
+const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
// const ROOT = 'http://10.139.14.212:8000/'
// const ROOT = 'http://192.168.5.19:8000/'
// const ROOT = 'https://spfy.enchartus.ca/'
@@ -12,7 +12,9 @@ export const version = 'v.6.3.0'
export const analyses = [
{
'analysis':'subtyping',
- 'description':'Serotype, Virulence Factors, Antimicrobial Resistance, Shiga-toxin & Intimin',
+ 'description':(
+ Serotype, Virulence Factors, Antimicrobial Resistance, Shiga-toxin & Intimin
+ ),
'text':(
Upload genome files & determine associated subtypes.
@@ -25,7 +27,10 @@ export const analyses = [
},{
'analysis':'fishers',
'pseudonym':'statistical comparison',
- 'description':"Group database nodes and compare them using Fisher's Exact Test",
+ 'description': (
+
Identify predictive markers for groups of bacteria based on genome content or
+ metadata, using Fisher's Exact Test
+ ),
'text':'Select groups from uploaded genomes & compare for a chosen target datum.'
}
]
@@ -33,15 +38,21 @@ export const analyses = [
export const extra = [
{
'analysis': 'database',
- 'description': 'Status check of database connection',
+ 'description': (
+ Status check of database connection
+ ),
'text': ''
},{
'analysis': 'metadata',
- 'description': 'Submit metadata in the form of a .csv for upload to the database',
+ 'description': (
+ Submit metadata in the form of a .csv for upload to the database
+ ),
'text': ''
},{
'analysis': 'panseq',
- 'description': 'Load a pan-genome into the database for secondary analyses',
+ 'description': (
+ Load a pan-genome into the database for secondary analyses
+ ),
'text': (
Upload genomes & split into pan-genome regions.
From 8de8568e671662e3d20b0fb67fe1e9534a53baaf Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Wed, 13 Jun 2018 17:34:12 -0400
Subject: [PATCH 02/13] edit: per chads suggestions
---
src/middleware/api.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/middleware/api.js b/src/middleware/api.js
index 49f9c83..d12770f 100644
--- a/src/middleware/api.js
+++ b/src/middleware/api.js
@@ -1,7 +1,7 @@
import React from 'react'
//const ROOT = window.location.protocol + '//' + 'spfy.enchartus.ca' + '/'
-// const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
-const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
+const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
+// const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
// const ROOT = 'http://10.139.14.212:8000/'
// const ROOT = 'http://192.168.5.19:8000/'
// const ROOT = 'https://spfy.enchartus.ca/'
From 0e87cf924cf1a35e5fe69a590d2ad3fa6087ba0b Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Mon, 18 Jun 2018 12:57:35 -0400
Subject: [PATCH 03/13] START: first draft of Search.js
---
src/containers/Search.js | 234 +++++++++++++++++++++++++++++++++++++++
1 file changed, 234 insertions(+)
create mode 100644 src/containers/Search.js
diff --git a/src/containers/Search.js b/src/containers/Search.js
new file mode 100644
index 0000000..ff00315
--- /dev/null
+++ b/src/containers/Search.js
@@ -0,0 +1,234 @@
+import React, { Component } from 'react';
+// react-md
+import {
+ FileInput,
+ Checkbox,
+ TextField,
+ Button,
+ Switch,
+ Subheader,
+ Divider,
+ CircularProgress,
+ Collapse,
+} from 'react-md';
+// redux
+import { connect } from 'react-redux'
+import { addJob } from '../actions'
+import { subtypingDescription } from '../middleware/subtyping'
+// import { phylotyperDescription } from '../middleware/phylotyper'
+// axios
+import axios from 'axios'
+import { API_ROOT } from '../middleware/api'
+// router
+import { withRouter } from 'react-router';
+import { Redirect } from 'react-router'
+import Loading from '../components/Loading'
+import { RedirectToken } from '../components/RedirectToken'
+// redirects
+import { RESULTS } from '../Routes'
+
+class Search extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ st: '',
+ collapsed: true,
+ submitted: false,
+ open: false,
+ jobId: "",
+ hasResult: false,
+ }
+ }
+ toggle = () => {
+ this.setState({ collapsed: !this.state.collapsed });
+ };
+
+ _handleSubmit = (e) => {
+ e.preventDefault() // disable default HTML form behavior
+ // Create form.
+ var data = new FormData()
+ data.append('st', this.state.st)
+ // POST
+ axios.post(API_ROOT + 'search', data)
+ .then(response => {
+ console.log("RESPONSE")
+ console.log(response)
+ let jobId = response.data
+ this.setState({ jobId })
+ // Handle the return.
+ this.props.dispatch(addJob(jobId,
+ 'search',
+ new Date().toLocaleString(),
+ String('Search for ' + this.state.st + ' at: ' + new Date().toLocaleString())
+ ))
+ this.setState({ hasResult: true })
+ })
+ };
+ render(){
+ const { st, hasResult, collapsed } = this.state;
+ const { token } = this.props;
+ return (
+
+
+ {/* actual form */}
+ {(!hasResult)?
+
:
+ // if results are grouped, display the Loading page
+ // else, results are separate and display the JobsList cards page
+ (!uploading?(!groupresults?
+
:
+
+ ):"")
+ }
+
+ )
+ }
+}
+
+const mapStateToProps = (state, ownProps) => {
+ return {
+ jobs: state.jobs,
+ ...ownProps
+ }
+}
+
+Subtyping = withRouter(connect(
+ mapStateToProps
+)(Subtyping))
+
+Subtyping = connect()(Subtyping)
+
+export default Search
From e80973ecf9a8dfd004254fb0b2e47b87125d5237 Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Mon, 18 Jun 2018 12:58:10 -0400
Subject: [PATCH 04/13] START: first draft of Search.js
---
src/containers/Search.js | 146 +++------------------------------------
1 file changed, 11 insertions(+), 135 deletions(-)
diff --git a/src/containers/Search.js b/src/containers/Search.js
index ff00315..8ec4780 100644
--- a/src/containers/Search.js
+++ b/src/containers/Search.js
@@ -1,31 +1,19 @@
import React, { Component } from 'react';
// react-md
import {
- FileInput,
- Checkbox,
TextField,
Button,
- Switch,
- Subheader,
- Divider,
- CircularProgress,
Collapse,
} from 'react-md';
// redux
import { connect } from 'react-redux'
import { addJob } from '../actions'
-import { subtypingDescription } from '../middleware/subtyping'
-// import { phylotyperDescription } from '../middleware/phylotyper'
// axios
import axios from 'axios'
import { API_ROOT } from '../middleware/api'
// router
-import { withRouter } from 'react-router';
-import { Redirect } from 'react-router'
import Loading from '../components/Loading'
import { RedirectToken } from '../components/RedirectToken'
-// redirects
-import { RESULTS } from '../Routes'
class Search extends Component {
constructor(props) {
@@ -42,7 +30,9 @@ class Search extends Component {
toggle = () => {
this.setState({ collapsed: !this.state.collapsed });
};
-
+ _updateSt = (value) => {
+ this.setState({ st: value });
+ }
_handleSubmit = (e) => {
e.preventDefault() // disable default HTML form behavior
// Create form.
@@ -81,7 +71,7 @@ class Search extends Component {
-
Search By Accession:
+
Description:
@@ -89,104 +79,15 @@ class Search extends Component {
{/* End: Help Text */}
-
-
-
-
-
ECTyper Subtyping Analysis
-
- {bulk? :''}
- {!groupresults && !bulk ?
-
- : ''}
-
-
+ Search By Accession
-
-
-
-
RGI (CARD) Analysis
-
- {amr ?
-
- : ''}
-
-
-
Phylotyper Subtyping Analysis
-
- {/* */}
-
-
-
-
-
-
-
-
-
-
-
-
-
- {this.state.file ? this.state.file.map(f => (
-
- )) : ''}
-
:
- // if results are grouped, display the Loading page
- // else, results are separate and display the JobsList cards page
- (!uploading?(!groupresults?
- :
-
- ):"")
+
}
)
}
}
-const mapStateToProps = (state, ownProps) => {
- return {
- jobs: state.jobs,
- ...ownProps
- }
-}
-
-Subtyping = withRouter(connect(
- mapStateToProps
-)(Subtyping))
-
-Subtyping = connect()(Subtyping)
+Search = connect()(Search)
export default Search
From 16f38be92c156967a2f339c55e177020a12bdc92 Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Mon, 18 Jun 2018 13:09:16 -0400
Subject: [PATCH 05/13] ADD: Search route to homepage
---
src/Routes.jsx | 3 +++
src/containers/Search.js | 1 -
src/middleware/api.js | 11 +++++++++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/Routes.jsx b/src/Routes.jsx
index bd91454..2451e97 100644
--- a/src/Routes.jsx
+++ b/src/Routes.jsx
@@ -8,6 +8,7 @@ import Subtyping from './containers/Subtyping'
import Metadata from './containers/Metadata'
import Database from './containers/Database'
import Panseq from './containers/Panseq'
+import Search from './containers/Search'
// others
import Results from './containers/Results'
import VisibleResult from './containers/VisibleResult'
@@ -20,6 +21,7 @@ export const METADATA = dirpath + '/metadata'
export const DATABASE = dirpath + '/database'
export const PANSEQ = dirpath + '/panseq'
export const RESULTS = dirpath + '/results'
+export const SEARCH = dirpath + '/search'
export const VISIBLE_RESULT = dirpath + '/results/:hash'
const renderMergedProps = (component, ...rest) => {
@@ -45,6 +47,7 @@ const Routes = (token) => (
+
diff --git a/src/containers/Search.js b/src/containers/Search.js
index 8ec4780..90b855c 100644
--- a/src/containers/Search.js
+++ b/src/containers/Search.js
@@ -93,7 +93,6 @@ class Search extends Component {
secondary
type="submit"
label="Submit"
- disabled={!file}
onClick={this._handleSubmit}
/>
diff --git a/src/middleware/api.js b/src/middleware/api.js
index d12770f..43be422 100644
--- a/src/middleware/api.js
+++ b/src/middleware/api.js
@@ -1,7 +1,7 @@
import React from 'react'
//const ROOT = window.location.protocol + '//' + 'spfy.enchartus.ca' + '/'
-const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
-// const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
+// const ROOT = window.location.protocol + '//' + window.location.hostname + ':8000/'
+const ROOT = 'https://lfz.corefacility.ca/superphy/spfyapi/'
// const ROOT = 'http://10.139.14.212:8000/'
// const ROOT = 'http://192.168.5.19:8000/'
// const ROOT = 'https://spfy.enchartus.ca/'
@@ -37,6 +37,13 @@ export const analyses = [
export const extra = [
{
+ 'analysis': 'search',
+ 'pseudonym': 'search by accession',
+ 'description': (
+ Search database results by accession #
+ ),
+ 'text': ''
+ },{
'analysis': 'database',
'description': (
Status check of database connection
From bd4f39789d0a2db38b48dddf121bc4fc85dc9a24 Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Mon, 18 Jun 2018 13:18:55 -0400
Subject: [PATCH 06/13] change: swap search to a core func
---
src/middleware/api.js | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/middleware/api.js b/src/middleware/api.js
index 43be422..9620e33 100644
--- a/src/middleware/api.js
+++ b/src/middleware/api.js
@@ -32,18 +32,18 @@ export const analyses = [
metadata, using Fisher's Exact Test
),
'text':'Select groups from uploaded genomes & compare for a chosen target datum.'
- }
-]
-
-export const extra = [
- {
+ },{
'analysis': 'search',
'pseudonym': 'search by accession',
'description': (
Search database results by accession #
),
'text': ''
- },{
+ },
+]
+
+export const extra = [
+ {
'analysis': 'database',
'description': (
Status check of database connection
From 0d3b8f897f3a5885da1191a4a6caee109602f3c4 Mon Sep 17 00:00:00 2001
From: Kevin Le
Date: Tue, 19 Jun 2018 22:04:36 -0400
Subject: [PATCH 07/13] stop: done description for search
---
src/containers/Search.js | 26 ++++++++++++++++++++++++--
src/middleware/api.js | 4 ++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/containers/Search.js b/src/containers/Search.js
index 90b855c..52cdd36 100644
--- a/src/containers/Search.js
+++ b/src/containers/Search.js
@@ -20,7 +20,7 @@ class Search extends Component {
super(props);
this.state = {
st: '',
- collapsed: true,
+ collapsed: false,
submitted: false,
open: false,
jobId: "",
@@ -65,7 +65,7 @@ class Search extends Component {