Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export const LinearApolloSixFrameDisplay = observer(
contextMenuItems: getContextMenuItems,
cursor,
featuresHeight,
featureLabelSpacer,
geneTrackRowNums,
isShown,
onMouseDown,
Expand All @@ -55,6 +54,7 @@ export const LinearApolloSixFrameDisplay = observer(
setOverlayCanvas,
setTheme,
showCheckResults,
showFeatureLabels,
} = model
const { classes } = useStyles()
const lgv = getContainingView(model) as unknown as LinearGenomeViewModel
Expand Down Expand Up @@ -188,15 +188,19 @@ export const LinearApolloSixFrameDisplay = observer(
let row
for (const loc of feature.cdsLocations) {
for (const cds of loc) {
let rowNum: number = getFrame(
const frame = getFrame(
cds.min,
cds.max,
feature.strand ?? 1,
cds.phase,
)
rowNum = featureLabelSpacer(
rowNum < 0 ? -1 * rowNum + 5 : rowNum,
)
const frameOffsets = showFeatureLabels
? [0, 5, 3, 1, 15, 13, 11]
: [0, 2, 1, 0, 8, 7, 6]
const rowNum = frameOffsets.at(frame)
if (!rowNum) {
continue
}
if (
checkResult.start >= cds.min &&
checkResult.start <= cds.max
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,14 @@ function draw(
cdsStartPx = reversed ? minX - cdsWidthPx : minX
ctx.fillStyle = theme.palette.text.primary
const frame = getFrame(cds.min, cds.max, child.strand ?? 1, cds.phase)
const frameAdjust =
(frame < 0 ? -1 * frame + 5 : frame) * featureLabelSpacer
cdsTop = (frameAdjust - featureLabelSpacer) * rowHeight
const frameOffsets = showFeatureLabels
? [0, 4, 2, 0, 14, 12, 10]
: [0, 2, 1, 0, 7, 6, 5]
const row = frameOffsets.at(frame)
if (row === undefined) {
continue
}
cdsTop = row * rowHeight
ctx.fillRect(cdsStartPx, cdsTop, cdsWidthPx, cdsHeight)

// Draw lines to connect CDS features with shared mRNA parent
Expand Down Expand Up @@ -525,9 +530,14 @@ function drawHover(
})?.offsetPx ?? 0) - offsetPx
const cdsStartPx = reversed ? minX - cdsWidthPx : minX
const frame = getFrame(cds.min, cds.max, strand ?? 1, cds.phase)
const frameAdjust =
(frame < 0 ? -1 * frame + 5 : frame) * featureLabelSpacer
const cdsTop = (frameAdjust - featureLabelSpacer) * rowHeight
const frameOffsets = showFeatureLabels
? [0, 4, 2, 0, 14, 12, 10]
: [0, 2, 1, 0, 7, 6, 5]
const row = frameOffsets.at(frame)
if (row === undefined) {
continue
}
const cdsTop = row * rowHeight
if (counter > 1) {
// Mid-point for intron line "hat"
const midPoint: [number, number] = [
Expand Down Expand Up @@ -759,8 +769,6 @@ function drawTooltip(
const displayedRegion = displayedRegions[layoutIndex]
const { refName, reversed } = displayedRegion
const rowHeight = apolloRowHeight
const cdsHeight = Math.round(0.7 * rowHeight)
const featureLabelSpacer = showFeatureLabels ? 2 : 1
let location = 'Loc: '
let cds: TranscriptPartCoding | undefined = undefined
for (const loc of feature.cdsLocations) {
Expand All @@ -784,9 +792,14 @@ function drawTooltip(
regionNumber: layoutIndex,
})?.offsetPx ?? 0) - offsetPx
const frame = getFrame(min, max, strand ?? 1, phase)
const frameAdjust = (frame < 0 ? -1 * frame + 5 : frame) * featureLabelSpacer
const cdsTop =
(frameAdjust - featureLabelSpacer) * rowHeight + (rowHeight - cdsHeight) / 2
const frameOffsets = showFeatureLabels
? [0, 4, 2, 0, 14, 12, 10]
: [0, 2, 1, 0, 7, 6, 5]
const row = frameOffsets.at(frame)
if (row === undefined) {
return
}
const cdsTop = row * rowHeight
const cdsWidthPx = (max - min) / bpPerPx

const featureType = `Type: ${cds.type}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,15 +159,19 @@ export function layoutsModelFactory(
}
for (const cdsRow of cdsLocations) {
for (const cds of cdsRow) {
let rowNum: number = getFrame(
const frame = getFrame(
cds.min,
cds.max,
strand ?? 1,
cds.phase,
)
rowNum = self.featureLabelSpacer(
rowNum < 0 ? -1 * rowNum + 5 : rowNum,
)
const frameOffsets = self.showFeatureLabels
? [0, 5, 3, 1, 15, 13, 11]
: [0, 2, 1, 0, 8, 7, 6]
const rowNum = frameOffsets.at(frame)
if (!rowNum) {
continue
}
if (!featureLayout.get(rowNum)) {
featureLayout.set(rowNum, [])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,16 @@ export function mouseEventsModelIntermediateFactory(
}
for (const loc of feature.cdsLocations) {
for (const cds of loc) {
let rowNum: number = getFrame(
const frame = getFrame(
cds.min,
cds.max,
feature.strand ?? 1,
cds.phase,
)
rowNum = self.featureLabelSpacer(
rowNum < 0 ? -1 * rowNum + 5 : rowNum,
)
const frameOffsets = self.showFeatureLabels
? [0, 5, 3, 1, 15, 13, 11]
: [0, 2, 1, 0, 8, 7, 6]
const rowNum = frameOffsets.at(frame)
if (row === rowNum && bp >= cds.min && bp <= cds.max) {
return (
featureID === undefined ||
Expand Down