Skip to content

updated CROP source code, new unit tests for toy model#6

Open
augeorge wants to merge 8 commits intomainfrom
dev_ag
Open

updated CROP source code, new unit tests for toy model#6
augeorge wants to merge 8 commits intomainfrom
dev_ag

Conversation

@augeorge
Copy link
Contributor

@augeorge augeorge commented Feb 7, 2024

  • new data class for Phenotype Observations
  • new functions for:
    • create cobra model from stoich matrix
    • get dual and primal constraints (incomplete)
    • get decision variables
  • new class for CROP problem (incomplete)
  • example notebook and model for tests (incomplete)
  • unit tests and fixtures covering new functions (incomplete)

@augeorge augeorge requested a review from djinnome February 7, 2024 01:00
@augeorge augeorge self-assigned this Feb 7, 2024
Copy link
Contributor

@djinnome djinnome left a comment

Choose a reason for hiding this comment

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

This is definitely looking better, but I think we should make smaller PRs so that main only has working tests that always pass. Maybe split this PR into smaller pieces?

return cb.io.load_json_model("./tests/ABC_toy_model_3.json")

@pytest.fixture
def actual_model():
Copy link
Contributor

Choose a reason for hiding this comment

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

Fixtures should be expected, not actual.

return flux_dual

@pytest.fixture
def flux():
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be expected_flux?

return flux


def metabolite_equal(expected:cb.core.Metabolite,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there a unit test in fixtures?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see: it is a helper function for testing equality. I think this should be called assert_metabolite_equal and assert_reaction_equal and assert_constraint_equal

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh never mind, I like how you do assert metabolite_equal(expected, actual)

obj_func = model.slim_optimize()
expected_constraint = None # fix
# compare with expected model expressions
assert actual_constraint == expected_constraint
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be assert contraint_equal(actual_constrainte, expected_constraint) or does this actually work?

flux_dual
):
"""Test getting the dual flux constraints (i.e., LB <= r_nogrowth <= UB)"""
raise NotImplementedError
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you go ahead and implement this?

flux
):
"""Test getting the steady state flux constraints (i.e., Sv=0) """
raise NotImplementedError
Copy link
Contributor

Choose a reason for hiding this comment

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

Should you go ahead and implement this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we really merge this into main?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants