Skip to content

Testing

Andrea Telatin edited this page Oct 26, 2021 · 5 revisions

CircleCI

TravisCI Build Status

This repository is automatically tested at each release by TravisCI GitHub Actions. The automatic tests will ensure that the code compiles correctly, and the production of different outputs from a test file.

Manual testing

To perform autonomously the tests, there is a script called ./test/test.sh that assumes:

  • To be invoked from the root of the repository (this is not required, but it's the way TravisCI will invoke it)
  • That a binary called covtobed is placed at the root of the repository. This is important, should the binary not being at the root of the repository the test script will attempt copying a pre-compiled binary from the ./binaries directory.

What is tested

Some example BAM files are present in the test directory:

  • demo.bam is a simulated single-end whole-genome shotgun of Enterobacteria phage lambda
  • mp.bam is a simulated mate pairs library of Enterobacteria phage lambda
  • mock.bam is a synthetic version of demo.bam that will produce 3 peaks of coverage (20X, 5X, 5X respectively)
  • filtered.bam is a synthetic BAM file containing a valid alignment and non valid flags (PCR duplicate, non primary, failed QC)
  • test_cov.bam is a synthetic BAM file having a peak per chromosome, and each chromosome is named after the coverage of its peak (e.g. "5X" means expecting a peak of 5X coverage)

What is tested:

  1. The binary compiled and can be invoked printing its version
  2. A sample test/demo.bam is analyzed using "--min-cov 15", and should produce 12 lines of BED
  3. A sample test/mp.bam is analyzed using "--physical-coverage", and should produce 136 lines
  4. A sample test/demo.bam is analyzed using "--output-strands", and should produce a fifth column
  5. A sample test/demo.bam is analyzed using "--format counts", and should print two header lines and 202 non-header lines
  6. A sample test/demo.bam is analyzed and should re-produce the reference test/demo.bed of the repository
  7. A sample test/mock.bam is analyzed and should re-produce the reference test/demo.bed of the repository
  8. A sample test/test_cov.bam is analyzed and the output is checked for having a peak per chromosome, and each chromosome is named after the coverage of its peak

Example output: all tests pass

covtobed 1.1.0
Copyright (C) 2014-2019 Giovanni Birolo and Andrea Telatin
License MIT.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
 - Compiled binary prints version: PASS 1
 - Minimum coverage, expected BED lines check: PASS 2
 - Physical coverage, expected BED lines check: PASS 3
 - Stranded output, testing column #5: PASS 4
 - Testing 'counts' format (printed headers): PASS 5
 - Testing 'counts' format (printed lines): PASS 6
 - Checking identity of BED output with pre-calculated: PASS 7
 - Checking computed coverage for a synthetic BAM file: PASS 8
 - Checking filtering of invalid alignments: PASS 9,10
 - Checking artificial coverage values:
	#OK expecting 1X, 1X found
	#OK expecting 2X, 2X found
	#OK expecting 10X, 10X found
ALL TESTS: PASSED
Clone this wiki locally