-
Notifications
You must be signed in to change notification settings - Fork 11
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
Functions that could go in the PMI restraint base class #156
Comments
get_particle_to_sample ? |
Yeah! And we should start using the _NuisancesBase which you made. You can do multiple inheritance in python, so the ISD-style PMI restraints can have |
I'd like to take a stab at writing this base class. Another function which maybe should be included is Is Any additional methods which would be useful to have for all restraints but don't currently exist? Also, there are often other restraint sets that are only used in custom methods for a child class and in |
Awesome! I'd say This is probably a good start for now. We can always expand it later if we find overlapping function in the child classes. I don't know what you mean by the other restraint sets. Where is there an example of that? |
|
I agree with @benmwebb regarding An example of other restraint sets is in the |
Oh, my bad, meant |
And I see the deal with multiple |
@saltzberg, to push back, I'm thinking child classes would still define such variables as Also, is there any reason it doesn't make sense to use the same name for a given |
Oh, I wasn't suggesting that the child classes should not do that. Simply that there may be another application for a dictionary of restraint sets outside of output, like evaluation. Adding the name of the restraint to the |
I see. I tend to agree with you then. Restraints should be internally stored in some data structure. Names of This will standardize the output names and restraint names, which is nice. In the process though, it will change some names in output fields (i.e. anything which doesn't have |
I also recommend that you make your changes as a pull request, then we can all discuss any issues with your implementation before it goes live. |
@benmwebb a pull request with just the base class and a corresponding test or with all PMI restraints updated to use the base class? |
Whichever works for you. Smaller changes are easier to review than bigger ones though. |
submitted a pull request |
On further thought, it appears that nearly every (if not every) instance of a method being reimplemented in a child of RestraintBase would be to include the value of a nuisance in the output, change which restraint is added to the RMF, change which restraints are added to the model, or change which particles are sampled. These are all decisions that can be made upon initialization. I propose including the following datastructures in the base class:
These will be used in the base class methods. Thoughts? |
Makes sense if every subclass needs that functionality. If not, it may make sense to introduce an intermediate class between RestraintBase and the subclasses that need it. |
Well, as it stands, all restraints will have this functionality (these methods are currently defined in the new base class). This is really just an implementation detail that prevents implementers from needing to overload functions. I think it will also help in standardising what is output. I suppose I could add something like |
There's already a class that was (presumably) intended to do that, |
Perhaps. It seems awfully specific to crosslinks. Looks like its only being used in the deprecated |
No idea. PMI likes to reinvent the wheel a lot. You may need to just do this again, and burn the |
Just one thing - please do not touch anything in IMP.pmi.restraints.crosslinking.ISDCrossLinkMS. It is not deprecated at least for me. All my current projects are heavily dependent on it. |
@procyon777 no worries, I won't modify any of the code in |
Also, I think it really only makes sense to call Perhaps a good point for discussion is whether as a convention PMI Restraints should be initialized with weights and labels. About half of them have a |
I think both label and weight should be passed as optional variables at I agree that changing the label could have unintended consequences, and I On Tue, Oct 11, 2016 at 12:46 AM, Seth Axen [email protected]
Daniel Saltzberg T: 415.514.4258 Mailing Address: |
On further thought, I agree with you, but for different reasons. If we're enforcing the weight and label are passed at most once before the restraint is used, it makes sense that they be optional initialization inputs. The current default label is empty. I think that makes sense since one might not need a unique string to identify the restraint if they only use one. What sort of unique default label were you thinking of? Also, the weight should probably be applied to all internal restraint sets, which I don't think is always the case right now. Unless I'm misunderstanding what the weight was meant to accomplish. Actually, if we're not intending the user to run |
One thought about labels and weights, I agree that they should, by default, On Tue, Oct 11, 2016 at 8:56 AM, Seth Axen [email protected] wrote:
Ignacia Echeverria http://salilab.org/~ignacia |
@iecheverria, so to clarify, you want to be able to modify the restraint label and weight sometime after initialization but before calling any of the methods to get particles or outputs? |
@sdaxen, yes, that is correct. |
Commit af9a472 handles the weights/labels as discussed above. |
See http://chris.beams.io/posts/git-commit/ for tips on how to write a good git commit message. |
@benmwebb thanks for the reference! |
Nuisance mix-in adds helper functions for creating and tracking nuisance particles so that output and sampling is taken care of.
d2651da Don't run slow examples in debug mode. 3e770ee Fix print output in Python 2. ba22e63 Remove unused imports and add docstrings 485f81b Use new restraint base, relates salilab/pmi#156 f7fc45f Add tests for parameter restraints bb9c499 Add mix-in for nuisance setup in restraints, Relates salilab/pmi#156 dd500d5 Allow weight to be modified at any time af9a472 updates to restraint base; new handling of weights, labels, restraint name; helper method for restraint creation 514acda comply with PEP8, fixed docstrings, reordered methods b419fc6 use new restraint base 103a943 use new restraint base 9af9741 use new restraint base ffc1013 added helper method for getting label suffix 7f38ff0 fix output key lookup c456568 comply with PEP8, format and add docstrings 99165d2 use new restraint base 5ff5c8b fixed reference to undeclared variable 9e14ea7 comply to PEP8, format and add docstrings git-subtree-dir: modules/pmi git-subtree-split: d2651dac6b8a91b6541839818ed29ad9a3f45571
`BiStableDistanceRestraint` inherited `IMP.Restraint` and was not a PMI-style restraint. A general NStableDistanceRestraint that inherits the new PMI restraint base class was created, and BiStableDistanceRestraint inherits that class. Relates salilab#211, salilab#156
set_weight()
set_label()
add_to_model()
get_restraint_set()
evaluate()
get_output() (maybe defined as abstract)
The text was updated successfully, but these errors were encountered: