Skip to content

Random error when performing tests#619

Merged
jonbrenas merged 9 commits intomasterfrom
618-bad-random-value
Sep 23, 2024
Merged

Random error when performing tests#619
jonbrenas merged 9 commits intomasterfrom
618-bad-random-value

Conversation

@jonbrenas
Copy link
Copy Markdown
Collaborator

Addresses #618 .

@leehart leehart self-requested a review September 23, 2024 10:58
Copy link
Copy Markdown
Collaborator

@leehart leehart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jonbrenas .

I'm not sure about the assert. I suppose the idea is that it will fail if either the number of samples or the number of SNPs is 3 or fewer. I expect there would be a ValueError raised in randint if n_snps_available was fewer than 4, so I expect n_snps will be at least 4 at the assert and so it might boil down to n_samples. Perhaps we might want a way to either ensure enough samples and SNPs at this point, or otherwise raise a clear error when that hasn't happened. But perhaps that's a different problem for a different day!

@leehart
Copy link
Copy Markdown
Collaborator

leehart commented Sep 23, 2024

By the way, I don't quite understand the commit that "Drops a few unused columns", which doesn't come through as a change, presumably due to having an identical change being already merged in from master? Was that commit related to the same issue, or an artefact of something else perhaps?

@jonbrenas
Copy link
Copy Markdown
Collaborator Author

Thanks @leehart .

The assert should never be False unless the test is really poorly setup. n_samples is the sum of the sizes of the two randomly chosen sample sets and n_snps_available is the number of biallelic SNPs in the randomly chosen chromosome arm using all these samples. Both values should be significantly higher than 4.

The commits have been part of all my PRs for a while. I am not sure why. I hope they disappear once one of these PRs is merged into master.

@leehart
Copy link
Copy Markdown
Collaborator

leehart commented Sep 23, 2024

Thanks @jonbrenas
CI tests failed on unrelated PCA tests. I'll try re-running.

=========================== short test summary info ============================
FAILED tests/anoph/test_pca.py::test_pca_exclude_samples[af1_sim] - ValueError: empty range in randrange(3, 3)
=========== 1 failed, 379 passed, 322 warnings in 424.39s (0:07:04) ============

@jonbrenas
Copy link
Copy Markdown
Collaborator Author

It actually fails on exactly the test that I modified because it can sometimes randomly fail on unrelated PRs (but this PR has to pass the previous tests for it to be approved, obviously, which it now does).

@jonbrenas jonbrenas merged commit 55432a5 into master Sep 23, 2024
@leehart
Copy link
Copy Markdown
Collaborator

leehart commented Sep 23, 2024

Haha, I see, of course. Thanks @jonbrenas . OK if I delete the branch from GitHub now it's been merged in?

@jonbrenas jonbrenas deleted the 618-bad-random-value branch September 23, 2024 13:00
@jonbrenas
Copy link
Copy Markdown
Collaborator Author

Done!

@jonbrenas jonbrenas restored the 618-bad-random-value branch October 1, 2024 11:14
@alimanfoo alimanfoo added the BMGF-068808 Work supported by BMGF grant INV-068808 (MalariaGEN 2024-2027). label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BMGF-068808 Work supported by BMGF grant INV-068808 (MalariaGEN 2024-2027).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants