import React, { useState } from 'react' import { ErrorMessage, FileSelector } from '@jbrowse/core/ui' import { FileLocation, getSession, isSessionModelWithWidgets, isSessionWithAddTracks, } from '@jbrowse/core/util' import { getRoot } from '@jbrowse/mobx-state-tree' import { Button, FormControl, FormControlLabel, FormLabel, Paper, Radio, RadioGroup, TextField, } from '@mui/material' import { makeStyles } from 'tss-react/mui' import type { AddTrackModel } from '@jbrowse/plugin-data-management' const useStyles = makeStyles()(theme => ({ textbox: { width: '100%', }, paper: { margin: theme.spacing(), padding: theme.spacing(), }, submit: { marginTop: 25, marginBottom: 100, display: 'block', }, })) type AdapterTypeOptions = | 'BigMafAdapter' | 'MafTabixAdapter' | 'BgzipTaffyAdapter' type IndexTypeOptions = 'TBI' | 'CSI' export default function MultiMAFWidget({ model }: { model: AddTrackModel }) { const { classes } = useStyles() const [samples, setSamples] = useState('') const [loc, setLoc] = useState() const [indexLoc, setIndexLoc] = useState() const [nhLoc, setNhLoc] = useState() const [error, setError] = useState() const [trackName, setTrackName] = useState('MAF track') const [fileTypeChoice, setFileTypeChoice] = useState('BigMafAdapter') const [indexTypeChoice, setIndexTypeChoice] = useState('TBI') const rootModel = getRoot(model) return ( {error ? : null} File type { setFileTypeChoice(event.target.value as AdapterTypeOptions) }} > {['BigMafAdapter', 'MafTabixAdapter', 'BgzipTaffyAdapter'].map( r => ( } checked={fileTypeChoice === r} label={r} /> ), )} {fileTypeChoice === 'BigMafAdapter' ? ( { setLoc(arg) }} /> ) : fileTypeChoice === 'MafTabixAdapter' ? ( <> Index type { setIndexTypeChoice(event.target.value as IndexTypeOptions) }} > {['TBI', 'CSI'].map(r => ( } checked={indexTypeChoice === r} label={r} /> ))} { setLoc(arg) }} /> { setIndexLoc(arg) }} /> ) : ( <> { setLoc(arg) }} /> { setIndexLoc(arg) }} /> )}
{ setNhLoc(arg) }} /> { setSamples(event.target.value) }} helperText="Sample names (optional if .nh supplied, required if not)" placeholder={ 'Enter sample names from the MAF file, one per line, or JSON formatted array of samples' } variant="outlined" fullWidth />
{ setTrackName(event.target.value) }} />
) }