import * as React from 'react'; import styles from './styles/styles.module.scss'; import { Modal } from 'react-bootstrap'; import ReactSelect from 'react-select1'; import { observer } from 'mobx-react'; import { computed, action, makeObservable } from 'mobx'; import { FlexRow, FlexCol } from '../flexbox/FlexBox'; import gene_lists from './gene_lists'; import classNames from 'classnames'; import { getOncoQueryDocUrl } from '../../api/urls'; import { QueryStoreComponent, Focus, GeneReplacement } from './QueryStore'; import MutSigGeneSelector from './MutSigGeneSelector'; import GisticGeneSelector from './GisticGeneSelector'; import SectionHeader from '../sectionHeader/SectionHeader'; import { getServerConfig } from 'config/config'; import { ServerConfigHelpers } from '../../../config/config'; import OQLTextArea, { GeneBoxType } from '../GeneSelectionBox/OQLTextArea'; import { SingleGeneQuery } from 'shared/lib/oql/oql-parser'; import { Gene } from 'cbioportal-ts-api-client'; import GenesetsValidator from './GenesetsValidator'; import FontAwesome from 'react-fontawesome'; import GeneSymbolValidationError from './GeneSymbolValidationError'; @observer export default class GeneSetSelector extends QueryStoreComponent<{}, {}> { constructor(props: any) { super(props); makeObservable(this); } @computed get selectedGeneListOption() { let option = this.geneListOptions.find( opt => opt.value == this.store.geneQuery ); return option ? option.value : ''; } @computed get geneListOptions() { let geneList: { id: string; genes: string[] }[] = gene_lists; if (getServerConfig().query_sets_of_genes) { const parsed = ServerConfigHelpers.parseQuerySetsOfGenes( getServerConfig().query_sets_of_genes! ); if (parsed) { geneList = parsed; } } return [ { label: 'User-defined List', value: '', }, ...geneList.map(item => ({ label: `${item.id} (${item.genes.length} genes)`, value: item.genes.join(' '), })), ]; } @action.bound handleOQLUpdate( oql: { query: SingleGeneQuery[]; error?: { start: number; end: number; message: string }; }, genes: { found: Gene[]; suggestions: GeneReplacement[] }, queryStr: string ): void { if (queryStr !== this.store.geneQuery) { this.store.geneQuery = queryStr; this.store.oql.error = oql.error; } } @computed get customError(): JSX.Element | null { if (this.store.isQueryLimitReached) { return (
); } return null; } render() { return ( Hint: Learn Onco Query Language (OQL)
to write more powerful queries{' '} } > Enter Genes:
(this.store.geneQuery = option ? option.value : '') } /> {this.customError} (this.store.showMutSigPopup = false)} > Recently Mutated Genes { this.store.applyGeneSelection( map_geneSymbol_selected ); this.store.showMutSigPopup = false; }} /> (this.store.showGisticPopup = false)} > Recurrent Copy Number Alterations (Gistic) { this.store.applyGeneSelection( map_geneSymbol_selected ); this.store.showGisticPopup = false; }} />
); } }