iqbal-lab-org / make_prg

Code to create a PRG from a Multiple Sequence Alignment file
Other
21 stars 7 forks source link

Local random object and Skipping malformed denovo variants #61

Closed leoisl closed 1 year ago

leoisl commented 1 year ago

This PR fixes two small issues:

  1. Fixes a bug introduced in the previous PR, by using a local random object instead of the global random module. In Python, the random module is not process-safe or thread-safe by default. It uses a global instance of the pseudorandom number generator, which is shared between all uses of the random module in the same Python process. It's not designed to handle the concurrent usage scenario well, which is what we have in make_prg. Basically, whenever we need to get_majority_consensus_from_MSA(), we set the seed of the random object WRT the sequences of the alignment, so that we get the exact same consensus given the same alignment. But we process multiple MSAs at the same time, which could cause issue, e.g. setting random.seed() of one MSA while generating the consensus of another MSA (I was having issues with integration tests not being reproducible). We now use a local random object that prevents this issue;
  2. We now skip denovo variants that for some very rare reason might have N in it (closes https://github.com/iqbal-lab-org/make_prg/issues/58);

Most of the changed files in this PR is updating the zip files in integration tests

leoisl commented 1 year ago

CI is failing trying to install scikit-learn for some obscure reason I could not fix yet...

Tests run and pass on my end, total coverage is 99.74%, so it has not decreased:

Required test coverage of 98% reached. Total coverage: 99.74%
=========================================================================================== 494 passed, 1 skipped, 4 warnings in 58.95s ===========================================================================================