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

Fix for missing INFO.STRANDS tag for TRA features in breakpoint split view #4232

Merged
merged 2 commits into from Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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