@@ -85,12 +85,8 @@ function renderFeature(feature, bpStart, xScale, pixelHeight, ctx, options) {
85
85
const xRight = Math . min ( pixelWidth , coord . px1 )
86
86
const width = xRight - xLeft
87
87
88
- // DUGLA HACK
89
- // ctx.fillStyle = '#cefa6e'
90
88
ctx . fillRect ( xLeft , py , width , h )
91
- // ctx.fillStyle = color
92
- // Arrows
93
- // Do not draw if strand is not +/-
89
+
94
90
if ( direction !== 0 ) {
95
91
ctx . fillStyle = "white"
96
92
ctx . strokeStyle = "white"
@@ -114,9 +110,9 @@ function renderFeature(feature, bpStart, xScale, pixelHeight, ctx, options) {
114
110
IGVGraphics . strokeLine ( ctx , x - direction * 2 , cy + 2 , x , cy )
115
111
}
116
112
117
- // console.log(`${ feature.name } exons ${ feature.exons.length }`)
113
+ for ( let i = 0 ; i < feature . exons . length ; i ++ ) {
118
114
119
- for ( const exon of feature . exons ) {
115
+ const exon = feature . exons [ i ]
120
116
121
117
// draw the exons
122
118
let ePx = Math . round ( ( exon . start - bpStart ) / xScale )
@@ -171,7 +167,10 @@ function renderFeature(feature, bpStart, xScale, pixelHeight, ctx, options) {
171
167
if ( exon . readingFrame !== undefined ) {
172
168
const width = Math . max ( 1 , Math . ceil ( 1 / options . bpPerPixel ) )
173
169
if ( width >= aminoAcidSequenceRenderThreshold ) {
174
- renderAminoAcidSequence ( ctx , exon , bpStart , options . bpPerPixel , py , h , color , feature . strand )
170
+
171
+ const leftExon = 0 === i ? undefined : feature . exons [ i - 1 ]
172
+ const riteExon = feature . exons . length - 1 === i ? undefined : feature . exons [ i + 1 ]
173
+ renderAminoAcidSequence ( ctx , feature . strand , leftExon , exon , riteExon , bpStart , options . bpPerPixel , py , h , color )
175
174
}
176
175
}
177
176
@@ -200,8 +199,7 @@ function renderFeature(feature, bpStart, xScale, pixelHeight, ctx, options) {
200
199
}
201
200
}
202
201
203
- function renderAminoAcidSequence ( ctx , exon , bpStart , bpPerPixel , y , height , featureColor , strand ) {
204
-
202
+ function renderAminoAcidSequence ( ctx , strand , leftExon , exon , riteExon , bpStart , bpPerPixel , y , height , featureColor ) {
205
203
206
204
const phase = ( 3 - exon . readingFrame ) % 3
207
205
0 commit comments