Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -451,15 +451,25 @@ def analyze_sequence_comparison(file1, file2, fasta1="", fasta2=""):
|
|
451 |
min_diff = np.min(shap_diff)
|
452 |
substantial_diffs = np.abs(shap_diff) > adaptive_threshold
|
453 |
frac_different = np.mean(substantial_diffs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
454 |
|
455 |
-
# Format detailed output
|
456 |
comparison_text = (
|
457 |
"Sequence Comparison Results:\n"
|
458 |
-
f"Sequence 1: {res1[4]}
|
459 |
-
f"
|
460 |
-
f"
|
461 |
-
f"
|
462 |
-
f"
|
|
|
|
|
463 |
f"Length Difference: {length_diff:,} bases\n"
|
464 |
f"Length Ratio: {length_ratio:.3f}\n"
|
465 |
f"Smoothing Window: {smooth_window} points\n"
|
@@ -470,7 +480,7 @@ def analyze_sequence_comparison(file1, file2, fasta1="", fasta2=""):
|
|
470 |
f"Max difference: {max_diff:.4f} (Seq2 more human-like)\n"
|
471 |
f"Min difference: {min_diff:.4f} (Seq1 more human-like)\n"
|
472 |
f"Fraction with substantial differences: {frac_different:.2%}\n\n"
|
473 |
-
"Note: All parameters automatically adjusted based on sequence properties\n"
|
474 |
"Interpretation:\n"
|
475 |
"- Red regions: Sequence 2 more human-like\n"
|
476 |
"- Blue regions: Sequence 1 more human-like\n"
|
|
|
451 |
min_diff = np.min(shap_diff)
|
452 |
substantial_diffs = np.abs(shap_diff) > adaptive_threshold
|
453 |
frac_different = np.mean(substantial_diffs)
|
454 |
+
|
455 |
+
# Get the classification info without string splitting
|
456 |
+
try:
|
457 |
+
classification1 = res1[0].split('Classification: ')[1].split('\n')[0].strip()
|
458 |
+
classification2 = res2[0].split('Classification: ')[1].split('\n')[0].strip()
|
459 |
+
except:
|
460 |
+
classification1 = "Unknown"
|
461 |
+
classification2 = "Unknown"
|
462 |
|
463 |
+
# Format detailed output with line breaks for readability
|
464 |
comparison_text = (
|
465 |
"Sequence Comparison Results:\n"
|
466 |
+
f"Sequence 1: {res1[4]}\n"
|
467 |
+
f"Length: {len1:,} bases\n"
|
468 |
+
f"Classification: {classification1}\n\n"
|
469 |
+
f"Sequence 2: {res2[4]}\n"
|
470 |
+
f"Length: {len2:,} bases\n"
|
471 |
+
f"Classification: {classification2}\n\n"
|
472 |
+
"Comparison Parameters:\n"
|
473 |
f"Length Difference: {length_diff:,} bases\n"
|
474 |
f"Length Ratio: {length_ratio:.3f}\n"
|
475 |
f"Smoothing Window: {smooth_window} points\n"
|
|
|
480 |
f"Max difference: {max_diff:.4f} (Seq2 more human-like)\n"
|
481 |
f"Min difference: {min_diff:.4f} (Seq1 more human-like)\n"
|
482 |
f"Fraction with substantial differences: {frac_different:.2%}\n\n"
|
483 |
+
"Note: All parameters automatically adjusted based on sequence properties\n\n"
|
484 |
"Interpretation:\n"
|
485 |
"- Red regions: Sequence 2 more human-like\n"
|
486 |
"- Blue regions: Sequence 1 more human-like\n"
|