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

Idp go #593

Merged
merged 24 commits into from
May 22, 2024
Merged

Idp go #593

merged 24 commits into from
May 22, 2024

Conversation

csbrasnett
Copy link
Collaborator

Adding -idp-tune to allow for addition of extra bonded potentials in IDRs

csbrasnett and others added 8 commits April 23, 2024 15:14
with the extra flag -idp-tune (probably a better name) martinize
will add additional potentials as per the Go paper.

This commit:
1) finds cross Go interactions between folded and idrs and removes
them
2) identifies BB and SC1 beads in idrs
# Conflicts:
#	vermouth/data/force_fields/martini3001/citations.bib
#	vermouth/processors/water_bias.py
#	vermouth/tests/data/integration_tests/tier-1/hst5/martinize2/citation
#	vermouth/tests/data/integration_tests/tier-1/hst5/martinize2/command
#	vermouth/tests/data/integration_tests/tier-1/hst5/martinize2/molecule_0.itp
#	vermouth/tests/data/integration_tests/tier-1/hst5/martinize2/virtual_sites_nonbond_params.itp
#	vermouth/tests/integration_tests/test_integration.py
@csbrasnett csbrasnett requested a review from fgrunewald April 29, 2024 08:14
bin/martinize2 Outdated
Comment on lines 1055 to 1057
# apply idr specific bonded potentials if required
if args.idr_tune:
if args.to_ff == 'martini3001':
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I would ideally like a better way of ensuring these parameters get used when needed and ignored when they shouldn't be used, but this is my best idea for now

Copy link
Member

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

Some small code comments, and a conceptual suggestion.
You want to add some interactions to specific disordered regions of a protein, right? My suggestion would be to have a simple processor annotate nodes/residues that are in an IDR, and add the interactions using links

vermouth/processors/tune_idp_bonds.py Outdated Show resolved Hide resolved
vermouth/processors/tune_idp_bonds.py Outdated Show resolved Hide resolved
"version": 1}
)

def run_molecule(self, molecule):
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to attach the appropriate citation reference to the molecule

vermouth/processors/tune_idp_bonds.py Outdated Show resolved Hide resolved
csbrasnett added 3 commits May 2, 2024 13:14
- processors/tune_idp_bonds.py now annotates residues which are disordered so
that they can have their links added afterwards. Uses existing function from
dssp for this purpose.

- martinize2 edited to reflect new pipeline

- removed now not needed function from rcsu/go_utils.py

- addressed other comments
@csbrasnett
Copy link
Collaborator Author

This is a much nicer solution, thanks for suggesting!

Copy link
Member

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

Much cleaner! <3
Still a few small comments

