A comprehensive toolkit for analyzing viral sequences to detect recombination events, perform SNP matching, and build phylogenetic trees.
- What This Tool Does
- What You Need to Install
- Installation Guide
- Project Structure
- How to Use
- Understanding the Pipeline
- Input and Output Files
- Example Workflow
- Troubleshooting
- FAQ
Recombina helps you analyze viral DNA sequences to:
- Convert sequence alignments to SNP data — Takes a FASTA file with multiple aligned sequences and extracts variable (SNP) positions
- Filter low-quality data — Removes incomplete or ambiguous sequence regions
- Compute linkage disequilibrium (LD) — Uses Haploview to calculate how SNP variants are linked together
- Build phylogenetic trees — Creates evolutionary trees showing relationships between sequences
- Generate reports — Produces Excel summaries and colored tree visualizations
- Molecular biologists analyzing viral outbreaks or evolution
- Researchers studying viral recombination
- Anyone working with multiple aligned DNA/RNA sequences in FASTA format
- PED/INFO files — Standard format used by population genetics software (compatible with Haploview, PLINK, etc.)
- LD heatmaps — Visual representation of how SNPs are linked
- Phylogenetic trees — Evolutionary relationships between your sequences
- Excel summaries — Statistical summaries of findings
Before you start, gather these tools. Don't worry — most are free and we'll guide you through each step.
-
Python 3.8 or newer — The programming language this tool runs on
- Option A (Standard): Download from python.org
- On Windows: Install with "Add Python to PATH" checked ✓
- On Mac/Linux: Usually pre-installed (check: open terminal, type
python3 --version)
- Option B (Recommended for scientists): Use Miniconda/Anaconda instead
- Download Miniconda (lightweight, recommended)
- Or Download Anaconda (includes extra tools)
- See "Installation Guide — Using Conda" section below for setup
- Option A (Standard): Download from python.org
-
Java — Required to run Haploview (a sequence analysis tool)
- Download Java from oracle.com
- Or use OpenJDK:
brew install openjdk(Mac) orapt install default-jdk(Linux) - Check if installed: Open terminal/command prompt, type
java -version
- Haploview 4.1 — Included, no separate download needed ✓
- Python dependencies — Installed automatically in step 3 below
-
IQ-TREE — Required if you want to build phylogenetic trees
- Download from iqtree.org
- Without this: Pipeline still works, but skips tree building
- On Mac:
brew install iqtree(If homebrew is installed) - On Linux:
apt install iqtree
-
tqdm — Shows nice progress bars while running
- Installed automatically with pip in step 3 ✓
Option A: Download (Easiest for Beginners)
- Go to the project repository
- Click the green "Code" button → "Download ZIP"
- Unzip the folder to a location you'll remember (e.g.,
Documents/Recombina/)
Option B: Clone with Git (if you know Git)
git clone https://github.com/Hocket/Recombina.git
cd RecombinaA Python "environment" is like a separate workspace for this project. It keeps all the Python packages needed by this tool separate from your other Python projects.
On Windows (Command Prompt or PowerShell):
python -m venv .venv
.venv\Scripts\activateOn Mac or Linux (Terminal):
python3 -m venv .venv
source .venv/bin/activateYou'll know it worked when you see (.venv) at the start of your command prompt/terminal.
With the environment activated (you should see (.venv) in your prompt), run:
pip install -r Data/requirements/requirements.txt
pip install tqdmThis installs all the Python libraries the tool needs. It may take 1-2 minutes.
To make sure everything is installed correctly:
java -version
python --versionBoth commands should print version numbers (not "command not found").
If Java doesn't work:
- On Windows: Add Java to your PATH environment variable (search "Edit environment variables" in Windows)
- On Mac/Linux: Try
which javato find where it's installed
If you want to build phylogenetic trees:
On Mac:
brew install iqtreeOn Linux:
apt install iqtreeOn Windows:
- Download from iqtree.org
- Add the IQ-TREE folder to your PATH (search "Edit environment variables")
Check it's installed:
iqtree --versionConda is a package manager that handles both Python and non-Python packages (like Java, IQ-TREE) in one place. It's especially useful if you:
- Use multiple Python projects with different dependencies
- Work with bioinformatics tools regularly
- Want to easily share your environment setup with collaborators
- Are on a shared computing cluster
Miniconda (Lightweight — Recommended):
- Download Miniconda
- Select the version for your OS (Windows/Mac/Linux) and Python 3.10+
- Run the installer and follow prompts
- On Mac/Linux: You may need to run
source ~/miniconda3/bin/activateafter installation
Anaconda (Full Suite — Includes Extra Tools):
- Download Anaconda
- Larger download but includes many pre-installed packages
- Same installation process as Miniconda
Verify installation:
conda --versiongit clone https://github.com/Hocket/ViralRecombinant.git
cd ViralRecombinantOr download the ZIP file as described in Option 1.
The easiest method — we provide an environment file:
conda env create -f Data/requirements/environment.ymlThis creates an environment called Recombina with all dependencies.
If the environment file doesn't exist, create one manually:
conda create -n Recombina python=3.10 -y
conda activate Recombina
pip install -r Data/requirements/requirements.txt
pip install tqdmEvery time you want to use the tool, activate the conda environment:
conda activate RecombinaYou'll know it worked when you see (Recombina) in your prompt instead of (base) or nothing.
Install Java (if not already installed):
conda install -c conda-forge openjdkVerify:
java -versionInstall IQ-TREE (for phylogenetic trees):
conda install -c bioconda iqtreeVerify:
iqtree --versionjava -version
python --version
iqtree --version # only if you installed itAll should return version numbers.
When you're finished using the tool, deactivate the environment:
conda deactivate| Feature | pip (Standard) | Conda (Advanced) |
|---|---|---|
| Easiest for beginners | ✓ | - |
| Works on all systems | ✓ | ✓ |
| Handles non-Python packages | - | ✓ (Java, IQ-TREE) |
| Good for multiple projects | - | ✓ |
| Fast to set up | ✓ | - (first time slower) |
| Easy to share setup | - | ✓ (environment.yml) |
| Best for clusters/servers | - | ✓ |
Recommendation:
- Just want to run this tool once? → Use pip (Option 1)
- Do bioinformatics regularly? → Use Conda (Option 2)
- Not sure? → Start with pip, switch to conda later if needed
View all your conda environments:
conda env listExport your environment (to share with others):
conda env export > my_environment.ymlRemove an environment (if you don't need it):
conda env remove -n RecombinaUpdate all packages in the environment:
conda activate Recombina
conda update --allList installed packages:
conda activate Recombina
conda listHere's what's in your folder and what each part does:
Recombina/
│
├── Code/ # The Code behind Recombina
│ ├── fasta_to_ped.py # Converts FASTA → SNP data (PED/INFO files)
│ ├── run_matching.py # Main workflow (runs everything)
│ ├── matching.py # Helper functions for SNP analysis
│ ├── tree_utils.py # Phylogenetic tree utilities
| └── Haploview4.1.jar # Linkage disequilibrium tool (included)
│
├── Data/
│ ├── InputFiles/ # PUT YOUR SEQUENCE FILES HERE
│ │ └── (empty — add your FASTA files)
│ │
│ ├── OutputFiles/ # Results appear here automatically
| | ├── IQTree_out/
│ │ └── (created when you run the tool)
│ │
│ └── requirements/
│ └── requirements.txt # List of Python packages
│
└── README.md # Documentation
The simplest way to run the tool:
python Code/run_matching.py -a Data/InputFiles/your_alignment.fasta --haploview-jar Code/Haploview4.1.jarWhat this does:
- Reads your FASTA file from
Data/InputFiles/ - Extracts SNPs (variable positions)
- Filters out low-quality data
- Runs Haploview to compute linkage disequilibrium
- Builds a phylogenetic tree (if IQ-TREE is installed)
- Creates output files in
Data/OutputFiles/
Generate only PED/INFO files (no Haploview/trees):
python Code/run_matching.py -a Data/InputFiles/alignment.fasta --pedinfo-onlyUse this if:
- You just want the SNP data in standard format
- You want to import into other tools (PLINK, etc.)
- You don't need the LD analysis or trees
Skip IQ-TREE:
python Code/run_matching.py -a Data/InputFiles/alignment.fasta \
--haploview-jar Code/Haploview4.1.jar --skip-iqtreeUse this if:
- You just want the SNP data in standard format
- You want to import into other tools (PLINK, etc.)
- You don't need the LD analysis or trees
Keep intermediate files for inspection:
python Code/run_matching.py -a Data/InputFiles/alignment.fasta \
--haploview-jar Code/Haploview4.1.jar --keep-intermediateUse this if:
- You want to examine the PED/INFO files that Haploview uses
- You want to keep the LD file for later inspection
- You're debugging issues
Full analysis with all options:
python Code/run_matching.py -a Data/InputFiles/alignment.fasta \
--haploview-jar Code/Haploview4.1.jar --keep-intermediate- Filename matters: Output folders are named after your input file.
alignment.fasta→ output inData/OutputFiles/alignment/ - Re-running: If you run twice, the tool won't overwrite results. It creates
alignment_1/,alignment_2/, etc. - Always activate the environment: Before running any command, make sure you see
(.venv)in your prompt. If not, run:- Windows:
.venv\Scripts\activate - Mac/Linux:
source .venv/bin/activate
- Windows:
When you run the tool, it performs these operations on your FASTA file:
- Reads your FASTA alignment file
- Checks that all sequences have the same length
- Counts total sequences and alignment length
- Looks at gaps (dashes
-) at the start and end of each sequence - Finds the region where every sequence has at least one valid character
- Trims off the incomplete parts
- Example: If one sequence starts with 100 gaps and another ends with 50 gaps, those regions are trimmed from all sequences
- Compares all sequences position by position
- Identifies positions where at least two different bases appear
- Ignores positions that are identical across all sequences (not informative)
- Removes positions containing invalid characters (anything outside
A, T, C, G, -) - Keeps analysis clean and interpretable
- Removes positions where some sequences have
N(unknown) or other non-standard bases - Ensures high data quality
- Removes positions where only ONE sequence differs from the majority
- These are usually sequencing errors, not real variants
- Reduces noise in the analysis
- Some positions have 3+ different bases
- Each minority base gets its own column for statistical analysis
- For each position, identifies the most common base (consensus)
- Used as the "reference" for encoding
- For each sequence at each position:
1 1= matches consensus base (same as most common)1 2= differs from consensus (different base)
- This is standard population genetics encoding
- PED file: SNP data in standard linkage format
- INFO file: Position descriptions for Haploview
Your input should be a multiple sequence alignment in FASTA format.
What FASTA looks like:
>Sample_1
ATCGATCGATCGATCGATCGATCG
>Sample_2
ATCGATCGATCGATCGATCGATCG
>Sample_3
ATCGATCGTTCGATCGATCGATCG
Rules:
- Each sequence starts with
>followed by a sample name - The name can contain spaces, dates, ID numbers, etc.
- Sequences can be on one line or split across multiple lines
- All sequences MUST be the same length (aligned)
- Valid bases:
A,T,C,G,-(gap),N(unknown) - Case doesn't matter (ATCG or atcg both work)
Example of a valid header:
>hMpxV/DRC/HGRK-1L/2024|EPI_ISL_18886301|2024-01-15
After running, you'll find results in Data/OutputFiles/alignment_name/:
- Standard linkage format used by genetics software
- Tab-separated columns
- First 6 columns: Family ID, Individual ID, Father ID, Mother ID, Sex, Phenotype
- Remaining columns: Genotype values for each SNP
- Use this for: Importing into PLINK, other population genetics tools
- Two columns (both identical): SNP position
- One row per variable position
- Use this for: Reference with PED file, LD calculations
- Linkage disequilibrium matrix
- Shows which SNPs are statistically linked
- Use this for: Understanding SNP associations
*.treefile— The phylogenetic tree in Newick format*.contree— Consensus tree*.log— IQ-TREE analysis log- Use this for: Visualizing evolutionary relationships
- Human-readable statistics about your analysis
- Number of SNPs found, filtered, kept
- Tree statistics if available
When the tool runs, you'll see output like:
============================================================
FASTA → PED/INFO Filter Summary
============================================================
Sequences in alignment : 213
Original alignment columns : 198855
— Coverage trim (removed) : 19744
After coverage filter : 179111
— Non-variable (removed) : 165266
After variable filter : 13845
— Ambiguous base (removed) : 12819
After ambiguity filter : 1026
— Incomplete col (removed) : 0
After completeness filter : 1026
— Singletons (removed) : 559
After singleton filter : 467
+ Split multi-allelic : 0
Final virtual positions : 467
============================================================
What this tells you:
- Started with 213 sequences, 198,855 positions
- Coverage trimming removed 19,744 incomplete columns
- Variable filter kept only positions with differences (removed 165,266 identical positions)
- Final result: 467 usable SNPs from 13,845 variable positions
- This is normal — most positions are either identical or unreliable
-
Prepare your file
- You have a FASTA file:
mpox_sequences.fasta - Copy it to
Data/InputFiles/mpox_sequences.fasta
- You have a FASTA file:
-
Activate the environment
# Windows .venv\Scripts\activate # Mac/Linux source .venv/bin/activate
-
Run the pipeline
python Code/run_matching.py \ -a Data/InputFiles/mpox_sequences.fasta \ --haploview-jar Code/Haploview4.1.jar --keep-intermediate
-
Wait for completion
- Takes seconds to minutes depending on file size
- You'll see progress output on screen
- Haploview window may pop up
-
Check results
Data/OutputFiles/mpox_sequences/ ├── mpox_sequences_ped.txt # SNP genotypes ├── mpox_sequences_info.txt # SNP positions ├── mpox_sequences.ld # Linkage data ├── summary.xlsx # Summary statistics └── IQTree_out/ ├── mpox_sequences.treefile # Your tree └── (other IQ-TREE files) -
View results
- Open
summary.xlsxin Excel or Google Sheets - Open
.treefilein a tree viewer (FigTree, Dendroscope, etc.) - Use PED/INFO files with other tools
- Open
Problem: When you type python, you get "command not found" or similar error.
Solution:
- Windows: Python wasn't added to PATH during installation. Reinstall Python with "Add Python 3.x to PATH" checked ✓
- Mac: Use
python3instead ofpythonfor all commands - Linux: Use
python3instead ofpython
Problem: Error mentions Java or Haploview when running the pipeline.
Solution:
- Check Java is installed:
java -version - If not installed, download from oracle.com or use:
- Mac:
brew install openjdk - Linux:
apt install default-jdk
- Mac:
- Try the command again
Problem: Error during execution about missing Python packages.
Solution:
- Make sure the environment is activated (see
(.venv)in prompt) - Reinstall packages:
pip install -r Data/requirements/requirements.txt pip install tqdm
- Try running again
Problem: Error reading your FASTA file.
Solution:
- Your sequences aren't aligned (different lengths)
- Check that all sequences have the same length
- Use a sequence alignment tool (Mafft, ClustalW, etc.) if needed
- Make sure there are no empty lines in the middle of sequences
This is normal!
- The tool creates a new folder each run to avoid overwriting results
- If you run with the same file twice, results go to separate folders
- To clean up: delete old folders in
Data/OutputFiles/
Possible issues:
- Too few SNPs found — Your sequences might be very similar or from the same virus strain
- All SNPs filtered — Your data might contain many ambiguous bases or gaps; check filter summary
- Tree not built — IQ-TREE not installed; it's optional but needed for trees
Quick fix:
- Re-run with
--keep-intermediateflag to inspect intermediate files - Check that input FASTA is formatted correctly
Problem: Haploview crashes with OutOfMemoryError.
Solution: If you need to run Haploview manually with more memory:
java -Xmx4G -jar Code/Haploview4.1.jar(Adjust 4G to more/less memory as needed)
A: No, only FASTA format is supported. If you have a different format, use a converter tool like:
- SeqKit (online or command-line)
- Format-checking websites (NCBI, EBI)
A: You need to align them first. Use alignment tools:
- Mafft — Fast and accurate
- ClustalW — Classic alignment tool
- MUSCLE — Good balance of speed and accuracy
- Web servers — NCBI Blast, EBI tools
A: Yes, all three platforms are supported. The setup is slightly different but the tool works identically.
A: Practical limits:
- Good: 50-1,000 sequences, 20,000-500,000 bp
- May be slow: 1,000-10,000 sequences or very long alignments (>1 million bp)
- Very slow: 10,000+ sequences or extreme alignments
For extremely large files, you might need:
- A computer with more RAM (8GB+)
- More time for processing (hours)
- Possibly splitting into smaller chunks
A: No, it's optional. Without it:
- Pipeline still works
- You get PED/INFO files and LD analysis
- You don't get phylogenetic trees
A: Yes! The tool works with RNA (uses U instead of T), though it's designed for DNA. Just make sure:
- Sequences are aligned
- Format is valid FASTA
- All sequences use the same base encoding
A: In the PED file:
1 1= Homozygous reference (matches consensus base)1 2= Heterozygous (differs from consensus base)0 0= Missing data
This follows standard population genetics encoding used by PLINK and similar tools.
A: Yes! The PED and INFO files are standard formats:
- PLINK: Can read PED files directly
- Haploview: Can read PED/INFO (already run by default)
- Population genetics tools: Most tools accept this format
A: The tree shows evolutionary relationships:
- Branch length = evolutionary distance (more divergent = longer branch)
- Samples close together = similar sequences (small genetic distance)
- Samples far apart = different sequences (large genetic distance)
- Use FigTree or Dendroscope to visualize and customize trees
A: Common issues:
- Very similar sequences — Difficult to build accurate trees; normal
- Mixed quality — Some good sequences, some poor quality
- Recombination — Evolutionary trees may be misleading if recombination occurred
- Too few SNPs — Trees need variation to build
Try:
- Inspecting the
.iqtreelog file for IQ-TREE statistics - Using different evolution models (beyond default scope)
A: Not recommended. Python environments work best on local disk. Instead:
- Install on your local computer
- Copy your input file to the project
- Run normally
- Copy results out when done
A: You'll need to edit the Python code:
- Open
Code/fasta_to_ped.pyin a text editor - Look for filter thresholds (singleton removal, ambiguity checking, etc.)
- Modify values and save
- Re-run the pipeline
This requires some Python knowledge — consult documentation or ask for help.
If you hit problems:
- Check this guide — Read the Troubleshooting section above
- Examine filter summary — Does it show expected SNP counts?
- Inspect intermediate files — Run with
--keep-intermediateto see raw PED/INFO - Check log files — Look in output folder for
.logor.iqtreefiles - Ask for help — Open a GitHub issue or contact the developers
If you use this tool in research, please cite:
Poyer, A. T, Feehley, M. C, & Feehley, P. J. (2026). Recombina: A toolkit for viral recombination and SNP matching analysis (Version 1.0.0) [Computer software]. GitHub. https://github.com/Hocket/Recombina
You now know how to:
- ✓ Install the tool
- ✓ Prepare your input files
- ✓ Run the complete pipeline
- ✓ Understand what each step does
- ✓ Interpret the outputs
- ✓ Troubleshoot common issues
Next steps:
- Install Python and Java (if not already done)
- Clone/download this repository
- Follow the Installation Guide (3 steps: setup environment, install packages, verify)
- Prepare your FASTA file
- Run your first analysis!
Good luck with your viral sequence analysis! 🧬