Skip to content

Commit

Permalink
Add a visual UI distinction for anndata experiments in the gene searc…
Browse files Browse the repository at this point in the history
…h results (#136)

* Add anndata icon to result card

* Add experiment type to result header

* Fix typos

* Reformat jsx code

* Add propTypes
  • Loading branch information
lingyun1010 committed Feb 14, 2023
1 parent d1aebb0 commit 65ca28d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const CardContainerDiv = styled.div`
}
`

const SmallIconDiv = styled.div`
width: 5%;
text-align: center;
font-size: 3rem;
`

const IconDiv = styled.div`
width: 15%;
text-align: center;
Expand Down Expand Up @@ -48,6 +54,8 @@ const CountDiv = styled.div`
text-align: center;
`

const ANNDATA = `E-ANND`

class ExperimentCard extends React.Component {
constructor(props) {
super(props)
Expand All @@ -58,7 +66,7 @@ class ExperimentCard extends React.Component {
}

render() {
const {url, species, experimentDescription, markerGenes, numberOfAssays, factors} = this.props
const {url, species, experimentDescription, markerGenes, numberOfAssays, experimentAccession, type, factors} = this.props

const markerGeneLinks = markerGenes ? markerGenes.map((markerGene) =>
<li key={`marker-gene-${markerGene.k}`}>
Expand All @@ -68,6 +76,16 @@ class ExperimentCard extends React.Component {

return (
<CardContainerDiv onClick={this._goToExperiment.bind(this, url)}>
<SmallIconDiv>
<span data-tip={type} data-html={true} className={`icon icon-functional`}>
{
experimentAccession.substring(0,6) === ANNDATA ?
//tbc
<img src={`https://user-images.githubusercontent.com/33519183/203308460-aee477fa-c8ab-4561-be46-34254bfa1731.png`} /> :
<img src={`https://www.ebi.ac.uk/gxa/resources/images/expression-atlas.png`} />
}
</span>
</SmallIconDiv>
<IconDiv>
<EbiSpeciesIcon species={species}/>
<h6>{species}</h6>
Expand Down Expand Up @@ -110,7 +128,9 @@ ExperimentCard.propTypes = {
url: PropTypes.string.isRequired
})),
numberOfAssays: PropTypes.number.isRequired,
factors: PropTypes.array.isRequired
factors: PropTypes.array.isRequired,
experimentAccession: PropTypes.string.isRequired
type: PropTypes.string.isRequired
}

export default ExperimentCard
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ const CardContainerDiv = styled.div`
font-size: 0.9rem;
`

const SmallIconDiv = styled.div`
width: 5%;
text-align: center;
cursor: pointer;
opacity: 0.6;
transition: 0.3s;
:hover {opacity: 1};
`

const IconDiv = styled.div`
width: 15%;
text-align: center;
Expand Down Expand Up @@ -57,9 +66,9 @@ const CountDiv = styled.div`

const ExperimentTableHeaderBasic = () =>
({
'titles': [`Species`, `Marker genes`, `Title`, `Experimental variables`, `Number of assays`],
'styles': [IconDiv, MarkerDiv, TitleDiv, VariableDiv, CountDiv],
'attributes': [`species`, `markerGenes`, `experimentDescription`, null, `numberOfAssays`]
'titles': [`Experiment type`, `Species`, `Marker genes`, `Title`, `Experimental variables`, `Number of assays`],
'styles': [SmallIconDiv, IconDiv, MarkerDiv, TitleDiv, VariableDiv, CountDiv],
'attributes': [`experimentAccession`, `species`, `markerGenes`, `experimentDescription`, null, `numberOfAssays`]
})


Expand Down

0 comments on commit 65ca28d

Please sign in to comment.