It Creates an interactive circular phylogenetic network from SNP data using Neighbor-Joining. It was built with horse Y-chromosome analysis in mind but can be used for any similar dataset.
It uses the Neighbor-Joining method to build the tree topology and the Fitch algorithm to map specific mutations to the branches. The output is a single HTML file that can be opened in any web browser.
- Interactive Network: Click and drag nodes, scroll to zoom, and click the background to deselect.
- Topological Layout: Automatically groups related samples together around the circle based on their genetic distance.
- Haplotype Grouping: Identical sequences are merged into a single node. The size of the node can be scaled by the number of samples it contains.
- Metadata Support: Add a sample information file to toggle between showing Sample IDs and Breed names on the network.
- Export Options: Save the network as a PDF or SVG for publication directly from the browser.
You only need Python 3. The script uses standard built-in Python libraries, so no extra installations are required. However, the output HTML file needs an internet connection to load the D3.js visualization library.
Run the script from your command line:
python snp2net.py -f input.fasta -s snps.txt -o Outgroup_ID -m meta.txt -out network.html
Example input files are provided in the example_data folder of this repository.
(Outgroup_ID in the example is "IceAnd")
Arguments:
- -f (Required): Your FASTA file with binary SNP data (0 and 1).
- -s (Required): A text file with your SNP names, one per line.
- -o (Required): The exact Sample ID of your outgroup.
- -m (Optional): A text file with your sample metadata (like breeds).
- -out (Optional): The name of the HTML file you want to create.
If you have any questions or run into issues, please open an issue on the GitHub repository or contact me at bilal.bioinfo@gmail.com