Skip to content

Commit

Permalink
1. Add backgroud color for topLevelFeature
Browse files Browse the repository at this point in the history
2. Fix featureInThisRow not Iterable
  • Loading branch information
shashankbrgowda committed Oct 10, 2024
1 parent c3c59b7 commit 25dfc87
Showing 1 changed file with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,31 @@ function draw(
const rowHeight = apolloRowHeight
const exonHeight = Math.round(0.6 * rowHeight)
const cdsHeight = Math.round(0.9 * rowHeight)
const { strand } = feature
const { children } = feature
const { children, min, strand } = feature

Check warning on line 64 in packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts#L64

Added line #L64 was not covered by tests
if (!children) {
return
}
const { apolloSelectedFeature } = session
const topLevelFeatureMinX =
(lgv.bpToPx({
refName,
coord: min,
regionNumber: displayedRegionIndex,
})?.offsetPx ?? 0) - offsetPx
const topLevelFeatureWidthPx = feature.length / bpPerPx

Check warning on line 75 in packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts#L74-L75

Added lines #L74 - L75 were not covered by tests
const topLevelFeatureStartPx = reversed
? topLevelFeatureMinX - topLevelFeatureWidthPx
: topLevelFeatureMinX
const topLevelFeatureTop = row * rowHeight
const topLevelFeatureHeight = getRowCount(feature) * rowHeight

Check warning on line 80 in packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts#L77-L80

Added lines #L77 - L80 were not covered by tests

ctx.fillStyle = alpha(theme?.palette.tertiary.main ?? 'rgb(255,0,0)', 0.2)
ctx.fillRect(

Check warning on line 83 in packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts

View check run for this annotation

Codecov / codecov/patch

packages/jbrowse-plugin-apollo/src/LinearApolloDisplay/glyphs/GeneGlyph.ts#L83

Added line #L83 was not covered by tests
topLevelFeatureStartPx,
topLevelFeatureTop,
topLevelFeatureWidthPx,
topLevelFeatureHeight,
)

// Draw lines on different rows for each mRNA
let currentRow = 0
Expand Down Expand Up @@ -289,7 +308,8 @@ function getFeatureFromLayout(
bp: number,
row: number,
): AnnotationFeature | undefined {
const featureInThisRow: AnnotationFeature[] = featuresForRow(feature)[row]
const featureInThisRow: AnnotationFeature[] =
featuresForRow(feature)[row] || []
for (const f of featureInThisRow) {
if (bp >= f.min && bp <= f.max && f.parent) {
return f
Expand Down

0 comments on commit 25dfc87

Please sign in to comment.