supercat666 commited on
Commit
379f333
1 Parent(s): 743d44b
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -190,32 +190,32 @@ if selected_model == 'Cas9':
190
  # Initialize Plotly figure
191
  fig = go.Figure()
192
 
193
- # Adjust these constants for appearance
194
- LINE_WIDTH = 2 # Width of EXON and CDS lines
195
- EXON_OPACITY = 0.5 # Make exon lines semi-transparent
196
 
197
- # Ensure EXON and CDS are drawn at the same Y position on the X-axis
198
- EXON_CDS_Y_POS = 0 # Directly on the X-axis
199
-
200
- # Draw EXONs
201
  for exon in st.session_state['exons']:
202
  exon_start, exon_end = exon['start'], exon['end']
203
- fig.add_trace(go.Scatter(
204
- x=[exon_start, exon_end],
205
- y=[EXON_CDS_Y_POS, EXON_CDS_Y_POS],
206
- mode='lines',
207
- line=dict(color='purple', width=LINE_WIDTH, opacity=EXON_OPACITY),
 
 
208
  name='Exon'
209
  ))
210
 
211
- # Draw CDSs
212
  for cds in st.session_state['cds']:
213
  cds_start, cds_end = cds['start'], cds['end']
214
- fig.add_trace(go.Scatter(
215
- x=[cds_start, cds_end],
216
- y=[EXON_CDS_Y_POS, EXON_CDS_Y_POS],
217
- mode='lines',
218
- line=dict(color='blue', width=LINE_WIDTH + 1), # Slightly thicker than EXON
 
219
  name='CDS'
220
  ))
221
 
 
190
  # Initialize Plotly figure
191
  fig = go.Figure()
192
 
193
+ EXON_HEIGHT = 0.03 # How 'tall' the exon markers should appear
194
+ CDS_HEIGHT = 0.05 # How 'tall' the CDS markers should appear
195
+ Y_POS = -0.1 # Position on the Y axis to place these markers
196
 
197
+ # Plot Exons as small markers on the X-axis
 
 
 
198
  for exon in st.session_state['exons']:
199
  exon_start, exon_end = exon['start'], exon['end']
200
+ # Using bars for better control over width and position
201
+ fig.add_trace(go.Bar(
202
+ x=[(exon_start + exon_end) / 2], # Position at the center of the exon
203
+ y=[EXON_HEIGHT],
204
+ width=[exon_end - exon_start], # Width of the bar is the exon length
205
+ base=[Y_POS],
206
+ marker_color='rgba(128, 0, 128, 0.5)', # Purple color with transparency
207
  name='Exon'
208
  ))
209
 
210
+ # Plot CDS in a similar manner
211
  for cds in st.session_state['cds']:
212
  cds_start, cds_end = cds['start'], cds['end']
213
+ fig.add_trace(go.Bar(
214
+ x=[(cds_start + cds_end) / 2], # Position at the center of the CDS
215
+ y=[CDS_HEIGHT],
216
+ width=[cds_end - cds_start], # Width of the bar is the CDS length
217
+ base=[Y_POS - EXON_HEIGHT], # Slightly offset from the exons
218
+ marker_color='rgba(0, 0, 255, 1)', # Blue color, more solid
219
  name='CDS'
220
  ))
221