Spaces:
Sleeping
Sleeping
Commit
•
65c9710
1
Parent(s):
e8b587f
fix plot
Browse files
app.py
CHANGED
@@ -495,14 +495,31 @@ elif selected_model == 'Cas12':
|
|
495 |
# Exon visualization
|
496 |
for exon in exons:
|
497 |
exon_start, exon_end = exon['start'], exon['end']
|
498 |
-
fig.add_trace(go.Bar(
|
499 |
-
|
|
|
|
|
|
|
|
|
|
|
500 |
# Prediction visualization
|
501 |
-
for
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
506 |
st.plotly_chart(fig)
|
507 |
|
508 |
# File generation and download
|
|
|
495 |
# Exon visualization
|
496 |
for exon in exons:
|
497 |
exon_start, exon_end = exon['start'], exon['end']
|
498 |
+
fig.add_trace(go.Bar(
|
499 |
+
x=[(exon_start + exon_end) / 2],
|
500 |
+
y=[0.5], width=[exon_end - exon_start],
|
501 |
+
base=0, marker_color='purple',
|
502 |
+
name='Exon'
|
503 |
+
))
|
504 |
+
|
505 |
# Prediction visualization
|
506 |
+
for prediction in df.itertuples(
|
507 |
+
index=False): # use itertuples for better performance and direct attribute access
|
508 |
+
midpoint = (prediction.Start_Pos + prediction.End_Pos) / 2
|
509 |
+
fig.add_trace(go.Scatter(
|
510 |
+
x=[midpoint],
|
511 |
+
y=[1], # adjust y-value as needed for visualization purposes
|
512 |
+
mode='markers',
|
513 |
+
marker=dict(size=10, color='blue'),
|
514 |
+
name=f'Prediction'
|
515 |
+
))
|
516 |
+
|
517 |
+
fig.update_layout(
|
518 |
+
title='Cas12 Prediction Visualization',
|
519 |
+
xaxis_title='Position',
|
520 |
+
yaxis=dict(tickvals=[0.5, 1], ticktext=['Exons', 'Predictions']),
|
521 |
+
showlegend=True
|
522 |
+
)
|
523 |
st.plotly_chart(fig)
|
524 |
|
525 |
# File generation and download
|