/UNIL_MLS_APP

Primary LanguageJupyter Notebook

Python Code for Calculating Likelihood of Observed MSA Given a Phylogenetic Tree

This repository contains Python code for calculating likelihood (lkl) for phylogenetic trees. The code includes two main functionalities:

  1. Get LKL for All Nodes:

    python3 run_lkl_calculation.py \
        --tree_path data/table.dat \
        --branch_lengths_path data/branchlength.dat \
        --msa_path data/msa.dat \
        --mu 1
  2. Get LKL for Root Node Only:

    python3 run_lkl_calculation.py \
        --tree_path data/table.dat \
        --branch_lengths_path data/branchlength.dat \
        --msa_path data/msa.dat \
        --mu 1 \
        --output_lkl_root_node_only

Test Datasets

To run the test datasets, you can use the following commands:

# Install required dependencies
pip install tabulate

# Run the test script
python3 test.py

## Output of test script

+-----------------------------------+--------+-------------------+-----------------+----------------+
| Dataset                           |     Mu |   Expected Output |   Actual Output | Match Status   |
+===================================+========+===================+=================+================+
| msa.dat                           | 0.3    |          -180.431 |        -180.431 | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| msa.dat                           | 1      |          -182.056 |        -182.056 | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| msa.dat                           | 2      |          -197.3   |        -197.3   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| msa.dat                           | 0.5321 |          -176.507 |        -176.507 | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112282_MED23_NT.msa.dat  | 0.3    |        -11350.6   |      -11350.6   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112282_MED23_NT.msa.dat  | 1      |        -10229.9   |      -10229.9   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112282_MED23_NT.msa.dat  | 2      |        -10534.2   |      -10534.2   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112282_MED23_NT.msa.dat  | 1.1549 |        -10211.9   |      -10211.9   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112984_KIF20A_NT.msa.dat | 0.3    |         -7412.28  |       -7412.28  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112984_KIF20A_NT.msa.dat | 1      |         -7134.62  |       -7134.62  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112984_KIF20A_NT.msa.dat | 2      |         -8029.3   |       -8029.3   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000112984_KIF20A_NT.msa.dat | 0.7021 |         -7043.94  |       -7043.94  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000013016_EHD3_NT.msa.dat   | 0.3    |         -6802.54  |       -6802.54  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000013016_EHD3_NT.msa.dat   | 1      |         -7324.27  |       -7324.27  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000013016_EHD3_NT.msa.dat   | 2      |         -9147.93  |       -9147.93  | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+
| ENSG00000013016_EHD3_NT.msa.dat   | 0.4242 |         -6737.3   |       -6737.3   | Match          |
+-----------------------------------+--------+-------------------+-----------------+----------------+