Jayesh13 commited on
Commit
c3138dd
·
verified ·
1 Parent(s): 7864aaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -239,28 +239,28 @@ if app_choice == "🔁 Protein Repeat Finder":
239
  result_df = pd.DataFrame(rows)
240
  st.dataframe(result_df)
241
 
242
- if st.checkbox("Repeat Cluster Visualization"):
243
- repeat_counts = defaultdict(int)
244
- for seq_data in st.session_state.all_sequences_data:
245
- for _, _, freq_dict in seq_data:
246
- for repeat, count in freq_dict.items():
247
- repeat_counts[repeat] += count
248
-
249
- if repeat_counts:
250
- sorted_repeats = sorted(repeat_counts.items(), key=lambda x: x[1], reverse=True)
251
- top_n = st.slider("Select number of top repeats to visualize", min_value=5, max_value=50, value=20)
252
- top_repeats = sorted_repeats[:top_n]
253
- repeats, counts = zip(*top_repeats)
254
-
255
- plt.figure(figsize=(12, 6))
256
- sns.barplot(x=list(repeats), y=list(counts), palette="viridis")
257
- plt.xticks(rotation=45, ha='right')
258
- plt.xlabel("Repeats")
259
- plt.ylabel("Total Frequency")
260
- plt.title("Top Repeat Clusters Across All Sequences")
261
- st.pyplot(plt.gcf())
262
- else:
263
- st.warning("No repeat data available to visualize. Please upload files first.")
264
 
265
 
266
 
 
239
  result_df = pd.DataFrame(rows)
240
  st.dataframe(result_df)
241
 
242
+ # if st.checkbox("Repeat Cluster Visualization"):
243
+ # repeat_counts = defaultdict(int)
244
+ # for seq_data in st.session_state.all_sequences_data:
245
+ # for _, _, freq_dict in seq_data:
246
+ # for repeat, count in freq_dict.items():
247
+ # repeat_counts[repeat] += count
248
+
249
+ # if repeat_counts:
250
+ # sorted_repeats = sorted(repeat_counts.items(), key=lambda x: x[1], reverse=True)
251
+ # top_n = st.slider("Select number of top repeats to visualize", min_value=5, max_value=50, value=20)
252
+ # top_repeats = sorted_repeats[:top_n]
253
+ # repeats, counts = zip(*top_repeats)
254
+
255
+ # plt.figure(figsize=(12, 6))
256
+ # sns.barplot(x=list(repeats), y=list(counts), palette="viridis")
257
+ # plt.xticks(rotation=45, ha='right')
258
+ # plt.xlabel("Repeats")
259
+ # plt.ylabel("Total Frequency")
260
+ # plt.title("Top Repeat Clusters Across All Sequences")
261
+ # st.pyplot(plt.gcf())
262
+ # else:
263
+ # st.warning("No repeat data available to visualize. Please upload files first.")
264
 
265
 
266