Skip to content

Commit

Permalink
Bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jun 17, 2024
1 parent d267d8d commit 9254752
Show file tree
Hide file tree
Showing 7 changed files with 6,081 additions and 6,732 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ import {
isSelectionContainer,
isSessionModelWithWidgets,
isFeature,
mergeIntervals,
Feature,
} from '@jbrowse/core/util'
import { BaseBlock } from '@jbrowse/core/util/blockTypes'
import CompositeMap from '@jbrowse/core/util/compositeMap'
import { getParentRenderProps } from '@jbrowse/core/util/tracks'
import { autorun } from 'mobx'
import { addDisposer, isAlive, types,

import { autorun, when } from 'mobx'
import {
addDisposer,
isAlive,
getSnapshot,
Instance } from 'mobx-state-tree'
types,
Instance,
} from 'mobx-state-tree'

// icons
import MenuOpenIcon from '@mui/icons-material/MenuOpen'
Expand All @@ -33,7 +37,6 @@ import BlockState from './serverSideRenderedBlock'
import configSchema from './configSchema'
import TrackHeightMixin from './TrackHeightMixin'
import FeatureDensityMixin from './FeatureDensityMixin'
import { nanoid } from '@jbrowse/core/util/nanoid'

type LGV = LinearGenomeViewModel

Expand Down Expand Up @@ -306,6 +309,23 @@ function stateModelFactory() {
* #method
*/
contextMenuItems(): MenuItem[] {
const { contextMenuFeature } = self
const singleTranscript = contextMenuFeature?.get('subfeatures')?.[0]
const exons =
singleTranscript
?.get('subfeatures')
?.filter(
f => f.get('type') === 'exon' || f.get('type') === 'CDS',
) || []
const cds =
singleTranscript
?.get('subfeatures')
?.filter(
f => f.get('type') === 'exon' || f.get('type') === 'CDS',
) || []

// some GFF3 features have CDS and no exon subfeatures
const subs = exons.length ? exons : cds.length ? cds : []
return [
...(self.contextMenuFeature
? [
Expand All @@ -327,47 +347,44 @@ function stateModelFactory() {
}
},
},
{
label: 'Collapse introns',
onClick: async () => {
const { contextMenuFeature } = self
if (contextMenuFeature) {
const refName = contextMenuFeature.get('refName')
const view = getContainingView(self) as LGV
const singleTranscript =
contextMenuFeature.get('subfeatures')?.[0]
const res =
singleTranscript
?.get('subfeatures')
?.filter(f => f.get('type') === 'exon')
.map(f => ({
refName,
start: f.get('start') - 100,
end: f.get('end') + 100,
assemblyName: view.assemblyNames[0],
})) || []
res.sort((a, b) => a.start - b.start)
...(exons.length > 0 && contextMenuFeature
? [
{
label: 'Collapse introns',
onClick: async () => {
const refName = contextMenuFeature.get('refName')
const view = getContainingView(self) as LGV
const w = 100
const res = mergeIntervals(
subs.map(f => ({
refName,
start: f.get('start') - w,
end: f.get('end') + w,
assemblyName: view.assemblyNames[0],
})),
w,
)

// need to strip ID before copying view snap
const { id, ...rest } = getSnapshot(view)
const newView = getSession(self).addView(
'LinearGenomeView',
{
...rest,
id: nanoid(),
tracks: rest.tracks.map(track => {
const { id, ...rest } = track
return { ...rest, id: nanoid() }
}),
displayedRegions: res,
},
) as LGV
await when(() => newView.initialized)
// need to strip ID before copying view snap
const { id, ...rest } = getSnapshot(view)
const newView = getSession(self).addView(
'LinearGenomeView',
{
...rest,
tracks: rest.tracks.map(track => {
const { id, ...rest } = track
return { ...rest }
}),
displayedRegions: res,
},
) as LGV
await when(() => newView.initialized)

newView.showAllRegions()
}
},
},
newView.showAllRegions()
},
},
]
: []),
]
: []),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,6 @@ export function renderBlockData(
const layoutId = getContainingView(display).id
const cannotBeRenderedReason = display.regionCannotBeRendered(self.region)

const asm = assemblyManager.get(regionAsm)!
const regions = [getSnapshot(self.region)]
const parentRegions = regions.map(region => {
const r = asm?.getCanonicalRefName(region.refName)
return asm.regions?.find(b => b.refName === r)
})
return {
rendererType,
rpcManager,
Expand All @@ -261,8 +255,7 @@ export function renderBlockData(
}
},
assemblyName: self.region.assemblyName,
regions,
parentRegions,
regions: [getSnapshot(self.region)],
adapterConfig,
rendererType: rendererType.name,
sessionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,14 @@ const Controls = ({ model }: { model: LGV }) => {
}

const LinearGenomeViewHeader = observer(({ model }: { model: LGV }) => {
const Wrapper = model.hideHeaderOverview ? React.Fragment : OverviewScalebar
return !model.hideHeader ? (
<Wrapper model={model}>
model.hideHeaderOverview ? (
<Controls model={model} />
</Wrapper>
) : (
<OverviewScalebar model={model}>
<Controls model={model} />
</OverviewScalebar>
)
) : null
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import DivRenderingConfigSchema from '../configSchema'
test('renders with one, zoomed way out', () => {
const { container } = render(
<DivSequenceRendering
rowHeight={13}
regions={[
{ assemblyName: 'volvox', refName: 'zonk', start: 0, end: 1000 },
]}
Expand Down Expand Up @@ -39,7 +38,6 @@ test('renders with one, zoomed way out', () => {
test('renders with one feature with no seq, zoomed in, should throw', () => {
const { container } = render(
<DivSequenceRendering
rowHeight={13}
regions={[
{ assemblyName: 'volvox', refName: 'zonk', start: 0, end: 1000 },
]}
Expand Down Expand Up @@ -70,7 +68,6 @@ test('renders with one feature with no seq, zoomed in, should throw', () => {
test('renders with one feature with an incorrect seq, zoomed in, should throw', () => {
const { container } = render(
<DivSequenceRendering
rowHeight={13}
regions={[
{ assemblyName: 'volvox', refName: 'zonk', start: 0, end: 1000 },
]}
Expand Down Expand Up @@ -102,7 +99,6 @@ test('renders with one feature with an incorrect seq, zoomed in, should throw',
test('renders with one feature with a correct seq, zoomed in, should render nicely', () => {
const { container } = render(
<DivSequenceRendering
rowHeight={13}
regions={[
{ assemblyName: 'volvox', refName: 'zonk', start: 0, end: 1000 },
]}
Expand Down Expand Up @@ -134,7 +130,6 @@ test('renders with one feature with a correct seq, zoomed in, should render nice
test('renders with one feature reversed with a correct seq, zoomed in, should render nicely', () => {
const { container } = render(
<DivSequenceRendering
rowHeight={13}
regions={[
{
assemblyName: 'volvox',
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion plugins/svg/src/SvgFeatureRenderer/components/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export interface Glyph
selected?: boolean
config: AnyConfigurationModel
region: Region
parentRegion: Region
bpPerPx: number
topLevel?: boolean
[key: string]: unknown
Expand Down
Loading

0 comments on commit 9254752

Please sign in to comment.