supercat666 commited on
Commit
65c9710
1 Parent(s): e8b587f
Files changed (1) hide show
  1. app.py +24 -7
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(x=[(exon_start + exon_end) / 2], y=[0.5], width=[exon_end - exon_start], base=0,
499
- marker_color='purple', name='Exon'))
 
 
 
 
 
500
  # Prediction visualization
501
- for i, prediction in enumerate(df.itertuples(), start=1):
502
- fig.add_trace(go.Scatter(x=[(prediction.Start_Pos + prediction.End_Pos) / 2], y=[1], mode='markers',
503
- marker=dict(size=10, color='blue'), name=f'Prediction {i}'))
504
- fig.update_layout(title='Cas12 Prediction Visualization', xaxis_title='Position',
505
- yaxis=dict(tickvals=[0.5, 1], ticktext=['Exons', 'Predictions']), showlegend=True)
 
 
 
 
 
 
 
 
 
 
 
 
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