bin/martinize2 Outdated
raise argparse.ArgumentError(idr_tuning,
message=("You are trying to apply IDR biasing to a force field which "
"isn't martini3001, which this is not designed for."))
vermouth.IDRBonds(idr_regions = [(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
vermouth.IDRBonds(idr_regions = [(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)
vermouth.IDRBonds(idr_regions=[(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)

bin/martinize2 Outdated
message=("You are trying to apply IDR biasing to a force field which "
"isn't martini3001, which this is not designed for."))
vermouth.IDRBonds(idr_regions = [(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)
vermouth.DoLinks().run_system(system)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you actually want to run DoLinks a second time. Instead, move the IDRBonds annotator to just after the mapping

order_disorder_seq = []

for key, node in molecule.nodes.items():
if select_backbone(node):
Copy link
Member

Choose a reason for hiding this comment

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

I wouldn't tag just the backbone (or SC1), but rather just all nodes with the appropriate resid

if select_backbone(node):
_old_resid = node['_old_resid']
if _in_resid_region(_old_resid, idr_regions):
order_disorder_seq.append("D") # D for disordered
Copy link
Member

Choose a reason for hiding this comment

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

Why first build the list/string, and not just do molecule.nodes[key]['is_idr'] = True here?

csbrasnett added 3 commits May 6, 2024 17:06
- changed processor function to annotate IDRs first before applying links in martinize.
- moved cross go potential removal to water_bias.py
- changed aminoacids.ff to reflect new naming
- removed no longer needed import in dssp/__init__.py
- changed name of import in processors/__init__.py
bin/martinize2 Outdated
@@ -170,7 +170,7 @@ def pdb_to_universal(
return canonicalized


def martinize(system, mappings, to_ff, delete_unknown=False):
def martinize(system, mappings, to_ff, delete_unknown=False, idrs=False, disordered_regions = []):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def martinize(system, mappings, to_ff, delete_unknown=False, idrs=False, disordered_regions = []):
def martinize(system, mappings, to_ff, delete_unknown=False, idrs=False, disordered_regions=(,)):

As before, no mutable types as default arguments

bin/martinize2 Outdated
Comment on lines 1079 to 1088
#
# # apply idr specific bonded potentials if required
# if args.idr_tune:
# if not target_ff.has_feature("idr"):
# LOGGER.warning('Improved IDR potentials are not implemented '
# 'for this force field',
# type="missing-feature")
# else:
# vermouth.IDRBonds(idr_regions=[(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)
# vermouth.DoLinks().run_system(system)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#
# # apply idr specific bonded potentials if required
# if args.idr_tune:
# if not target_ff.has_feature("idr"):
# LOGGER.warning('Improved IDR potentials are not implemented '
# 'for this force field',
# type="missing-feature")
# else:
# vermouth.IDRBonds(idr_regions=[(int(start), int(stop)) for start, stop in args.water_idrs]).run_system(system)
# vermouth.DoLinks().run_system(system)

Comment on lines 29 to 32
def annotate_disorder(molecule, idr_regions):
"""
annotate the disordered regions of the molecule
"""
Copy link
Member

Choose a reason for hiding this comment

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

Docstring is incomplete.
Also, is it worth making the attribute used an argument (with default "cgidr")?


"""

def __init__(self, idr_regions = None):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
def __init__(self, idr_regions = None):
def __init__(self, idr_regions=None):

"""
if not self.idr_regions:
return system
self.system = system
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.system = system

Why do you need this?

csbrasnett added 2 commits May 7, 2024 11:26
- changed default argument in martinize
- renamed 'idr_regions' to 'id_regions' throughout
- exposed the name of the extra annotation in annotate_disorder with default argument "cgidr"
@csbrasnett
Copy link
Collaborator Author

csbrasnett commented May 22, 2024

btw, in trying to write some tests to address the missing coverage I've found an error in the test here:

for nb_params in system.gmx_topology_params['nonbond_params']:
assert nb_params.atoms[0] == "W"
vs_node = nb_params.atoms[1]
for vs in system.molecules[0].interactions['virtual_sitesn']:
if vs.atoms[0] == vs_node:
bb_node = vs.atoms[1]
water_eps = water_bias[expected[bb_node]]
water_sig = sizes[bb_node]
assert water_eps == nb_params.epsilon
assert water_sig == nb_params.sigma

in that the if statement is testing an atomtype against an atom index. Easy enough to fix, but it does now cause this test to fail once the the eps and sig assertions are actually reached! The failure is unrelated to the new removal functionality in water_bias as well. I'll fix here and you can have a look

pckroon
pckroon previously approved these changes May 22, 2024
Copy link
Member

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

LGTM! Was there anything still missing in this PR?

@csbrasnett
Copy link
Collaborator Author

Thanks! Making a test for the folded/disordered go bond removal, should be done soon!

Copy link
Member

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

How much work would it be to add a test that removes some but not all go-bonds?

@csbrasnett
Copy link
Collaborator Author

you mean in addition to what I've done here now?

@pckroon
Copy link
Member

pckroon commented May 22, 2024

Yes :)

@csbrasnett
Copy link
Collaborator Author

This is proving more difficult than anticipated... I'm guessing in general you have something in mind like this. Ie. you have two folded domains connected by some linker, and you want to 1) keep intra-domain go bonds, 2) remove domain-linker bonds, and 3) remove inter-domain bonds? I this should be possible but I need to make some big edits to the removal functionality

image

@pckroon
Copy link
Member

pckroon commented May 22, 2024

What I mean is that in test_water_bias.py:test_cross_go_bond_removal you either remove all or none. I'm not sure that's going to be the same case as you describe tbh

- remove all bonds
- remove some
@csbrasnett
Copy link
Collaborator Author

ok, I think that addresses your point?

Copy link
Member

@pckroon pckroon left a comment

Choose a reason for hiding this comment

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

Yes, perfect

@pckroon pckroon merged commit 7e59d59 into marrink-lab:master May 22, 2024
8 checks passed
@csbrasnett csbrasnett deleted the idp-go branch May 22, 2024 15:05
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.

3 participants