Skip to content

Commit

Permalink
Provide a dialog to add extra genomic context for linear read vs. ref…
Browse files Browse the repository at this point in the history
… visualization (#1560)

* Provide genomic context for linear vs. ref

* Add window size dialog

* Add explainer and form to increase window size

Co-authored-by: Colin <[email protected]>
  • Loading branch information
elliothershberg and cmdcolin authored Jan 8, 2021
1 parent c17de3b commit 2b97eda
Show file tree
Hide file tree
Showing 6 changed files with 634 additions and 554 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,41 +55,36 @@ export default function ColorByTagDlg(props: {
for minimap2 read strand, HP for haplotype, RG for read group, etc.
</Typography>

<form>
<TextField
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'color-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={
tag.length === 2 && !validTag ? 'Not a valid tag' : ''
}
autoComplete="off"
data-testid="color-tag-name"
/>
<Button
variant="contained"
color="primary"
type="submit"
style={{ marginLeft: 20 }}
onClick={() => {
display.setColorScheme({
type: 'tag',
tag,
})
handleClose()
}}
disabled={!validTag}
>
Submit
</Button>
</form>
<TextField
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'color-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={tag.length === 2 && !validTag ? 'Not a valid tag' : ''}
autoComplete="off"
data-testid="color-tag-name"
/>
<Button
variant="contained"
color="primary"
style={{ marginLeft: 20 }}
onClick={() => {
display.setColorScheme({
type: 'tag',
tag,
})
handleClose()
}}
disabled={!validTag}
>
Submit
</Button>
</div>
</DialogContent>
</Dialog>
Expand Down
166 changes: 82 additions & 84 deletions plugins/alignments/src/LinearPileupDisplay/components/FilterByTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,92 +128,90 @@ export default observer(
for details
</Typography>
<div className={classes.root}>
<form>
<Paper className={classes.paper} variant="outlined">
<div style={{ display: 'flex' }}>
<div>
<Typography>Read must have ALL these flags</Typography>
<Bitmask flag={flagInclude} setFlag={setFlagInclude} />
</div>
<div>
<Typography>Read must have NONE of these flags</Typography>
<Bitmask flag={flagExclude} setFlag={setFlagExclude} />
</div>
<Paper className={classes.paper} variant="outlined">
<div style={{ display: 'flex' }}>
<div>
<Typography>Read must have ALL these flags</Typography>
<Bitmask flag={flagInclude} setFlag={setFlagInclude} />
</div>
</Paper>
<Paper className={classes.paper} variant="outlined">
<Typography>
Filter by tag name and value. Use * in the value field to get
all reads containing any value for that tag. Example: filter
tag name SA with value * to get all split/supplementary reads
</Typography>
<TextField
className={classes.field}
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'color-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={
tag.length === 2 && !validTag ? 'Not a valid tag' : ''
}
data-testid="color-tag-name"
/>
<TextField
className={classes.field}
value={tagValue}
onChange={event => {
setTagValue(event.target.value)
}}
placeholder="Enter tag value"
inputProps={{
'data-testid': 'color-tag-name-input',
}}
data-testid="color-tag-value"
/>
</Paper>
<Paper className={classes.paper} variant="outlined">
<Typography>Filter by read name</Typography>
<TextField
className={classes.field}
value={readName}
onChange={event => {
setReadName(event.target.value)
}}
placeholder="Enter read name"
inputProps={{
'data-testid': 'color-tag-readname-input',
}}
data-testid="color-tag-readname"
/>
</Paper>
<Button
variant="contained"
color="primary"
onClick={() => {
display.setFilterBy({
flagInclude,
flagExclude,
readName,
tagFilter:
tag !== ''
? {
tag,
value: tagValue,
}
: undefined,
})
handleClose()
<div>
<Typography>Read must have NONE of these flags</Typography>
<Bitmask flag={flagExclude} setFlag={setFlagExclude} />
</div>
</div>
</Paper>
<Paper className={classes.paper} variant="outlined">
<Typography>
Filter by tag name and value. Use * in the value field to get
all reads containing any value for that tag. Example: filter tag
name SA with value * to get all split/supplementary reads
</Typography>
<TextField
className={classes.field}
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'color-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={
tag.length === 2 && !validTag ? 'Not a valid tag' : ''
}
data-testid="color-tag-name"
/>
<TextField
className={classes.field}
value={tagValue}
onChange={event => {
setTagValue(event.target.value)
}}
>
Submit
</Button>
</form>
placeholder="Enter tag value"
inputProps={{
'data-testid': 'color-tag-name-input',
}}
data-testid="color-tag-value"
/>
</Paper>
<Paper className={classes.paper} variant="outlined">
<Typography>Filter by read name</Typography>
<TextField
className={classes.field}
value={readName}
onChange={event => {
setReadName(event.target.value)
}}
placeholder="Enter read name"
inputProps={{
'data-testid': 'color-tag-readname-input',
}}
data-testid="color-tag-readname"
/>
</Paper>
<Button
variant="contained"
color="primary"
onClick={() => {
display.setFilterBy({
flagInclude,
flagExclude,
readName,
tagFilter:
tag !== ''
? {
tag,
value: tagValue,
}
: undefined,
})
handleClose()
}}
>
Submit
</Button>
</div>
</DialogContent>
</Dialog>
Expand Down
54 changes: 25 additions & 29 deletions plugins/alignments/src/LinearPileupDisplay/components/SortByTag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,35 +50,31 @@ export default function ColorByTagDlg(props: {
<DialogContent>
<div>
<Typography>Set the tag to sort by</Typography>
<form>
<TextField
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'sort-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={
tag.length === 2 && !validTag ? 'Not a valid tag' : ''
}
autoComplete="off"
data-testid="sort-tag-name"
/>
<Button
variant="contained"
color="primary"
onClick={() => {
display.setSortedBy('tag', tag)
handleClose()
}}
>
Submit
</Button>
</form>
<TextField
value={tag}
onChange={event => {
setTag(event.target.value)
}}
placeholder="Enter tag name"
inputProps={{
maxLength: 2,
'data-testid': 'sort-tag-name-input',
}}
error={tag.length === 2 && !validTag}
helperText={tag.length === 2 && !validTag ? 'Not a valid tag' : ''}
autoComplete="off"
data-testid="sort-tag-name"
/>
<Button
variant="contained"
color="primary"
onClick={() => {
display.setSortedBy('tag', tag)
handleClose()
}}
>
Submit
</Button>
</div>
</DialogContent>
</Dialog>
Expand Down
4 changes: 2 additions & 2 deletions plugins/linear-comparative-view/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
},
"author": "JBrowse Team",
"distMain": "dist/index.js",
"srcMain": "src/index.ts",
"main": "src/index.ts",
"srcMain": "src/index.tsx",
"main": "src/index.tsx",
"distModule": "dist/plugin-linear-comparative-view.esm.js",
"module": "",
"files": [
Expand Down
Loading

0 comments on commit 2b97eda

Please sign in to comment.