Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -223,7 +223,6 @@ def compute_gc_content(sequence):
|
|
| 223 |
###############################################################################
|
| 224 |
# 7. MAIN ANALYSIS STEP (Gradio Step 1)
|
| 225 |
###############################################################################
|
| 226 |
-
|
| 227 |
def create_kmer_shap_csv(kmers, shap_values):
|
| 228 |
"""Create a CSV file with k-mer SHAP values and return the filepath"""
|
| 229 |
# Create DataFrame with k-mers and SHAP values
|
|
@@ -244,7 +243,7 @@ def create_kmer_shap_csv(kmers, shap_values):
|
|
| 244 |
temp_path = os.path.join(temp_dir, f"kmer_shap_values_{os.urandom(4).hex()}.csv")
|
| 245 |
kmer_df.to_csv(temp_path, index=False)
|
| 246 |
|
| 247 |
-
return temp_path,
|
| 248 |
|
| 249 |
def analyze_sequence(file_obj, top_kmers=10, fasta_text="", window_size=500):
|
| 250 |
if fasta_text.strip():
|
|
@@ -313,7 +312,7 @@ def analyze_sequence(file_obj, top_kmers=10, fasta_text="", window_size=500):
|
|
| 313 |
state_dict_out = {"seq": seq, "shap_means": shap_means}
|
| 314 |
|
| 315 |
return (results_text, bar_img, heatmap_img, state_dict_out, header, None, kmer_shap_csv)
|
| 316 |
-
|
| 317 |
###############################################################################
|
| 318 |
# 8. SUBREGION ANALYSIS (Gradio Step 2)
|
| 319 |
###############################################################################
|
|
|
|
| 223 |
###############################################################################
|
| 224 |
# 7. MAIN ANALYSIS STEP (Gradio Step 1)
|
| 225 |
###############################################################################
|
|
|
|
| 226 |
def create_kmer_shap_csv(kmers, shap_values):
|
| 227 |
"""Create a CSV file with k-mer SHAP values and return the filepath"""
|
| 228 |
# Create DataFrame with k-mers and SHAP values
|
|
|
|
| 243 |
temp_path = os.path.join(temp_dir, f"kmer_shap_values_{os.urandom(4).hex()}.csv")
|
| 244 |
kmer_df.to_csv(temp_path, index=False)
|
| 245 |
|
| 246 |
+
return temp_path # Return only the file path, not a tuple
|
| 247 |
|
| 248 |
def analyze_sequence(file_obj, top_kmers=10, fasta_text="", window_size=500):
|
| 249 |
if fasta_text.strip():
|
|
|
|
| 312 |
state_dict_out = {"seq": seq, "shap_means": shap_means}
|
| 313 |
|
| 314 |
return (results_text, bar_img, heatmap_img, state_dict_out, header, None, kmer_shap_csv)
|
| 315 |
+
|
| 316 |
###############################################################################
|
| 317 |
# 8. SUBREGION ANALYSIS (Gradio Step 2)
|
| 318 |
###############################################################################
|