Skip to content

Commit

Permalink
Misc
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 31, 2023
1 parent 7d32376 commit c0b7d70
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": [
{
"name": "MsaView",
"url": "http://localhost:9000/out.js"
"url": "http://localhost:9000/dist/out.js"
}
],
"assemblies": [
Expand Down
2 changes: 1 addition & 1 deletion esbuild.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ let ctx = await esbuild.context({
})

let { host, port } = await ctx.serve({
servedir: 'dist',
servedir: '.',
port: 9000,
host: 'localhost',
})
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
},
"scripts": {
"clean": "rimraf dist",
"prestart": "mkdir dist; cp config.json dist",
"start": "node esbuild.mjs",
"prebuild": "npm run clean",
"build": "rollup --config --bundleConfigAsCjs",
Expand Down
29 changes: 14 additions & 15 deletions src/MsaView/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ import { Instance, addDisposer, cast, types } from 'mobx-state-tree'
import { autorun } from 'mobx'
import { Region } from '@jbrowse/core/util/types/mst'
import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view'
import {
Feature,
SimpleFeature,
doesIntersect2,
getSession,
} from '@jbrowse/core/util'
import { SimpleFeature, doesIntersect2, getSession } from '@jbrowse/core/util'

type LGV = LinearGenomeViewModel
type MaybeLGV = LGV | undefined
Expand Down Expand Up @@ -44,19 +39,19 @@ export default function stateModelFactory() {
/**
* #action
*/
setHighlights(r: IRegion[]) {
setConnectedHighlights(r: IRegion[]) {
self.connectedHighlights = cast(r)
},
/**
* #action
*/
addToHighlights(r: IRegion) {
addToConnectedHighlights(r: IRegion) {
self.connectedHighlights.push(r)
},
/**
* #action
*/
clearHighlights() {
clearConnectedHighlights() {
self.connectedHighlights = cast([])
},
}))
Expand All @@ -68,7 +63,10 @@ export default function stateModelFactory() {
const f = new SimpleFeature(self.connectedFeature)
let iter = 0

const subs: Feature[] = f.get('subfeatures') || []
const strand = f.get('strand')
const children = f.children() ?? []
const subs = strand === -1 ? children.reverse() : children

return subs
.filter(f => f.get('type') === 'CDS')
.map(f => {
Expand All @@ -86,6 +84,7 @@ export default function stateModelFactory() {
featureEnd,
proteinStart,
proteinEnd,
strand,
} as const
})
},
Expand Down Expand Up @@ -150,11 +149,11 @@ export default function stateModelFactory() {
}
for (const entry of transcriptToMsaMap) {
const { featureStart, refName, proteinStart, proteinEnd } = entry
if (
doesIntersect2(proteinStart, proteinEnd, mouseCol, mouseCol + 1)
) {
const ret = (mouseCol - proteinStart) * 3
self.setHighlights([
const c = mouseCol - 1
console.log({ mouseCol })
if (doesIntersect2(proteinStart, proteinEnd, c, c + 1)) {
const ret = (c - proteinStart) * 3
self.setConnectedHighlights([
{
assemblyName: 'hg38',
refName,
Expand Down

0 comments on commit c0b7d70

Please sign in to comment.