Spaces:
No application file
No application file
Update app.py
Browse files
app.py
CHANGED
|
@@ -885,77 +885,7 @@ def create_interface():
|
|
| 885 |
interactive=False
|
| 886 |
)
|
| 887 |
|
| 888 |
-
|
| 889 |
-
gr.Markdown("""
|
| 890 |
-
## About This Tool
|
| 891 |
-
|
| 892 |
-
### F Gene Analysis Pipeline
|
| 893 |
-
This comprehensive pipeline analyzes F genes through multiple computational approaches:
|
| 894 |
-
|
| 895 |
-
#### 🎯 Gene Boundary Detection
|
| 896 |
-
- Uses deep learning to identify and extract F gene sequences from larger genomic sequences
|
| 897 |
-
- Provides confidence scores for detected boundaries
|
| 898 |
-
- Automatically trims sequences to focus on the F gene region
|
| 899 |
-
|
| 900 |
-
#### 🔍 Gene Validation
|
| 901 |
-
- Employs k-mer based machine learning models to validate extracted sequences
|
| 902 |
-
- Provides probability scores indicating likelihood of being a genuine F gene
|
| 903 |
-
- Uses 6-mer frequency patterns for classification
|
| 904 |
-
|
| 905 |
-
#### 🌳 Phylogenetic Analysis
|
| 906 |
-
|
| 907 |
-
**Maximum Likelihood Trees:**
|
| 908 |
-
- Requires MAFFT (sequence alignment) and IQ-TREE (phylogenetic reconstruction)
|
| 909 |
-
- Performs model selection and bootstrap analysis
|
| 910 |
-
- Generates publication-quality phylogenetic trees
|
| 911 |
-
- Provides detailed evolutionary analysis
|
| 912 |
-
|
| 913 |
-
**Simplified Trees:**
|
| 914 |
-
- Uses built-in algorithms for quick phylogenetic analysis
|
| 915 |
-
- Interactive visualization with similarity-based clustering
|
| 916 |
-
- Faster alternative when external tools are not available
|
| 917 |
-
|
| 918 |
-
### Input Requirements
|
| 919 |
-
- **DNA Sequences**: ATCG format, minimum 50 bp for meaningful analysis
|
| 920 |
-
- **FASTA Files**: Standard FASTA format with single or multiple sequences
|
| 921 |
-
- **Similarity Threshold**: 1-99% for controlling phylogenetic analysis sensitivity
|
| 922 |
-
|
| 923 |
-
### Dependencies
|
| 924 |
-
|
| 925 |
-
**Required for ML Trees:**
|
| 926 |
-
```bash
|
| 927 |
-
# Ubuntu/Debian
|
| 928 |
-
sudo apt-get install mafft iqtree
|
| 929 |
-
|
| 930 |
-
# macOS
|
| 931 |
-
brew install mafft iqtree
|
| 932 |
-
|
| 933 |
-
# Conda
|
| 934 |
-
conda install -c bioconda mafft iqtree
|
| 935 |
-
```
|
| 936 |
-
|
| 937 |
-
### Output Files
|
| 938 |
-
- **Aligned FASTA**: Multiple sequence alignment in FASTA format
|
| 939 |
-
- **Tree File**: Newick format phylogenetic tree
|
| 940 |
-
- **HTML Tree**: Interactive visualization for web browsers (ML Simplified Tree)
|
| 941 |
-
|
| 942 |
-
### Troubleshooting
|
| 943 |
-
|
| 944 |
-
**Common Issues:**
|
| 945 |
-
- *"No similar sequences found"*: Lower the similarity threshold
|
| 946 |
-
- *"Sequence too short"*: Provide sequences longer than 50 bp
|
| 947 |
-
- *"MAFFT/IQ-TREE not found"*: Install required dependencies
|
| 948 |
-
- *"Model not available"*: Check model files are properly downloaded
|
| 949 |
-
|
| 950 |
-
**Performance Tips:**
|
| 951 |
-
- Use sequences between 100-2000 bp for optimal performance
|
| 952 |
-
- Limit to <50 sequences for faster tree construction
|
| 953 |
-
- Lower similarity thresholds find more distant relatives
|
| 954 |
-
- Higher thresholds focus on closely related sequences
|
| 955 |
-
|
| 956 |
-
### Citation
|
| 957 |
-
If you use this tool in your research, please cite the appropriate methods and tools used.
|
| 958 |
-
""")
|
| 959 |
|
| 960 |
# Event handlers
|
| 961 |
def run_analysis_text(dna_seq, sim_score, build_tree):
|
|
@@ -981,6 +911,7 @@ def create_interface():
|
|
| 981 |
relative_path = os.path.relpath(html_file, os.getcwd())
|
| 982 |
file_url = f"/file={relative_path}"
|
| 983 |
link_html = f'<a href="{file_url}" target="_blank">View ML Simplified Tree</a>'
|
|
|
|
| 984 |
return gr.update(value=link_html)
|
| 985 |
except Exception as e:
|
| 986 |
return gr.update(value=f"<p>Error generating link: {str(e)}. Please download and open the file manually.</p>")
|
|
|
|
| 885 |
interactive=False
|
| 886 |
)
|
| 887 |
|
| 888 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 889 |
|
| 890 |
# Event handlers
|
| 891 |
def run_analysis_text(dna_seq, sim_score, build_tree):
|
|
|
|
| 911 |
relative_path = os.path.relpath(html_file, os.getcwd())
|
| 912 |
file_url = f"/file={relative_path}"
|
| 913 |
link_html = f'<a href="{file_url}" target="_blank">View ML Simplified Tree</a>'
|
| 914 |
+
print(f"Generated link for: {file_url}") # Debug log
|
| 915 |
return gr.update(value=link_html)
|
| 916 |
except Exception as e:
|
| 917 |
return gr.update(value=f"<p>Error generating link: {str(e)}. Please download and open the file manually.</p>")
|