Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge LinkFinder to MetcalfScoring class #248

Merged
merged 10 commits into from
Jun 6, 2024

Conversation

CunliangGeng
Copy link
Member

@CunliangGeng CunliangGeng commented May 31, 2024

The actual role of LinkFinder is to calculate and store metcalf scores. This PR merges these roles to MetcalfScoring class, which will increase the clarity of the scoring process.

Major changes:

  • merge LinkFinder to MetcalfScoring class
  • remove LinkFinder
  • relocate unit tests of LinkFinder

To make unit tests work:

  • remove unit/conftest.py that has one temporary root dir for all tests. Now you have to create temporary root dir only in the places that need it, which makes unit tests indepdent with each other in the parallel testing.

  • change pytest xdist from --dist loadscope to --dist loadgroup, which is much faster for parallel testing and easier to control the group of tests for same worker..

tests/unit/scoring/conftest.py Show resolved Hide resolved
tests/unit/scoring/conftest.py Show resolved Hide resolved
assert isinstance(mc.metcalf_mean, np.ndarray)
assert isinstance(mc.metcalf_std, np.ndarray)
assert mc.metcalf_mean.shape == (4, 4) # (n_strains+1 , n_strains+1)
assert mc.metcalf_mean.shape == (4, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
assert mc.metcalf_mean.shape == (4, 4)

This is repeated twice, maybe you wanted to assert metcalf_std shape?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch! Indeed, it should be metcalf_std.

assert isinstance(mc.metcalf_mean, np.ndarray)
assert isinstance(mc.metcalf_std, np.ndarray)
assert mc.metcalf_mean.shape == (4, 4) # (n_strains+1 , n_strains+1)
assert mc.metcalf_mean.shape == (4, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, this is repeated twice

assert isinstance(mc.metcalf_mean, np.ndarray)
assert isinstance(mc.metcalf_std, np.ndarray)
assert mc.metcalf_mean.shape == (4, 4) # (n_strains+1 , n_strains+1)
assert mc.metcalf_mean.shape == (4, 4)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, this is repeated twice

tests/unit/scoring/test_metcalf_scoring.py Show resolved Hide resolved
@CunliangGeng CunliangGeng force-pushed the merge_LinkFinder_to_MetcalfScoring branch from 3a92298 to 89aa35e Compare June 6, 2024 07:16
@CunliangGeng CunliangGeng force-pushed the merge_LinkFinder_to_MetcalfScoring branch from 89aa35e to 145bd22 Compare June 6, 2024 07:20
Copy link
Member Author

CunliangGeng commented Jun 6, 2024

Merge activity

  • Jun 6, 3:25 AM EDT: @CunliangGeng started a stack merge that includes this pull request via Graphite.
  • Jun 6, 3:28 AM EDT: Graphite rebased this pull request as part of a merge.
  • Jun 6, 3:29 AM EDT: @CunliangGeng merged this pull request with Graphite.

Base automatically changed from add_scoring_base to dev June 6, 2024 07:27
The actual role of LinkFinder is to calculate metcalf score, so it makes more sense to merge its functions to MetcalfScoring class
caplog cannot capture all logs, so remove the assertions.
This option is much faster and easier to control the group of tests for same worker.
@CunliangGeng CunliangGeng force-pushed the merge_LinkFinder_to_MetcalfScoring branch from 3974c23 to d13d883 Compare June 6, 2024 07:27
@CunliangGeng CunliangGeng merged commit 276aff6 into dev Jun 6, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants