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

Marker HeatMap view update with markerGeneMetadata dropdown #186

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
11 changes: 8 additions & 3 deletions packages/scxa-experiment-page/src/ExperimentPageSubTabRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ExperimentPageSubTabRoute extends React.Component {
render () {
const { location, match, history } = this.props
const { atlasUrl, suggesterEndpoint, defaultPlotMethodAndParameterisation } = this.props
const { species, experimentAccession, accessKey, ks, ksWithMarkerGenes, plotTypesAndOptions, metadata, anatomogram } = this.props
const { species, experimentAccession, accessKey, ks, ksWithMarkerGenes, plotTypesAndOptions, metadata, anatomogram, markerGeneMetadata } = this.props
const search = URI(location.search).search(true)

const routes = [
Expand Down Expand Up @@ -112,7 +112,7 @@ class ExperimentPageSubTabRoute extends React.Component {
onSelectK={value => handleClusterSelection(value, this, history)}
onChangeMarkerGeneFor={option => this.setState({ selectedClusterIdOption: option })}
ksWithMarkers={ksWithMarkerGenes}
metadata={formatMetadata(metadata)}
markerGeneMetadata={formatMetadata(markerGeneMetadata)}
species={species}
heatmapType={this.state.selectedColourByCategory === METADATA_PLOT ? CELL_TYPE_MARKER_GENE_HEATMAP : CLUSTER_MARKER_GENE_HEATMAP}
/>
Expand Down Expand Up @@ -208,7 +208,12 @@ ExperimentPageSubTabRoute.propTypes = {
anatomogram: PropTypes.object.isRequired,
initialCellTypeValues: PropTypes.arrayOf(PropTypes.string),
defaultPlotMethodAndParameterisation: PropTypes.object.isRequired,
plotTypesAndOptions: PropTypes.object.isRequired
plotTypesAndOptions: PropTypes.object.isRequired,
markerGeneMetadata: PropTypes.arrayOf(PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
status: PropTypes.string.isRequired
}).isRequired).isRequired
}

ExperimentPageSubTabRoute.defaultProps = {
Expand Down
2 changes: 1 addition & 1 deletion packages/scxa-marker-gene-heatmap/html/ClustersViewDemo.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Demo extends React.Component {
host={`https://wwwdev.ebi.ac.uk/gxa/sc/`}
ks={this.props.ks}
ksWithMarkers={this.props.ksWithMarkers}
metadata={this.props.metadata}
markerGeneMetadata={this.props.markerGeneMetadata}
selectedK={this.state.selectedK}
onSelectK={
(k) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HeatmapView extends React.Component {
render() {
const { data, filteredData, selectedClusterId, isLoading, hasError } = this.state
const { wrapperClassName, plotWrapperClassName } = this.props
const { ks, ksWithMarkers, selectedK, onSelectK, metadata } = this.props
const { ks, ksWithMarkers, selectedK, onSelectK, markerGeneMetadata } = this.props
const { hasDynamicHeight, defaultHeatmapHeight, heatmapRowHeight, species, host, heatmapType } = this.props

const inferredCellTypeOptions = [`Inferred cell type - authors labels`, `Inferred cell type - ontology labels`]
Expand All @@ -96,8 +96,8 @@ class HeatmapView extends React.Component {
options: kOptions
}]

if (metadata) {
const metadataOptions = metadata.map((metadata) => ({
if (markerGeneMetadata) {
const metadataOptions = markerGeneMetadata.map((metadata) => ({
...metadata,
isDisabled: !inferredCellTypeOptions.includes(metadata.label),
group: `metadata`
Expand Down Expand Up @@ -145,7 +145,7 @@ class HeatmapView extends React.Component {
<div className={`small-12 medium-6 columns`}>
<PlotSettingsDropdown
labelText={`Cluster by:`}
options={metadata ? options : kOptions}
options={markerGeneMetadata ? options : kOptions}
onSelect={(selectedOption) => onSelectK(selectedOption.value)}
value={heatmapType === `celltypes` ?
{value: selectedK, label: `${capitalized(selectedK)}`} : {value: selectedK, label: `k = ${selectedK}`}}
Expand Down Expand Up @@ -208,9 +208,10 @@ HeatmapView.propTypes = {
heatmapRowHeight: PropTypes.number,
species: PropTypes.string.isRequired,
heatmapType: PropTypes.string,
metadata: PropTypes.arrayOf(PropTypes.shape({
markerGeneMetadata: PropTypes.arrayOf(PropTypes.shape({
value: PropTypes.string,
label: PropTypes.string
label: PropTypes.string,
status: PropTypes.string
}))
}

Expand Down