import React, { useState } from 'react' import { observer } from 'mobx-react' import { Typography, MenuItem, FormControl, Select, Table, TableBody, TableCell, TableHead, TableRow, Paper, FormHelperText, InputLabel, Chip, } from '@mui/material' import { makeStyles } from 'tss-react/mui' import { mutationHighlightFeatures, geneHighlightFeatures } from './Utility' const useStyles = makeStyles()(theme => ({ root: { padding: theme.spacing(1, 3, 1, 1), background: theme.palette.background.default, overflowX: 'hidden', }, formControl: { margin: theme.spacing(1), minWidth: 150, }, text: { display: 'flex', alignItems: 'center', }, paper: { padding: theme.spacing(2), }, })) /** * Render a highlight/colour by element for colouring features */ const HighlightFeature = observer(({ schema, type }: Record) => { const { classes } = useStyles() const [colourBy, setColourBy] = useState( Object.keys(schema.getColourBy()).length !== 0 ? JSON.parse(schema.getColourBy()) : '', ) const highlightFeatures = type === 'mutation' ? mutationHighlightFeatures : geneHighlightFeatures return ( <> Colour Features Attribute Select how to colour features on the track based on feature attributes. {colourBy?.values && (
{colourBy.symbol} {colourBy.values && colourBy.type === 'category' && ( Value Corresponding colour {colourBy.values?.map((value: any) => ( {value.name !== '' ? value.name : 'n/a'} ))}
)} {colourBy.values && colourBy.type === 'threshold' && ( Value Threshold Below Equal or Above {colourBy.values?.map((value: any) => ( {value.name !== '' ? value.name : 'n/a'} {value.threshold} ))}
)} {colourBy.values && colourBy.type === 'boolean' && ( Value True False {colourBy.values?.map((value: any) => ( {value.name !== '' ? value.name : 'n/a'} ))}
)} {colourBy.values && colourBy.type === 'percentage' && ( Value Low High {colourBy.values?.map((value: any) => ( {value.name !== '' ? value.name : 'n/a'} ))}
)}
)}
) }) export default HighlightFeature