An intelligent AI-powered chatbot for bioinformatics education and sequence analysis. Built with FastAPI, Streamlit, and Openrouter API.
- AI Chatbot: Ask questions about bioinformatics concepts, get expert explanations
- Sequence Analysis: Upload and analyze FASTA/FASTQ files
- GC Content Calculation: Understand nucleotide composition
- ORF Detection: Find open reading frames in sequences
- Chat History: Maintain conversation context
- Multi-file Support: Analyze multiple sequences at once
- Educational Focus: Designed as a learning assistant for students
- Frontend: Streamlit (modern chat-style UI)
- Backend: FastAPI (REST API)
- AI Model: Openrouter API
- Processing: Python with optional Biopython
- Format Support: FASTA, FASTQ, FA, FNA, FQ
.
βββ README.md
βββ requirements.txt
βββ .env.example
βββ frontend/
β βββ app.py # Streamlit UI
βββ backend/
β βββ main.py # FastAPI server
βββ utils/
β βββ __init__.py
β βββ parser.py # FASTA/FASTQ parser
β βββ analysis.py # Sequence analysis
β βββ ai_utils.py # Openrouter API integration
βββ examples/
βββ sample_sequences.fasta # Example file
- Python 3.8+
- Openrouter API key (get one at https://openrouter.ai/)
- Clone/Navigate to the project
cd f:\Database\Bioinformatics\APIs- Create virtual environment (optional but recommended)
python -m venv venv
venv\Scripts\activate # Windows
# or: source venv/bin/activate # Linux/Mac- Install dependencies
pip install -r requirements.txt- Configure environment variables
# Copy .env.example to .env
copy .env.example .env
# Edit .env and add your Openrouter API key
# OPENROUTER_API_KEY=your_api_key_hereOption 1: Run both services locally
Terminal 1 - Start FastAPI Backend:
python backend/main.py
# or
uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000The backend will be available at http://localhost:8000
- Health check:
http://localhost:8000/health - Swagger docs:
http://localhost:8000/docs
Terminal 2 - Start Streamlit Frontend:
streamlit run frontend/app.pyThe frontend will open at http://localhost:8501
Option 2: Using PowerShell with concurrent execution
# Start both services in parallel
& python backend/main.py & streamlit run frontend/app.py- Upload FASTA or FASTQ files using the sidebar uploader
- Click "Analyze Sequences" button
- View results: sequence count, length, GC content, nucleotide composition
- Optionally detect ORFs
- Type any bioinformatics question in the chat input
- Examples:
- "What is GC content?"
- "Explain genome assembly"
- "Analyze the uploaded sequence"
- "What is CRISPR?"
- Upload sequences first, then ask about them
- The AI will use sequence data to provide relevant explanations
- Example: "Analyze the uploaded sequence" or "What does this GC content indicate?"
Chat with the AI bioinformatics expert
Request:
{
"query": "What is GC content?",
"chat_history": [],
"sequence_context": null
}Response:
{
"response": "GC content is...",
"error": false,
"model": "openrouter/auto"
}Analyze biological sequences
Request:
{
"content": ">sequence1\nATGC...",
"file_format": "fasta",
"detect_orfs": false
}Response:
{
"success": true,
"analysis": {
"total_sequences": 1,
"total_length": 300,
"average_length": 300,
"average_gc_content": 45.5,
"sequences": [...]
},
"orfs": null
}Health check and configuration status
Response:
{
"status": "healthy",
"api_key_configured": true,
"endpoints": {
"chat": "/chat",
"analyze": "/analyze",
"health": "/health"
}
}When you analyze sequences, you'll see:
π Sequence Analysis Results
βββββββββββββββββββββββββββ
π sample_sequences.fasta
Sequences: 4
Total Length: 3,245 bp
Avg Length: 811.25 bp
Avg GC%: 47.32%
π Detailed Sequence Info
- human_beta_globin: 146 bp, GC: 48.6%, AT: 51.4%
- mouse_beta_globin: 141 bp, GC: 47.5%, AT: 52.5%
- ecoli_dnaA: 1,290 bp, GC: 50.5%, AT: 49.5%
- salmonella_flagellin: 1,668 bp, GC: 45.2%, AT: 54.8%
# Openrouter API key (required)
OPENROUTER_API_KEY=sk_xxxxxxxxxx
# Backend URL (optional, defaults to localhost:8000)
BACKEND_URL=http://localhost:8000| Format | Extensions | Description |
|---|---|---|
| FASTA | .fasta, .fa, .fna | Sequence with headers starting with > |
| FASTQ | .fastq, .fq | Sequence with quality scores |
| Text | .txt | Plain text (auto-detect format) |
- "What is GC content?"
- "Explain RNA-seq"
- "What is genome assembly?"
- "How does CRISPR work?"
- "What is BLAST?"
- "Analyze this sequence"
- "Why is this GC content high?"
- "What organism might have this composition?"
- "Explain these results"
- "I'm learning bioinformatics, where should I start?"
- "What's the difference between DNA and RNA?"
- "Explain nucleotides"
- "What is a gene?"
- Make sure FastAPI is running:
python backend/main.py - Check that port 8000 is not in use:
netstat -ano | findstr :8000
- Create
.envfile withOPENROUTER_API_KEY=your_key - Restart the application
- Get an API key at https://openrouter.ai/
- Supported extensions: .fasta, .fa, .fna, .fastq, .fq, .txt
- Ensure file starts with
>for FASTA or@for FASTQ
- Check internet connection
- Verify Openrouter API key is valid
- Try again (might be a temporary issue)
>sequence_1 description here
ATGCGATCGATCGATCGATCG
ATGCGATCGATCGATCGATCG
>sequence_2 another description
GCTAGCTAGCTAGCTAGCTAG
@sequence_1
ATGCGATCGATCGATCGATCG
+
IIIIIIIIIIIIIIIIIIII
@sequence_2
GCTAGCTAGCTAGCTAGCTAG
+
IIIIIIIIIIIIIIIIIIII
- Formula: (G + C) / Total Length Γ 100%
- Significance:
- Indicates organism type and genomic stability
- High GC = thermostable, often in extreme environments
- Low GC = found in AT-rich organisms
- A (Adenine): Purine, pairs with T
- T (Thymine): Pyrimidine, pairs with A
- G (Guanine): Purine, pairs with C
- C (Cytosine): Pyrimidine, pairs with G
- Sequence between start (ATG) and stop (TAA, TAG, TGA) codons
- Potential protein-coding region
- Multiple reading frames possible
Found a bug or have a feature request? Please open an issue or submit a PR!
This project is open source and available under the MIT License.
- Issues: Open an issue on GitHub
- Questions: Check the FAQ in the sidebar
- API Docs: Visit
http://localhost:8000/docswhen backend is running
For more information about Openrouter API, visit: https://openrouter.ai/
AI-Powered Bioinformatics Education & Sequence Analysis Platform for assisting patients