*/}
-
-
toggleSection("location")}
- style={{ padding: "10px 0" }} // Add padding before and after the title
- >
- Query by Position {collapsedSections.location ? Show : Hide}
- {/*
*/}
- {!collapsedSections.location && (
- <>
-
e.stopPropagation()}>
-
-
-
-
e.stopPropagation()}>
-
-
-
-
e.stopPropagation()}>
-
-
-
-
e.stopPropagation()}>
-
-
-
- >
- )}
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
toggleSection("filters")}
- style={{ padding: "10px 0" }} // Add padding before and after the title
- >
- Filtering Options {collapsedSections.filters ? Show : Hide}
- {/*
*/}
- {!collapsedSections.filters && (
- <>
-
e.stopPropagation()}>
-
-
+
+
+
{parameters.filterLogic.label}
- }
- />
-
+ }
+ />
+
{parameters.includeDescendantTerms.label}
- }
- />
-
- e.stopPropagation()}>
-
-
-
- >
- )}
+ }
+ />
-
-
{!parameters.geoCity.isHidden && (
@@ -503,12 +424,36 @@ export function Form({
)}
+
- {Object.entries(requestTypeExamples || []).map(([id, value]) => (
-
- ))}
+
+
+
+ Query Examples
+
+
+ {Object.entries(requestTypeExamples || []).map(([id, value]) => (
+
+ ))}
+
+
+
+ )
+}
+
+function FormUtilitiesButtons({
+ onGeneSpansClick,
+ geneSpansPanelOpen,
+ onCytoBandClick,
+ cytoBandPanelOpen
+}) {
+ return (
+
+
+
+ Form Utilities
+
+
+
+
+
+
)
}
@@ -550,21 +610,18 @@ function ExampleDescription({ example }) {
function makeParameters(
parametersConfig,
- requestTypeConfig,
example
) {
// merge base parameters config and request config
const mergedConfigs = merge(
{}, // important to not mutate the object
- parametersConfig,
- requestTypeConfig?.parameters,
+ parametersConfig.parameters,
example?.parameters ?? {}
)
// add name the list
let parameters = transform(mergedConfigs, (r, v, k) => {
r[k] = { name: k, ...v }
})
-
return parameters
}
@@ -590,18 +647,20 @@ function validateForm(formValues) {
start,
end,
geneId,
+ aminoacidChange,
+ genomicAlleleShortForm,
bioontology,
clinicalClasses,
referenceid,
cohorts,
- freeFilters
+ allTermsFilters
} = formValues
const errors = []
const setMissing = (name) =>
errors.push([name, { type: "manual", message: "Parameter is missing" }])
- if (!referenceName && !referenceBases && !alternateBases && !start && !end && !variantType && !geneId && !bioontology && !referenceid && !freeFilters && !clinicalClasses && !cohorts) {
+ if (!referenceName && !referenceBases && !alternateBases && !start && !end && !variantType && !geneId && !aminoacidChange && !genomicAlleleShortForm && !bioontology && !referenceid && !allTermsFilters && !clinicalClasses && !cohorts) {
!referenceName && setMissing("referenceName")
!referenceBases && setMissing("referenceBases")
!alternateBases && setMissing("alternateBases")
@@ -612,8 +671,8 @@ function validateForm(formValues) {
!bioontology && setMissing("bioontology")
!clinicalClasses && setMissing("clinicalClasses")
!referenceid && setMissing("referenceid")
- !freeFilters && setMissing("freeFilters")
- !cohorts && setMissing("freeFilters")
+ !allTermsFilters && setMissing("allTermsFilters")
+ !cohorts && setMissing("cohorts")
}
const queryError = validateBeaconQuery(formValues)
@@ -624,37 +683,26 @@ function validateForm(formValues) {
}
errors.push(["global", error])
}
-
return errors
}
-
-
-// Maps FilteringTerms hook to apiReply usable by DataFetchSelect
-function useBioSubsets(watchForm) {
- const datasetIds = watchForm("datasetIds")
- return useCollationsByType({
- datasetIds,
- method: "counts",
- collationTypes: "NCIT,pgx:icdom,pgx:icdot,UBERON"
- })
+const handleExampleClicked = (reset, setExample, setUrlQuery) => (example) => {
+ setUrlQuery({}, { replace: true })
+ setExample(example)
}
-function useReferencesSubsets(watchForm) {
- const datasetIds = watchForm("datasetIds")
- return useCollationsByType({
- datasetIds,
- method: "counts",
- collationTypes: "PMID,GEOseries,GEOplatform,cellosaurus"
- })
+const handleQuerytypeClicked = (reset, setExample, setUrlQuery) => (example) => {
+ setUrlQuery({}, { replace: true })
+ setExample(example)
}
-function useClinicalSubsets(watchForm) {
+// Maps FilteringTerms hook to apiReply usable by DataFetchSelect
+function useFilteringTerms(watchForm, ct) {
const datasetIds = watchForm("datasetIds")
- return useCollationsByType({
+ return useFiltersByType({
datasetIds,
method: "counts",
- collationTypes: "TNM,NCITgrade,NCITstage,EFOfus"
+ collationTypes: ct
})
}
@@ -671,4 +719,3 @@ function FilterLogicWarning({ isVisible }) {
)
}
-
diff --git a/src/components/searchForm/BiosamplesSearchPanel.js b/src/components/searchForm/BiosamplesSearchPanel.js
index 1c42281d..b4e12933 100644
--- a/src/components/searchForm/BiosamplesSearchPanel.js
+++ b/src/components/searchForm/BiosamplesSearchPanel.js
@@ -1,27 +1,24 @@
import React, { useState } from "react"
import { useBeaconQuery } from "../../hooks/api"
import Panel from "../Panel"
-import cn from "classnames"
-// import { FaSlidersH } from "react-icons/fa"
import { BiosamplesSearchForm } from "./BiosamplesSearchForm"
import { BiosamplesResults } from "../searchResults/BiosamplesResults"
import PropTypes from "prop-types"
// import cn from "classnames"
BiosamplesSearchPanel.propTypes = {
- requestTypeConfig: PropTypes.object.isRequired,
- requestTypeExamples: PropTypes.object.isRequired,
parametersConfig: PropTypes.object.isRequired,
+ beaconQueryTypes: PropTypes.object.isRequired,
+ requestTypeExamples: PropTypes.object.isRequired,
collapsed: false
}
export default function BiosamplesSearchPanel({
parametersConfig,
- requestTypeConfig,
+ beaconQueryTypes,
requestTypeExamples,
cytoBands,
- collapsed,
- useUtilitiesButtons = true
+ collapsed
}) {
const [query, setQuery] = useState(null) // actual valid query
const [searchCollapsed, setSearchCollapsed] = useState(collapsed)
@@ -37,7 +34,6 @@ export default function BiosamplesSearchPanel({
setQuery(null)
mutateQuery(null)
}
-
const isLoading = isQueryLoading && !!query
const onValidFormQuery = (formValues) => {
setSearchCollapsed(true)
@@ -45,9 +41,6 @@ export default function BiosamplesSearchPanel({
setQuery(formValues)
}
- // button className="button ml-3"
- // className="icon has-text-info"
-
return (
<>
{(searchCollapsed && (
- <>
- >
))
- ||
- null
+ ||
+ Search Samples
}
}
>