Skip to content

Commit

Permalink
Fix for missing INFO.STRANDS tag for TRA features in breakpoint split…
Browse files Browse the repository at this point in the history
… view (#4232)
  • Loading branch information
cmdcolin committed Feb 22, 2024
1 parent c53e444 commit ba46c26
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ import { BreakpointViewModel, LayoutRecord } from '../model'

const [LEFT] = [0, 1, 2, 3]

function str(s: string) {
if (s === '+') {
return 1
} else if (s === '-') {
return -1
} else {
return 0
}
}

const Translocations = observer(function ({
model,
trackId,
Expand Down Expand Up @@ -78,7 +88,8 @@ const Translocations = observer(function ({
const info = f1.get('INFO')
const chr2 = info.CHR2[0]
const end2 = info.END[0]
const [myDirection, mateDirection] = info.STRANDS[0].split('')
const res = info.STRANDS?.[0]?.split('') // not all files have STRANDS
const [myDirection, mateDirection] = res ?? ['.', '.']

const r = getPxFromCoordinate(views[level2], chr2, end2)
if (r) {
Expand All @@ -102,7 +113,7 @@ const Translocations = observer(function ({

const path = [
'M', // move to
x1 - 20 * (myDirection === '+' ? 1 : -1) * (reversed1 ? -1 : 1),
x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
y1,
'L', // line to
x1,
Expand All @@ -111,7 +122,7 @@ const Translocations = observer(function ({
x2,
y2,
'L', // line to
x2 - 20 * (mateDirection === '+' ? 1 : -1) * (reversed2 ? -1 : 1),
x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
y2,
].join(' ')
ret.push(
Expand Down
2 changes: 1 addition & 1 deletion products/jbrowse-web/src/tests/JBrowse.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ test('looks at about this track dialog', async () => {
const { findByTestId, findAllByText, findByText } = await createView()

// load track
fireEvent.click(await findByTestId(hts('volvox-long-reads-cram')))
fireEvent.click(await findByTestId(hts('volvox-long-reads-cram'), {}, delay))
fireEvent.click(await findByTestId('track_menu_icon', {}, delay))
fireEvent.click(await findByText('About track'))
await findAllByText(/SQ/, {}, delay)
Expand Down

0 comments on commit ba46c26

Please sign in to comment.