Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/species filter is getting ignored in the metadata search #158

Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const render = (options, target) => {
{...options}
host={`https://wwwdev.ebi.ac.uk/gxa/sc/`}
searchTerm={`pancreas`}
species={'mus musculus'}
/>, document.getElementById(target)
)
}
Expand Down
4 changes: 2 additions & 2 deletions packages/scxa-cell-type-wheel-experiment-heatmap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebi-gene-expression-group/scxa-cell-type-wheel-heatmap",
"version": "1.4.3",
"version": "1.4.4",
"publishConfig": {
"access": "public"
},
Expand All @@ -27,7 +27,7 @@
"dependencies": {
"@ebi-gene-expression-group/atlas-react-fetch-loader": "*",
"@ebi-gene-expression-group/scxa-cell-type-wheel": "^1.1.6",
"@ebi-gene-expression-group/scxa-gene-search-form": "^2.0.2",
"@ebi-gene-expression-group/scxa-gene-search-form": "^2.0.3",
"@ebi-gene-expression-group/scxa-marker-gene-heatmap": "*",
"highcharts": "^11.4.6",
"highcharts-react-official": "^3.2.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function CellTypeWheelExperimentHeatmap(props) {
const [allSpecies, setAllSpecies] = useState(null) // State to hold the fetched data
const [loading, setLoading] = useState(true) // State to handle loading status
const [error, setError] = useState(null)
const [selectedSpecies, setSelectedSpecies] = useState(props.species)

useEffect(() => {
// Define the async function inside useEffect
Expand Down Expand Up @@ -54,6 +55,10 @@ function CellTypeWheelExperimentHeatmap(props) {
})
}

function handleChange(species) {
setSelectedSpecies(species);
}

const heatmapFulfilledPayloadProvider = heatmapData => ({
data: heatmapData,
xAxisCategories: _.chain(heatmapData).uniqBy(`x`).sortBy(`x`).map(`cellGroupValue`).value(),
Expand All @@ -66,8 +71,8 @@ function CellTypeWheelExperimentHeatmap(props) {
<GeneSearchFormFetchLoader
host={props.host}
resource={props.searchFormResource}
loadingPayloadProvider={ () => ({ speciesSelectStatusMessage: `Fetching species…` }) }
errorPayloadProvider={ () => ({ speciesSelectStatusMessage: `Failed fetching species` }) }
loadingPayloadProvider={() => ({ speciesSelectStatusMessage: `Fetching species…` })}
errorPayloadProvider={() => ({ speciesSelectStatusMessage: `Failed fetching species` })}
wrapperClassName={`row-expanded small-12 columns`}
autocompleteClassName={`small-8 columns`}
actionEndpoint={props.actionEndpoint}
Expand All @@ -77,17 +82,17 @@ function CellTypeWheelExperimentHeatmap(props) {
enableSpeciesSelect={true}
speciesSelectClassName={`small-4 columns`}
defaultSpecies={props.species}
onSpeciesSelectOnChange={handleChange}
/>
<div className={`row-expanded small-12 columns`}>
<div className={`small-12 medium-6 columns`} aria-label={`Cell type wheel`}>
{props.searchTerm.trim() ?
<CellTypeWheelFetchLoader
host={props.host}
resource={URI(props.cellTypeWheelResource)
resource={URI(props.cellTypeWheelResource)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it is a tiny formatting thing, but could you restore the aligning of this line, please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, not sure, how it was disturbed, it makes sense. Thanks for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed formatting, please feel free to review when log in

.segment(props.searchTerm)
.search(`?species=` + props.species)
.toString()
}
.toString()}
query={props.species ? `?species=` + selectedSpecies : ''}
fulfilledPayloadProvider={cellTypeWheelData => ({ data: cellTypeWheelData })}
searchTerm={props.searchTerm}
allSpecies={allSpecies}
Expand Down Expand Up @@ -115,7 +120,8 @@ function CellTypeWheelExperimentHeatmap(props) {
props.searchTerm.trim() ?
<div className={`medium-text-center`} aria-label={`No cell type selected`}>
<h4>
Please click on a cell type to see a detailed view of the expression profile of top-scoring genes across experiments.
Please click on a cell type to see a detailed view of the expression profile of top-scoring genes
across experiments.
</h4>
</div> :
<div/>
Expand Down
2 changes: 1 addition & 1 deletion packages/scxa-gene-search-form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ebi-gene-expression-group/scxa-gene-search-form",
"version": "2.0.2",
"version": "2.0.3",
"description": "Single Cell Expression Atlas homepage gene search form",
"main": "lib/index.js",
"scripts": {
Expand Down
6 changes: 5 additions & 1 deletion packages/scxa-gene-search-form/src/GeneSearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class GeneSearchForm extends React.Component {

_speciesSelectOnChange (selectedItem) {
this.setState({ selectedSpecies: selectedItem.value })
if (this.props.onSpeciesSelectOnChange) {
this.props.onSpeciesSelectOnChange(selectedItem.value)
}
}

render () {
Expand Down Expand Up @@ -125,7 +128,8 @@ GeneSearchForm.propTypes = {
searchExamples: PropTypes.arrayOf(PropTypes.shape({
text: PropTypes.string.isRequired,
url: PropTypes.string.isRequired
}))
})),
onSpeciesSelectOnChange: PropTypes.func
}

GeneSearchForm.defaultProps = {
Expand Down