Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -649,7 +649,7 @@ def run_pipeline(dna_input, similarity_score=95.0, build_ml_tree=False):
|
|
| 649 |
else:
|
| 650 |
ml_tree_output = "Phylogenetic placement skipped (not requested)"
|
| 651 |
|
| 652 |
-
|
| 653 |
html_file = None
|
| 654 |
tree_html_content = "No tree generated"
|
| 655 |
simplified_ml_output = ""
|
|
@@ -673,13 +673,13 @@ def run_pipeline(dna_input, similarity_score=95.0, build_ml_tree=False):
|
|
| 673 |
with open(html_filename, 'r', encoding='utf-8') as f:
|
| 674 |
tree_html_content = f.read()
|
| 675 |
|
| 676 |
-
|
| 677 |
-
|
| 678 |
else:
|
| 679 |
simplified_ml_output = tree_result or "❌ Failed to generate tree visualization"
|
| 680 |
logging.warning("Tree analysis failed or no HTML output generated")
|
| 681 |
|
| 682 |
-
|
| 683 |
simplified_ml_output = f"❌ Simplified ML tree analysis failed: {str(e)}"
|
| 684 |
logging.error(f"Simplified ML tree analysis failed: {e}")
|
| 685 |
elif not analyzer:
|
|
@@ -687,7 +687,7 @@ def run_pipeline(dna_input, similarity_score=95.0, build_ml_tree=False):
|
|
| 687 |
elif len(processed_sequence) < 10:
|
| 688 |
simplified_ml_output = "❌ Sequence too short for tree analysis (minimum 10 bp)"
|
| 689 |
else:
|
| 690 |
-
simplified_ml_output = "Tree analysis skipped"
|
| 691 |
# Prepare final outputs
|
| 692 |
final_boundary_output = f"F gene sequence ({len(processed_sequence)} bp):\n{boundary_output}"
|
| 693 |
final_keras_output = f"F gene validation: {keras_output}"
|
|
|
|
| 649 |
else:
|
| 650 |
ml_tree_output = "Phylogenetic placement skipped (not requested)"
|
| 651 |
|
| 652 |
+
# Step 4: NEW Simplified Tree Analysis (using the new analyzer API)
|
| 653 |
html_file = None
|
| 654 |
tree_html_content = "No tree generated"
|
| 655 |
simplified_ml_output = ""
|
|
|
|
| 673 |
with open(html_filename, 'r', encoding='utf-8') as f:
|
| 674 |
tree_html_content = f.read()
|
| 675 |
|
| 676 |
+
simplified_ml_output = tree_result
|
| 677 |
+
logging.info(f"Tree analysis completed successfully. HTML saved to: {html_filename}")
|
| 678 |
else:
|
| 679 |
simplified_ml_output = tree_result or "❌ Failed to generate tree visualization"
|
| 680 |
logging.warning("Tree analysis failed or no HTML output generated")
|
| 681 |
|
| 682 |
+
except Exception as e:
|
| 683 |
simplified_ml_output = f"❌ Simplified ML tree analysis failed: {str(e)}"
|
| 684 |
logging.error(f"Simplified ML tree analysis failed: {e}")
|
| 685 |
elif not analyzer:
|
|
|
|
| 687 |
elif len(processed_sequence) < 10:
|
| 688 |
simplified_ml_output = "❌ Sequence too short for tree analysis (minimum 10 bp)"
|
| 689 |
else:
|
| 690 |
+
simplified_ml_output = "Tree analysis skipped"
|
| 691 |
# Prepare final outputs
|
| 692 |
final_boundary_output = f"F gene sequence ({len(processed_sequence)} bp):\n{boundary_output}"
|
| 693 |
final_keras_output = f"F gene validation: {keras_output}"
|