Tests

Tests have been implemented to ensure the correctness of Binette.

Unit tests

Unit tests have been implmented in the tests directory using pytest.

To run the test suit you would need to have install Binette from the source code. For that, you can follow installation instructions here.

To install pytest in you environement you can run :

pip install .[dev]

Next, you can simply run the following at the root of the directory:

pytest  

To get the percentage of coverage of the test suit can be obtain as follow:

pytest --cov=binette 

Note

Test coverage is updated by a github workflow in the Action Tab. The test coverage report is then deployed on the github-pages and avaible here.

Functional Tests

Functional tests are included in the pytest test suite and verify that Binette works correctly with real data. When you run pytest, both unit and functional tests execute automatically using a toy dataset of 4 small genomes with a minimal CheckM2 database.

The test dataset is stored in this github repository: Binette TestData.

You can run the functional tests locally:

  1. Clone the test dataset repository:

git clone https://github.com/genotoul-bioinfo/Binette_TestData.git
  1. Run functional tests with pytest:

# Run only functional tests
pytest tests/functional_tests/ --test-data-path Binette_TestData/ -v

# Or run all tests (unit + functional)
pytest --test-data-path Binette_TestData/

# Alternatively, set environment variable
export BINETTE_TEST_DATA_PATH=Binette_TestData/
pytest tests/functional_tests/ -v
  1. Manual execution (alternative):

You can also run Binette manually on the test data:

cd Binette_TestData/
binette -b binning_results/* --contigs all_contigs.fna --checkm2_db checkm2_tiny_db/checkm2_tiny_db.dmnd -v -o test_results

This should complete in a few seconds.

  1. Compare Results:

After running Binette, you can compare the generated final_bins_quality_reports.tsv with the expected results stored in the expected_results folder.

You can perform the comparison manually by using the head command:

head  expected_results/final_bins_quality_reports.tsv test_results/final_bins_quality_reports.tsv

Alternatively, you can use the provided Python script for automated comparison: compare_results.py located in the scripts folder.

python scripts/compare_results.py expected_results/final_bins_quality_reports.tsv test_results/final_bins_quality_reports.tsv

Warning

The CheckM2 database used for the test dataset is very small and is only valid for the 4 genomes included in the test datasets. It should not be used elsewhere.