Spaces:
Sleeping
Sleeping
Commit
·
379f333
1
Parent(s):
743d44b
fix
Browse files
app.py
CHANGED
@@ -190,32 +190,32 @@ if selected_model == 'Cas9':
|
|
190 |
# Initialize Plotly figure
|
191 |
fig = go.Figure()
|
192 |
|
193 |
-
#
|
194 |
-
|
195 |
-
|
196 |
|
197 |
-
#
|
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 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
|
|
|
|
208 |
name='Exon'
|
209 |
))
|
210 |
|
211 |
-
#
|
212 |
for cds in st.session_state['cds']:
|
213 |
cds_start, cds_end = cds['start'], cds['end']
|
214 |
-
fig.add_trace(go.
|
215 |
-
x=[cds_start
|
216 |
-
y=[
|
217 |
-
|
218 |
-
|
|
|
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 |
|