Adding DMEs to a contig#1827
Conversation
initial commit. should most keep back compatibility except in the strings returned by str(contig) and contig.mutation_types
one more deprecated usage
ran black on genomes.py
- fixed a bad typo in genomes - fixed some missing args in a test I added a couple commits ago - fixed a bunch of typos I introduced in test_slim_engine (add_dme had a DFE kwarg instead of DME).
not sure how I missed these!
whooops, should have rerun that...
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1827 +/- ##
=======================================
Coverage 99.82% 99.82%
=======================================
Files 143 143
Lines 5012 5035 +23
Branches 513 515 +2
=======================================
+ Hits 5003 5026 +23
Misses 6 6
Partials 3 3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
test to make sure user does not supply dme_list and dfe_list
|
@petrelharp -- @jeffspence wrote pretty much all of this, and I reviewed it before opening the PR, but maybe you or someone else with more institutional knowledge would like to review as well? |
oops! caught a few last references to clear_dfes() and add_dfe()
update docstring in traits.py referencing Contig.add_dfe
|
To give a little bit of context, the main changes are: In
Beyond these main changes, the rest are essentially tests of these in |
|
Yes, I'll have a look. Thanks!! |
I think in |
| By default, the inital interval list spans the whole chromosome with | ||
| DME where variants have no effects on traits or fitness. |
There was a problem hiding this comment.
| By default, the inital interval list spans the whole chromosome with | |
| DME where variants have no effects on traits or fitness. | |
| By default, the initial interval list spans the whole chromosome with | |
| a DME whose variants have no effects on traits or fitness. |
| exclusion_mask = attr.ib(default=None) | ||
| dfe_list = attr.ib(factory=list) | ||
| dme_list = attr.ib(factory=list) | ||
| _dfe_list = attr.ib(factory=list, alias="dfe_list") |
There was a problem hiding this comment.
What's the thinking here? How will this work? (I don't know quite what alias does.)
| species = attr.ib(default=None, kw_only=True) | ||
|
|
||
| def __attrs_post_init__(self): | ||
| if self._dfe_list and self.dme_list: |
There was a problem hiding this comment.
We like to make things explicit rather than relying on truthiness of things (eg is an empty list True or False? I'd have to check), so how about
| if self._dfe_list and self.dme_list: | |
| if self._dfe_list is not None and self.dme_list is not None: |
|
Could you explain the main changes and additions here? Like, it looks like this is this deprecating Edit: Okay, by my reading this does:
An alternative to the deprecation warnings would be to basically just have all the |
| The class records the different *mutation types*, and the *proportions* | ||
| with which they occur. The overall rate of mutations will be determined | ||
| by the Contig to which the DFE is applied (see :meth:`.Contig.add_dfe`). | ||
| by the Contig to which the DME is applied (see :meth:`.Contig.add_dme`). |
There was a problem hiding this comment.
I don't think this change is correct (at least the first one)?
Proposed fix for #1822 - swaps DFEs for DMEs, and preserves backwards compatibility in most places.
Two minor notes to add per @jeffspence:
__str__andmutation_typeswe break backwards compatibility by replacing "dfe_id" and "dfe_list" (appearing in the string representation) by "dme_id" and "dme_list". Should we worry about this?add_single_siteto allow a trait effect?