diff --git a/public/js/form.js b/public/js/form.js index 3ceea51f9..95e35aa9a 100644 --- a/public/js/form.js +++ b/public/js/form.js @@ -156,16 +156,17 @@ export class Form extends Component { } handleAlgoChanged(algo) { - if (this.state.preDefinedOpts.hasOwnProperty(algo)) { + if (algo in this.state.preDefinedOpts) { var preDefinedOpts = this.state.preDefinedOpts[algo]; this.refs.opts.setState({ + method: algo, preOpts: preDefinedOpts, value: (preDefinedOpts['last search'] || preDefinedOpts['default']).join(' ') }); } else { - this.refs.opts.setState({ preOpts: {}, value: '' }); + this.refs.opts.setState({ preOpts: {}, value: '', method: '' }); } } diff --git a/public/js/options.js b/public/js/options.js index d18b62eb9..c78f2cb17 100644 --- a/public/js/options.js +++ b/public/js/options.js @@ -3,9 +3,10 @@ import React, { Component } from 'react'; export class Options extends Component { constructor(props) { super(props); - this.state = { preOpts: {}, value: '' }; + this.state = { preOpts: {}, value: '', method: '' }; this.updateBox = this.updateBox.bind(this); this.optionsJSX = this.optionsJSX.bind(this); + this.showAdvancedOptions = this.showAdvancedOptions.bind(this); } updateBox(value) { @@ -37,7 +38,14 @@ export class Options extends Component { ; } - + showAdvancedOptions(e) { + const ids = ['blastn', 'tblastn', 'blastp', 'blastx', 'tblastx']; + const method = this.state.method.toLowerCase(); + // hide options for other algorithms and only show for selected algorithm + for (const id of ids) { + $(`#${id}`)[id === method ? 'show' : 'hide'](); + } + } render() { var classNames = 'form-control'; if (this.state.value.trim()) { @@ -50,12 +58,14 @@ export class Options extends Component {
this.updateBox(e.target.value)} diff --git a/public/sequenceserver-search.min.js b/public/sequenceserver-search.min.js index 8d6f874e2..7b2efa11b 100644 --- a/public/sequenceserver-search.min.js +++ b/public/sequenceserver-search.min.js @@ -60,7 +60,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Form\": () => (/* binding */ Form)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _search_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./search_button */ \"./public/js/search_button.js\");\n/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ \"./public/js/query.js\");\n/* harmony import */ var _databases_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./databases_tree */ \"./public/js/databases_tree.js\");\n/* harmony import */ var _databases__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./databases */ \"./public/js/databases.js\");\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./options */ \"./public/js/options.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\n\n/**\n * Search form.\n *\n * Top level component that initialises and holds all other components, and\n * facilitates communication between them.\n */\n\n\n\nvar Form = /*#__PURE__*/function (_Component) {\n _inherits(Form, _Component);\n\n var _super = _createSuper(Form);\n\n function Form(props) {\n var _this;\n\n _classCallCheck(this, Form);\n\n _this = _super.call(this, props);\n _this.state = {\n databases: [],\n preDefinedOpts: {},\n tree: {}\n };\n _this.useTreeWidget = _this.useTreeWidget.bind(_assertThisInitialized(_this));\n _this.determineBlastMethod = _this.determineBlastMethod.bind(_assertThisInitialized(_this));\n _this.handleSequenceTypeChanged = _this.handleSequenceTypeChanged.bind(_assertThisInitialized(_this));\n _this.handleDatabaseTypeChanaged = _this.handleDatabaseTypeChanaged.bind(_assertThisInitialized(_this));\n _this.handleAlgoChanged = _this.handleAlgoChanged.bind(_assertThisInitialized(_this));\n _this.handleFormSubmission = _this.handleFormSubmission.bind(_assertThisInitialized(_this));\n _this.formRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n }\n\n _createClass(Form, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n /** \n * Fetch data to initialise the search interface from the server. These\n * include list of databases to search against, advanced options to\n * apply when an algorithm is selected, and a query sequence that\n * the user may want to search in the databases.\n */\n var search = location.search.split(/\\?|&/).filter(Boolean);\n var job_id = sessionStorage.getItem('job_id');\n\n if (job_id) {\n search.unshift(\"job_id=\".concat(job_id));\n }\n\n $.getJSON(\"searchdata.json?\".concat(search.join('&')), function (data) {\n /* Update form state (i.e., list of databases and predefined\n * advanced options.\n */\n this.setState({\n tree: data['tree'],\n databases: data['database'],\n preSelectedDbs: data['preSelectedDbs'],\n preDefinedOpts: data['options']\n });\n /* Pre-populate the form with server sent query sequences\n * (if any).\n */\n\n if (data['query']) {\n this.refs.query.value(data['query']);\n }\n\n setTimeout(function () {\n $('.jstree_div').click();\n }, 1000);\n }.bind(this));\n /* Enable submitting form on Cmd+Enter */\n\n $(document).on('keydown', function (e) {\n var $button = $('#method');\n\n if (!$button.is(':disabled') && e.ctrlKey && e.key === 'Enter') {\n $button.trigger('click');\n }\n }); // show overlay to create visual feedback on button click \n\n $('#method').on('click', function () {\n $('#overlay').css('display', 'block');\n });\n }\n }, {\n key: \"useTreeWidget\",\n value: function useTreeWidget() {\n return !underscore__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isEmpty(this.state.tree);\n }\n }, {\n key: \"handleFormSubmission\",\n value: function handleFormSubmission(evt) {\n evt.preventDefault();\n var form = this.formRef.current;\n var formData = new FormData(form);\n formData.append('method', this.refs.button.state.methods[0]);\n fetch(window.location.href, {\n method: 'POST',\n body: formData\n }).then(function (res) {\n //remove overlay when form is submitted\n $('#overlay').css('display', 'none'); // redirect\n\n if (res.redirected && res.url) {\n // setTimeout is needed here as a workaround because safari doesnt allow async calling of window.open\n // so setTimeout makes the method get called on the main thread.\n setTimeout(function () {\n window.open(res.url, $('#toggleNewTab').is(':checked') ? '_blank' : '_self');\n }, 0);\n }\n });\n }\n }, {\n key: \"determineBlastMethod\",\n value: function determineBlastMethod() {\n var database_type = this.databaseType;\n var sequence_type = this.sequenceType;\n\n if (this.refs.query.isEmpty()) {\n return [];\n } //database type is always known\n\n\n switch (database_type) {\n case 'protein':\n switch (sequence_type) {\n case undefined:\n return ['blastp', 'blastx'];\n\n case 'protein':\n return ['blastp'];\n\n case 'nucleotide':\n return ['blastx'];\n }\n\n break;\n\n case 'nucleotide':\n switch (sequence_type) {\n case undefined:\n return ['tblastn', 'blastn', 'tblastx'];\n\n case 'protein':\n return ['tblastn'];\n\n case 'nucleotide':\n return ['blastn', 'tblastx'];\n }\n\n break;\n }\n\n return [];\n }\n }, {\n key: \"handleSequenceTypeChanged\",\n value: function handleSequenceTypeChanged(type) {\n this.sequenceType = type;\n this.refs.button.setState({\n hasQuery: !this.refs.query.isEmpty(),\n hasDatabases: !!this.databaseType,\n methods: this.determineBlastMethod()\n });\n }\n }, {\n key: \"handleDatabaseTypeChanaged\",\n value: function handleDatabaseTypeChanaged(type) {\n this.databaseType = type;\n this.refs.button.setState({\n hasQuery: !this.refs.query.isEmpty(),\n hasDatabases: !!this.databaseType,\n methods: this.determineBlastMethod()\n });\n }\n }, {\n key: \"handleAlgoChanged\",\n value: function handleAlgoChanged(algo) {\n if (this.state.preDefinedOpts.hasOwnProperty(algo)) {\n var preDefinedOpts = this.state.preDefinedOpts[algo];\n this.refs.opts.setState({\n preOpts: preDefinedOpts,\n value: (preDefinedOpts['last search'] || preDefinedOpts['default']).join(' ')\n });\n } else {\n this.refs.opts.setState({\n preOpts: {},\n value: ''\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"container\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n id: \"overlay\",\n style: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vw',\n background: 'rgba(0, 0, 0, 0.2)',\n display: 'none',\n zIndex: 99\n }\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"form\", {\n id: \"blast\",\n ref: this.formRef,\n onSubmit: this.handleFormSubmission,\n className: \"form-horizontal\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"form-group query-container\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_query__WEBPACK_IMPORTED_MODULE_2__.SearchQueryWidget, {\n ref: \"query\",\n onSequenceTypeChanged: this.handleSequenceTypeChanged\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"notifications\",\n id: \"notifications\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(NucleotideNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(ProteinNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(MixedNotification, {})]\n }), this.useTreeWidget() ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_databases_tree__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n ref: \"databases\",\n databases: this.state.databases,\n tree: this.state.tree,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanaged\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_databases__WEBPACK_IMPORTED_MODULE_4__.Databases, {\n ref: \"databases\",\n databases: this.state.databases,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanaged\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"form-group\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_options__WEBPACK_IMPORTED_MODULE_6__.Options, {\n ref: \"opts\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"col-md-2\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"form-group\",\n style: {\n 'textAlign': 'center',\n 'padding': '7px 0'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"label\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"input\", {\n type: \"checkbox\",\n id: \"toggleNewTab\"\n }), \" Open results in new tab\"]\n })\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_search_button__WEBPACK_IMPORTED_MODULE_1__.SearchButton, {\n ref: \"button\",\n onAlgoChanged: this.handleAlgoChanged\n })]\n })]\n })]\n });\n }\n }]);\n\n return Form;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar ProteinNotification = /*#__PURE__*/function (_Component2) {\n _inherits(ProteinNotification, _Component2);\n\n var _super2 = _createSuper(ProteinNotification);\n\n function ProteinNotification() {\n _classCallCheck(this, ProteinNotification);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(ProteinNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"protein-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-info col-md-6 col-md-offset-3\",\n children: \"Detected: amino-acid sequence(s).\"\n })\n });\n }\n }]);\n\n return ProteinNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar NucleotideNotification = /*#__PURE__*/function (_Component3) {\n _inherits(NucleotideNotification, _Component3);\n\n var _super3 = _createSuper(NucleotideNotification);\n\n function NucleotideNotification() {\n _classCallCheck(this, NucleotideNotification);\n\n return _super3.apply(this, arguments);\n }\n\n _createClass(NucleotideNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"nucleotide-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-info col-md-6 col-md-offset-3\",\n children: \"Detected: nucleotide sequence(s).\"\n })\n });\n }\n }]);\n\n return NucleotideNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar MixedNotification = /*#__PURE__*/function (_Component4) {\n _inherits(MixedNotification, _Component4);\n\n var _super4 = _createSuper(MixedNotification);\n\n function MixedNotification() {\n _classCallCheck(this, MixedNotification);\n\n return _super4.apply(this, arguments);\n }\n\n _createClass(MixedNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"mixed-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-danger col-md-10 col-md-offset-1\",\n children: \"Error: mixed nucleotide and amino-acid sequences detected.\"\n })\n });\n }\n }]);\n\n return MixedNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/form.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Form\": () => (/* binding */ Form)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _search_button__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./search_button */ \"./public/js/search_button.js\");\n/* harmony import */ var _query__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./query */ \"./public/js/query.js\");\n/* harmony import */ var _databases_tree__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./databases_tree */ \"./public/js/databases_tree.js\");\n/* harmony import */ var _databases__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./databases */ \"./public/js/databases.js\");\n/* harmony import */ var underscore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! underscore */ \"./node_modules/underscore/modules/index-all.js\");\n/* harmony import */ var _options__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./options */ \"./public/js/options.js\");\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n\n\n/**\n * Search form.\n *\n * Top level component that initialises and holds all other components, and\n * facilitates communication between them.\n */\n\n\n\nvar Form = /*#__PURE__*/function (_Component) {\n _inherits(Form, _Component);\n\n var _super = _createSuper(Form);\n\n function Form(props) {\n var _this;\n\n _classCallCheck(this, Form);\n\n _this = _super.call(this, props);\n _this.state = {\n databases: [],\n preDefinedOpts: {},\n tree: {}\n };\n _this.useTreeWidget = _this.useTreeWidget.bind(_assertThisInitialized(_this));\n _this.determineBlastMethod = _this.determineBlastMethod.bind(_assertThisInitialized(_this));\n _this.handleSequenceTypeChanged = _this.handleSequenceTypeChanged.bind(_assertThisInitialized(_this));\n _this.handleDatabaseTypeChanaged = _this.handleDatabaseTypeChanaged.bind(_assertThisInitialized(_this));\n _this.handleAlgoChanged = _this.handleAlgoChanged.bind(_assertThisInitialized(_this));\n _this.handleFormSubmission = _this.handleFormSubmission.bind(_assertThisInitialized(_this));\n _this.formRef = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createRef)();\n return _this;\n }\n\n _createClass(Form, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n /** \n * Fetch data to initialise the search interface from the server. These\n * include list of databases to search against, advanced options to\n * apply when an algorithm is selected, and a query sequence that\n * the user may want to search in the databases.\n */\n var search = location.search.split(/\\?|&/).filter(Boolean);\n var job_id = sessionStorage.getItem('job_id');\n\n if (job_id) {\n search.unshift(\"job_id=\".concat(job_id));\n }\n\n $.getJSON(\"searchdata.json?\".concat(search.join('&')), function (data) {\n /* Update form state (i.e., list of databases and predefined\n * advanced options.\n */\n this.setState({\n tree: data['tree'],\n databases: data['database'],\n preSelectedDbs: data['preSelectedDbs'],\n preDefinedOpts: data['options']\n });\n /* Pre-populate the form with server sent query sequences\n * (if any).\n */\n\n if (data['query']) {\n this.refs.query.value(data['query']);\n }\n\n setTimeout(function () {\n $('.jstree_div').click();\n }, 1000);\n }.bind(this));\n /* Enable submitting form on Cmd+Enter */\n\n $(document).on('keydown', function (e) {\n var $button = $('#method');\n\n if (!$button.is(':disabled') && e.ctrlKey && e.key === 'Enter') {\n $button.trigger('click');\n }\n }); // show overlay to create visual feedback on button click \n\n $('#method').on('click', function () {\n $('#overlay').css('display', 'block');\n });\n }\n }, {\n key: \"useTreeWidget\",\n value: function useTreeWidget() {\n return !underscore__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isEmpty(this.state.tree);\n }\n }, {\n key: \"handleFormSubmission\",\n value: function handleFormSubmission(evt) {\n evt.preventDefault();\n var form = this.formRef.current;\n var formData = new FormData(form);\n formData.append('method', this.refs.button.state.methods[0]);\n fetch(window.location.href, {\n method: 'POST',\n body: formData\n }).then(function (res) {\n //remove overlay when form is submitted\n $('#overlay').css('display', 'none'); // redirect\n\n if (res.redirected && res.url) {\n // setTimeout is needed here as a workaround because safari doesnt allow async calling of window.open\n // so setTimeout makes the method get called on the main thread.\n setTimeout(function () {\n window.open(res.url, $('#toggleNewTab').is(':checked') ? '_blank' : '_self');\n }, 0);\n }\n });\n }\n }, {\n key: \"determineBlastMethod\",\n value: function determineBlastMethod() {\n var database_type = this.databaseType;\n var sequence_type = this.sequenceType;\n\n if (this.refs.query.isEmpty()) {\n return [];\n } //database type is always known\n\n\n switch (database_type) {\n case 'protein':\n switch (sequence_type) {\n case undefined:\n return ['blastp', 'blastx'];\n\n case 'protein':\n return ['blastp'];\n\n case 'nucleotide':\n return ['blastx'];\n }\n\n break;\n\n case 'nucleotide':\n switch (sequence_type) {\n case undefined:\n return ['tblastn', 'blastn', 'tblastx'];\n\n case 'protein':\n return ['tblastn'];\n\n case 'nucleotide':\n return ['blastn', 'tblastx'];\n }\n\n break;\n }\n\n return [];\n }\n }, {\n key: \"handleSequenceTypeChanged\",\n value: function handleSequenceTypeChanged(type) {\n this.sequenceType = type;\n this.refs.button.setState({\n hasQuery: !this.refs.query.isEmpty(),\n hasDatabases: !!this.databaseType,\n methods: this.determineBlastMethod()\n });\n }\n }, {\n key: \"handleDatabaseTypeChanaged\",\n value: function handleDatabaseTypeChanaged(type) {\n this.databaseType = type;\n this.refs.button.setState({\n hasQuery: !this.refs.query.isEmpty(),\n hasDatabases: !!this.databaseType,\n methods: this.determineBlastMethod()\n });\n }\n }, {\n key: \"handleAlgoChanged\",\n value: function handleAlgoChanged(algo) {\n if (algo in this.state.preDefinedOpts) {\n var preDefinedOpts = this.state.preDefinedOpts[algo];\n this.refs.opts.setState({\n method: algo,\n preOpts: preDefinedOpts,\n value: (preDefinedOpts['last search'] || preDefinedOpts['default']).join(' ')\n });\n } else {\n this.refs.opts.setState({\n preOpts: {},\n value: '',\n method: ''\n });\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"container\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n id: \"overlay\",\n style: {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100vw',\n height: '100vw',\n background: 'rgba(0, 0, 0, 0.2)',\n display: 'none',\n zIndex: 99\n }\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"form\", {\n id: \"blast\",\n ref: this.formRef,\n onSubmit: this.handleFormSubmission,\n className: \"form-horizontal\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"form-group query-container\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_query__WEBPACK_IMPORTED_MODULE_2__.SearchQueryWidget, {\n ref: \"query\",\n onSequenceTypeChanged: this.handleSequenceTypeChanged\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"notifications\",\n id: \"notifications\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(NucleotideNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(ProteinNotification, {}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(MixedNotification, {})]\n }), this.useTreeWidget() ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_databases_tree__WEBPACK_IMPORTED_MODULE_3__[\"default\"], {\n ref: \"databases\",\n databases: this.state.databases,\n tree: this.state.tree,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanaged\n }) : /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_databases__WEBPACK_IMPORTED_MODULE_4__.Databases, {\n ref: \"databases\",\n databases: this.state.databases,\n preSelectedDbs: this.state.preSelectedDbs,\n onDatabaseTypeChanged: this.handleDatabaseTypeChanaged\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"div\", {\n className: \"form-group\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_options__WEBPACK_IMPORTED_MODULE_6__.Options, {\n ref: \"opts\"\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"col-md-2\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"form-group\",\n style: {\n 'textAlign': 'center',\n 'padding': '7px 0'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(\"label\", {\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"input\", {\n type: \"checkbox\",\n id: \"toggleNewTab\"\n }), \" Open results in new tab\"]\n })\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_search_button__WEBPACK_IMPORTED_MODULE_1__.SearchButton, {\n ref: \"button\",\n onAlgoChanged: this.handleAlgoChanged\n })]\n })]\n })]\n });\n }\n }]);\n\n return Form;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar ProteinNotification = /*#__PURE__*/function (_Component2) {\n _inherits(ProteinNotification, _Component2);\n\n var _super2 = _createSuper(ProteinNotification);\n\n function ProteinNotification() {\n _classCallCheck(this, ProteinNotification);\n\n return _super2.apply(this, arguments);\n }\n\n _createClass(ProteinNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"protein-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-info col-md-6 col-md-offset-3\",\n children: \"Detected: amino-acid sequence(s).\"\n })\n });\n }\n }]);\n\n return ProteinNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar NucleotideNotification = /*#__PURE__*/function (_Component3) {\n _inherits(NucleotideNotification, _Component3);\n\n var _super3 = _createSuper(NucleotideNotification);\n\n function NucleotideNotification() {\n _classCallCheck(this, NucleotideNotification);\n\n return _super3.apply(this, arguments);\n }\n\n _createClass(NucleotideNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"nucleotide-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-info col-md-6 col-md-offset-3\",\n children: \"Detected: nucleotide sequence(s).\"\n })\n });\n }\n }]);\n\n return NucleotideNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\nvar MixedNotification = /*#__PURE__*/function (_Component4) {\n _inherits(MixedNotification, _Component4);\n\n var _super4 = _createSuper(MixedNotification);\n\n function MixedNotification() {\n _classCallCheck(this, MixedNotification);\n\n return _super4.apply(this, arguments);\n }\n\n _createClass(MixedNotification, [{\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"notification row\",\n id: \"mixed-sequence-notification\",\n style: {\n display: 'none'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(\"div\", {\n className: \"alert-danger col-md-10 col-md-offset-1\",\n children: \"Error: mixed nucleotide and amino-acid sequences detected.\"\n })\n });\n }\n }]);\n\n return MixedNotification;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/form.js?"); /***/ }), @@ -115,7 +115,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Options\": () => (/* binding */ Options)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n // Component for the advanced params input field.\n\n\n\nvar Options = /*#__PURE__*/function (_Component) {\n _inherits(Options, _Component);\n\n var _super = _createSuper(Options);\n\n function Options(props) {\n var _this;\n\n _classCallCheck(this, Options);\n\n _this = _super.call(this, props);\n _this.state = {\n preOpts: {},\n value: ''\n };\n _this.updateBox = _this.updateBox.bind(_assertThisInitialized(_this));\n _this.optionsJSX = _this.optionsJSX.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(Options, [{\n key: \"updateBox\",\n value: function updateBox(value) {\n this.setState({\n value: value\n });\n }\n }, {\n key: \"optionsJSX\",\n value: function optionsJSX() {\n var _this2 = this;\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"span\", {\n className: \"input-group-btn dropdown\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"button\", {\n className: \"btn bnt-sm btn-default dropdown-toggle\",\n \"data-toggle\": \"dropdown\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-caret-down\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"ul\", {\n id: \"advanced-params-dropdown\",\n className: \"dropdown-menu dropdown-menu-right\",\n children: Object.entries(this.state.preOpts).map(function (_ref, index) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n value = value.join(' ');\n if (value.trim() === _this2.state.value.trim()) var className = 'yellow-background';\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"li\", {\n className: className,\n onClick: function onClick() {\n return _this2.updateBox(value);\n },\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"strong\", {\n children: [key, \":\"]\n }), \"\\xA0\", value]\n }, index);\n })\n })]\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var classNames = 'form-control';\n\n if (this.state.value.trim()) {\n classNames += ' yellow-background';\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"col-md-7\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"form-group\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"col-md-12\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"input-group\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"label\", {\n className: \"control-label\",\n htmlFor: \"advanced\",\n children: [\"Advanced parameters:\", /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"sup\", {\n style: {\n marginLeft: '2px'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"a\", {\n href: \"\",\n \"data-toggle\": \"modal\",\n \"data-target\": \"#help\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-question-circle\"\n })\n })\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"input\", {\n type: \"text\",\n className: classNames,\n onChange: function onChange(e) {\n return _this3.updateBox(e.target.value);\n },\n id: \"advanced\",\n name: \"advanced\",\n value: this.state.value,\n placeholder: \"eg: -evalue 1.0e-5 -num_alignments 100\",\n title: \"View, and enter advanced parameters.\"\n }), Object.keys(this.state.preOpts).length > 1 && this.optionsJSX()]\n })\n })\n })\n });\n }\n }]);\n\n return Options;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/options.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"Options\": () => (/* binding */ Options)\n/* harmony export */ });\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react/jsx-runtime */ \"./node_modules/react/jsx-runtime.js\");\n/* provided dependency */ var $ = __webpack_require__(/*! jquery */ \"./node_modules/jquery/dist/jquery.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, \"prototype\", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } else if (call !== void 0) { throw new TypeError(\"Derived constructors may only return object or undefined\"); } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n // Component for the advanced params input field.\n\n\n\nvar Options = /*#__PURE__*/function (_Component) {\n _inherits(Options, _Component);\n\n var _super = _createSuper(Options);\n\n function Options(props) {\n var _this;\n\n _classCallCheck(this, Options);\n\n _this = _super.call(this, props);\n _this.state = {\n preOpts: {},\n value: '',\n method: ''\n };\n _this.updateBox = _this.updateBox.bind(_assertThisInitialized(_this));\n _this.optionsJSX = _this.optionsJSX.bind(_assertThisInitialized(_this));\n _this.showAdvancedOptions = _this.showAdvancedOptions.bind(_assertThisInitialized(_this));\n return _this;\n }\n\n _createClass(Options, [{\n key: \"updateBox\",\n value: function updateBox(value) {\n this.setState({\n value: value\n });\n }\n }, {\n key: \"optionsJSX\",\n value: function optionsJSX() {\n var _this2 = this;\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"span\", {\n className: \"input-group-btn dropdown\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"button\", {\n className: \"btn bnt-sm btn-default dropdown-toggle\",\n \"data-toggle\": \"dropdown\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-caret-down\"\n })\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"ul\", {\n id: \"advanced-params-dropdown\",\n className: \"dropdown-menu dropdown-menu-right\",\n children: Object.entries(this.state.preOpts).map(function (_ref, index) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n\n value = value.join(' ');\n if (value.trim() === _this2.state.value.trim()) var className = 'yellow-background';\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"li\", {\n className: className,\n onClick: function onClick() {\n return _this2.updateBox(value);\n },\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"strong\", {\n children: [key, \":\"]\n }), \"\\xA0\", value]\n }, index);\n })\n })]\n });\n }\n }, {\n key: \"showAdvancedOptions\",\n value: function showAdvancedOptions(e) {\n var ids = ['blastn', 'tblastn', 'blastp', 'blastx', 'tblastx'];\n var method = this.state.method.toLowerCase(); // hide options for other algorithms and only show for selected algorithm\n\n for (var _i2 = 0, _ids = ids; _i2 < _ids.length; _i2++) {\n var id = _ids[_i2];\n $(\"#\".concat(id))[id === method ? 'show' : 'hide']();\n }\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this3 = this;\n\n var classNames = 'form-control';\n\n if (this.state.value.trim()) {\n classNames += ' yellow-background';\n }\n\n return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"col-md-7\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"form-group\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"div\", {\n className: \"col-md-12\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"div\", {\n className: \"input-group\",\n children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsxs)(\"label\", {\n className: \"control-label\",\n htmlFor: \"advanced\",\n children: [\"Advanced parameters:\", this.state.method && /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"sup\", {\n style: {\n marginLeft: '2px'\n },\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"a\", {\n href: \"\",\n onClick: this.showAdvancedOptions,\n \"data-toggle\": \"modal\",\n \"data-target\": \"#help\",\n children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"i\", {\n className: \"fa fa-question-circle\"\n })\n })\n })]\n }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_1__.jsx)(\"input\", {\n type: \"text\",\n className: classNames,\n onChange: function onChange(e) {\n return _this3.updateBox(e.target.value);\n },\n id: \"advanced\",\n name: \"advanced\",\n value: this.state.value,\n placeholder: \"eg: -evalue 1.0e-5 -num_alignments 100\",\n title: \"View, and enter advanced parameters.\"\n }), Object.keys(this.state.preOpts).length > 1 && this.optionsJSX()]\n })\n })\n })\n });\n }\n }]);\n\n return Options;\n}(react__WEBPACK_IMPORTED_MODULE_0__.Component);\n\n//# sourceURL=webpack://SequenceServer/./public/js/options.js?"); /***/ }), diff --git a/views/_options.erb b/views/_options.erb deleted file mode 100644 index 06357df0c..000000000 --- a/views/_options.erb +++ /dev/null @@ -1,156 +0,0 @@ -<%# - - NOTE: The markup below is displayed in a modal window. Use less than 70 - characters per line to preserve formatting. -%> - -
General Search Options
- - -
- -
Query filtering options
- - -
- -
Restrict search or results
- diff --git a/views/blastn_options.erb b/views/blastn_options.erb new file mode 100644 index 000000000..0e4fdd62b --- /dev/null +++ b/views/blastn_options.erb @@ -0,0 +1,291 @@ +<%# + BLASTN ALGORITHM ADVANCED PARAMETERS + NOTE: The markup below is displayed in a modal window. Use less than 70 + characters per line to preserve formatting. +%> + +
General Search Options
+ +
+ +
Formatting Options
+ + +
+ +
Query filtering options
+ + +
+ +
Restrict search or results
+ + +
+ +
Discontiguous MegaBLAST options
+ + +
+ +
Statistical options
+ + +
+ +
Extension options
+ +
+ +
Miscellaneous options
+ diff --git a/views/blastp_options.erb b/views/blastp_options.erb new file mode 100644 index 000000000..5b629bf11 --- /dev/null +++ b/views/blastp_options.erb @@ -0,0 +1,288 @@ +<%# + BLASTP ALGORITHM ADVANCED PARAMETERS + NOTE: The markup below is displayed in a modal window. Use less than 70 + characters per line to preserve formatting. +%> + +
General Search Options
+ +
+ +
Formatting Options
+ + +
+ +
Query filtering options
+ + +
+ +
Restrict search or results
+ + +
+ +
Statistical options
+ + +
+ +
Extension options
+ +
+ +
Miscellaneous options
+ diff --git a/views/blastx_options.erb b/views/blastx_options.erb new file mode 100644 index 000000000..db34f0bb8 --- /dev/null +++ b/views/blastx_options.erb @@ -0,0 +1,318 @@ +<%# + BLASTX ALGORITHM ADVANCED PARAMETERS + NOTE: The markup below is displayed in a modal window. Use less than 70 + characters per line to preserve formatting. +%> + +
Input Query Options
+ +
+ +
General Search Options
+ +
+ +
Formatting Options
+ + +
+ +
Query filtering options
+ + +
+ +
Restrict search or results
+ + +
+ +
Statistical options
+ + +
+ +
Extension options
+ +
+ +
Miscellaneous options
+ diff --git a/views/layout.erb b/views/layout.erb index 1d3eb3600..b8eb35530 100644 --- a/views/layout.erb +++ b/views/layout.erb @@ -103,34 +103,6 @@
- - diff --git a/views/search.erb b/views/search.erb index 76391b9c5..134aae23c 100644 --- a/views/search.erb +++ b/views/search.erb @@ -21,8 +21,23 @@ +