supercat666 commited on
Commit
e9b9cc0
1 Parent(s): 4527ffd
Files changed (1) hide show
  1. app.py +29 -33
app.py CHANGED
@@ -119,6 +119,16 @@ if selected_model == 'Cas9':
119
  df = pd.DataFrame(st.session_state['on_target_results'],
120
  columns=["Gene ID", "Start Pos", "End Pos", "Strand", "Target", "gRNA", "Prediction"])
121
  st.dataframe(df)
 
 
 
 
 
 
 
 
 
 
122
  # Now create a Plotly plot with the sorted_predictions
123
  fig = go.Figure()
124
 
@@ -174,42 +184,28 @@ if selected_model == 'Cas9':
174
  ),
175
  showlegend=False # Hide the legend if it's not necessary
176
  )
177
-
178
  # Display the plot
179
  st.plotly_chart(fig)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
- if 'gene_sequence' in st.session_state and st.session_state['gene_sequence']:
182
- gene_sequence = st.session_state['gene_sequence']
183
-
184
- # Define file paths
185
- genbank_file_path = f"{gene_symbol}_crispr_targets.gb"
186
- bed_file_path = f"{gene_symbol}_crispr_targets.bed"
187
- csv_file_path = f"{gene_symbol}_crispr_predictions.csv"
188
-
189
- # Generate files
190
- cas9on.generate_genbank_file_from_df(df, gene_sequence, gene_symbol, genbank_file_path)
191
- cas9on.create_bed_file_from_df(df, bed_file_path)
192
- cas9on.create_csv_from_df(df, csv_file_path)
193
-
194
- # Layout for download buttons
195
- col1, col2, col3 = st.columns(3)
196
- with col1:
197
- with open(genbank_file_path, "rb") as file:
198
- st.download_button(label="Download GenBank File", data=file, file_name=genbank_file_path,
199
- mime="text/x-genbank")
200
- with col2:
201
- with open(bed_file_path, "rb") as file:
202
- st.download_button(label="Download BED File", data=file, file_name=bed_file_path,
203
- mime="text/plain")
204
- with col3:
205
- with open(csv_file_path, "rb") as file:
206
- st.download_button(label="Download CSV File", data=file, file_name=csv_file_path,
207
- mime="text/csv")
208
-
209
- # Links for user guidance on using the downloaded files
210
- st.markdown(
211
- "GenBank files can be visualized using [PyGenomeViz](https://pygenomeviz.streamlit.app/). "
212
- "BED files can be used with the [UCSC Genome Browser](https://genome.ucsc.edu/cgi-bin/hgCustom).")
213
 
214
  elif target_selection == 'off-target':
215
  ENTRY_METHODS = dict(
 
119
  df = pd.DataFrame(st.session_state['on_target_results'],
120
  columns=["Gene ID", "Start Pos", "End Pos", "Strand", "Target", "gRNA", "Prediction"])
121
  st.dataframe(df)
122
+ # Define file paths
123
+ genbank_file_path = f"{gene_symbol}_crispr_targets.gb"
124
+ bed_file_path = f"{gene_symbol}_crispr_targets.bed"
125
+ csv_file_path = f"{gene_symbol}_crispr_predictions.csv"
126
+
127
+ # Generate files
128
+ cas9on.generate_genbank_file_from_df(df, gene_sequence, gene_symbol, genbank_file_path)
129
+ cas9on.create_bed_file_from_df(df, bed_file_path)
130
+ cas9on.create_csv_from_df(df, csv_file_path)
131
+
132
  # Now create a Plotly plot with the sorted_predictions
133
  fig = go.Figure()
134
 
 
184
  ),
185
  showlegend=False # Hide the legend if it's not necessary
186
  )
 
187
  # Display the plot
188
  st.plotly_chart(fig)
189
+ # Download buttons
190
+ col1, col2, col3 = st.columns(3)
191
+ with col1:
192
+ with open(genbank_file_path, "rb") as file:
193
+ st.download_button(label="Download GenBank File", data=file, file_name=genbank_file_path,
194
+ mime="text/x-genbank")
195
+ with col2:
196
+ with open(bed_file_path, "rb") as file:
197
+ st.download_button(label="Download BED File", data=file, file_name=bed_file_path,
198
+ mime="text/plain")
199
+ with col3:
200
+ with open(csv_file_path, "rb") as file:
201
+ st.download_button(label="Download CSV File", data=file, file_name=csv_file_path,
202
+ mime="text/csv")
203
+
204
+ # Links for user guidance on using the downloaded files
205
+ st.markdown(
206
+ "GenBank files can be visualized using [PyGenomeViz](https://pygenomeviz.streamlit.app/). "
207
+ "BED files can be used with the [UCSC Genome Browser](https://genome.ucsc.edu/cgi-bin/hgCustom).")
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  elif target_selection == 'off-target':
211
  ENTRY_METHODS = dict(