Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transcript glyphs #458

Merged
merged 30 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f155433
Make Box and SvgFeatureRendering use React hooks
garrettjstevens Aug 7, 2019
dd44d86
Add Chevron glyph
garrettjstevens Aug 7, 2019
5d1cfca
Separate glyph and label components
garrettjstevens Aug 8, 2019
bd4e69e
Change fill and stroke for selected SVG glyph
garrettjstevens Aug 8, 2019
5067084
Update SVG color test to wait for fill attribute
garrettjstevens Aug 8, 2019
d83d311
Fix component name
garrettjstevens Aug 8, 2019
bd7fc76
Remove duplicate configId
garrettjstevens Aug 8, 2019
b56014f
Better separate glyph and label layouts
garrettjstevens Aug 8, 2019
ff1cb68
DRY up feature event handlers
garrettjstevens Aug 9, 2019
1f607c1
Basic Segments glyph
garrettjstevens Aug 13, 2019
64911b6
Add missing label to ColorEditor
garrettjstevens Aug 13, 2019
d61a9d2
Use color2 for connectors and outlines
garrettjstevens Aug 13, 2019
95695f5
Add parent to NCListFeature, make lint more strict
garrettjstevens Aug 14, 2019
6d3767b
Expand SceneGraph on move()
garrettjstevens Aug 14, 2019
990b84d
Update ColorEditor PropTypes and snaps
garrettjstevens Aug 14, 2019
226e045
Add Subfeature glyph (for sub-subfeature rendering)
garrettjstevens Aug 14, 2019
8abbd29
Add ProcessedTranscript glyph
garrettjstevens Aug 14, 2019
371de40
Fix lint warnings
garrettjstevens Aug 14, 2019
c0a0361
layOutFeatures -> layOutFeature
garrettjstevens Aug 14, 2019
9b2efd9
Fix session not updating to localStorage after opening a new session
garrettjstevens Aug 14, 2019
8849fee
Don't try to render filtered subfeatures
garrettjstevens Aug 14, 2019
e4ec10f
Fix glyph flip when view is horizontally flipped
garrettjstevens Aug 15, 2019
f354288
Standardize on feature strand being 1 or -1
garrettjstevens Aug 15, 2019
f3d159a
Add SVG Feature Renderer README
garrettjstevens Aug 15, 2019
ea493de
Add directional arrow to Segments glyph line
garrettjstevens Aug 15, 2019
c2614b4
Remove indentation on back of Chevron
garrettjstevens Aug 16, 2019
34f6ffb
Make JB1 connection NCList tracks use SVG renderer
garrettjstevens Aug 16, 2019
03e33f9
Merge branch 'master' into transcript_glyphs
garrettjstevens Aug 16, 2019
be2d9fa
Fix SVG when it has a description but not a name
garrettjstevens Aug 16, 2019
4d93587
Lint fixes
garrettjstevens Aug 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
],
"scripts": {
"build": "NODE_ENV=production lerna run build",
"lint": "eslint --ext .js,.ts,.jsx,.tsx .",
"lint": "eslint --max-warnings 0 --ext .js,.ts,.jsx,.tsx .",
"test-ci": "jest --ci --coverage",
"built-test-ci": "jest --ci packages/integration-tests",
"test": "jest"
Expand All @@ -25,6 +25,7 @@
"@material-ui/core": "^4.0.0",
"@material-ui/styles": "^4.0.0",
"@svgr/webpack": "^4.1.0",
"@testing-library/jest-dom": "^4.0.0",
"@types/base64-js": "^1.2.5",
"@testing-library/react": "^8.0.8",
"@types/get-value": "^3.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/alignments/src/PileupRenderer/configSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default ConfigurationSchema(
description: 'the color of each feature in a pileup alignment',
defaultValue: `function(feature) {
var s = feature.get('strand');
return s === '-' || s === -1 ? '#8F8FD8': '#EC8B8B'
return s === -1 ? '#8F8FD8': '#EC8B8B'
}`,
functionSignature: ['feature'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ export function viewportVisibleSection(viewSides, circleCenter, circleRadius) {
vertices.push([0, viewB])
}

const verticesOriginal = vertices.map(([x, y]) => [x + cx, y + cy])
// const verticesOriginal = vertices.map(([x, y]) => [x + cx, y + cy])

// now convert them all to polar and take the max and min of rho and theta

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe('viewportVisibleSection', () => {
test('viewport on upper center 2', () => {
// [180.48708681644143, 359.3411680673888] [4.6042679453532855, 541.6042679453533]
// see '~/Desktop/Screen Shot 2019-06-28 at 3.01.22 PM.png'
const { theta, rho } = viewportVisibleSection(
const { theta } = viewportVisibleSection(
[0, 962, 157, 557],
[561.6042679453533, 561.6042679453533],
541.6042679453533,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
export default ({ jbrequire }) => {
const React = jbrequire('react')
const { observer } = jbrequire('mobx-react')
const { observer, PropTypes: MobxPropTypes } = jbrequire('mobx-react')
const { polarToCartesian } = jbrequire('@gmod/jbrowse-core/util')
const { readConfObject } = jbrequire('@gmod/jbrowse-core/configuration')
const { PropTypes: CommonPropTypes } = jbrequire(
'@gmod/jbrowse-core/mst-types',
)
const PropTypes = jbrequire('prop-types')

function bpToRadians(block, pos) {
const blockStart = block.region.elided ? 0 : block.region.start
Expand Down Expand Up @@ -94,5 +98,19 @@ export default ({ jbrequire }) => {
return <>{chords}</>
}

StructuralVariantChords.propTypes = {
features: PropTypes.instanceOf(Map).isRequired,
config: CommonPropTypes.ConfigSchema.isRequired,
trackModel: MobxPropTypes.objectOrObservableObject,
blockDefinitions: PropTypes.arrayOf(MobxPropTypes.objectOrObservableObject)
.isRequired,
radius: PropTypes.number.isRequired,
bezierRadius: PropTypes.number.isRequired,
}

StructuralVariantChords.defaultProps = {
trackModel: undefined,
}

return observer(StructuralVariantChords)
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ export default ({ jbrequire }) => {
const { isAlive } = jbrequire('mobx-state-tree')
const { useEffect, useRef } = React
const { observer } = jbrequire('mobx-react-lite')
const { PropTypes: MobxPropTypes } = jbrequire('mobx-react')
const { unmountComponentAtNode, hydrate } = jbrequire('react-dom')

function RpcRenderedSvgGroup({ model }) {
const { id, data, html, filled, renderProps, renderingComponent } = model
const { data, html, filled, renderProps, renderingComponent } = model

const ssrContainerNode = useRef(null)

Expand Down Expand Up @@ -46,5 +47,9 @@ export default ({ jbrequire }) => {
return <g ref={ssrContainerNode} />
}

RpcRenderedSvgGroup.propTypes = {
model: MobxPropTypes.observableObject.isRequired,
}

return observer(RpcRenderedSvgGroup)
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
export default ({ jbrequire }) => {
const React = jbrequire('react')
const { observer } = jbrequire('mobx-react')
const { observer, PropTypes: MobxPropTypes } = jbrequire('mobx-react')

const Loading = jbrequire(require('../../ChordTrack/components/Loading'))
const TrackError = jbrequire(
require('../../ChordTrack/components/TrackError'),
)
const RpcRenderedSvgGroup = jbrequire(require('./RpcRenderedSvgGroup'))

function StructuralVariantChordTrack({ track, view }) {
function StructuralVariantChordTrack({ track }) {
if (track.error) return <TrackError model={track} />
if (!track.filled) return <Loading model={track} />
return <RpcRenderedSvgGroup model={track} />
}
StructuralVariantChordTrack.propTypes = {
track: MobxPropTypes.observableObject.isRequired,
}
return observer(StructuralVariantChordTrack)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export default pluginManager => {
const { jbrequire } = pluginManager
const { reaction } = jbrequire('mobx')

const { types, addDisposer } = jbrequire('mobx-state-tree')
const { types } = jbrequire('mobx-state-tree')
const { ConfigurationSchema, ConfigurationReference } = jbrequire(
'@gmod/jbrowse-core/configuration',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function serializeColor(color) {
}

export const ColorPicker = props => {
const { value, TextFieldProps, onChange } = props
const { value, label, TextFieldProps, onChange } = props
const [color, setColor] = useState(value)
const [displayed, setDisplayed] = useState(false)

Expand All @@ -27,6 +27,7 @@ export const ColorPicker = props => {
<>
<TextField
value={c}
label={label}
InputProps={{
style: {
color: c,
Expand Down Expand Up @@ -54,10 +55,12 @@ export const ColorPicker = props => {
}
ColorPicker.propTypes = {
onChange: ReactPropTypes.func.isRequired,
label: ReactPropTypes.string,
TextFieldProps: ReactPropTypes.shape({}),
value: ReactPropTypes.string,
}
ColorPicker.defaultProps = {
label: '',
value: '#000',
TextFieldProps: {},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,12 @@ exports[`ConfigurationEditor drawer widget renders all the different types of bu
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
colorTest
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: rgb(57, 100, 148); border-right-width: 25px; border-right-style: solid; border-right-color: #396494;"
Expand Down Expand Up @@ -1723,7 +1729,7 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
>
function(feature) {
var s = feature.get('strand');
return s === '-' || s === -1 ? '#8F8FD8': '#EC8B8B'
return s === -1 ? '#8F8FD8': '#EC8B8B'
}
</textarea>
<pre
Expand Down Expand Up @@ -1814,24 +1820,6 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
===
</span>

<span
class="token string"
>
'-'
</span>

<span
class="token operator"
>
||
</span>
s
<span
class="token operator"
>
===
</span>

<span
class="token operator"
>
Expand Down Expand Up @@ -2079,6 +2067,12 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
color1
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: goldenrod; border-right-width: 25px; border-right-style: solid; border-right-color: goldenrod;"
Expand Down Expand Up @@ -2131,6 +2125,12 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
color2
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: black; border-right-width: 25px; border-right-style: solid; border-right-color: black;"
Expand Down Expand Up @@ -2183,6 +2183,12 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
color3
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: rgb(53, 112, 137); border-right-width: 25px; border-right-style: solid; border-right-color: #357089;"
Expand Down Expand Up @@ -2505,6 +2511,12 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
nameColor
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: black; border-right-width: 25px; border-right-style: solid; border-right-color: black;"
Expand Down Expand Up @@ -2727,6 +2739,12 @@ exports[`ConfigurationEditor drawer widget renders with defaults of the Alignmen
<div
class="MuiFormControl-root MuiTextField-root MuiFormControl-fullWidth"
>
<label
class="MuiFormLabel-root MuiInputLabel-root MuiInputLabel-formControl MuiInputLabel-animated MuiInputLabel-shrink MuiFormLabel-filled"
data-shrink="true"
>
descriptionColor
</label>
<div
class="MuiInputBase-root MuiInput-root MuiInput-underline MuiInputBase-fullWidth MuiInput-fullWidth MuiInputBase-formControl MuiInput-formControl"
style="color: blue; border-right-width: 25px; border-right-style: solid; border-right-color: blue;"
Expand Down
2 changes: 1 addition & 1 deletion packages/core/BaseAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Observer, Observable, merge } from 'rxjs'
import { tap, takeUntil } from 'rxjs/operators'
import { takeUntil } from 'rxjs/operators'
import { IRegion as Region } from './mst-types'
import { ObservableCreate } from './util/rxjs'
import { checkAbortSignal, observeAbortSignal } from './util'
Expand Down
1 change: 1 addition & 0 deletions packages/core/components/ResizeHandleHorizontal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const styles = {
class ResizeHandleHorizontal extends Component {
static propTypes = {
classes: ReactPropTypes.objectOf(ReactPropTypes.string).isRequired,
style: ReactPropTypes.shape().isRequired,
objectId: ReactPropTypes.string.isRequired,
onVerticalDrag: ReactPropTypes.func.isRequired,
}
Expand Down
4 changes: 4 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
"whatwg-fetch": "^3.0.0"
},
"peerDependencies": {
"@material-ui/core": "^4.0.0",
"mobx": "^5.0.0",
"mobx-react": "^6.0.0",
"mobx-state-tree": "3.10.2",
"prop-types": "^15.0.0",
"react": "^16.8.0",
"react-dom": "^16.8.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { renderToString } from 'react-dom/server'
import { filter, ignoreElements, tap } from 'rxjs/operators'
import { getSnapshot } from 'mobx-state-tree'
import { readConfObject } from '../../configuration'
import { checkAbortSignal, iterMap } from '../../util'
import SimpleFeature from '../../util/simpleFeature'
Expand Down
1 change: 0 additions & 1 deletion packages/core/rpc/RpcManager.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { decorate, observable } from 'mobx'
import { getSnapshot, isStateTreeNode, isAlive } from 'mobx-state-tree'
import { readConfObject } from '../configuration'

Expand Down
33 changes: 0 additions & 33 deletions packages/core/util/color.ts

This file was deleted.

Loading