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

Multiple mutate fixes #565

Merged
merged 25 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
70c3b27
fixed the system error
csbrasnett Dec 13, 2023
d4c886e
Fixed edge case and tests
csbrasnett Dec 14, 2023
597f64a
moved loop into its own function
csbrasnett Apr 5, 2024
32b2ad9
found a new quote
csbrasnett Apr 5, 2024
f07e228
minor formatting changes
csbrasnett Apr 5, 2024
319ede6
made changes and fixed annotation test
csbrasnett Apr 5, 2024
eab5a1f
Merge branch 'marrink-lab:master' into mutate-fix
csbrasnett Apr 8, 2024
84ba9f5
Update codecov action
pckroon Apr 8, 2024
bc7e724
Don't fail deploy on minor issues
pckroon Apr 8, 2024
2c681be
added and clarified tests
csbrasnett Apr 8, 2024
6988702
Merge branch 'mutate-fix' of https://github.com/csbrasnett/vermouth-m…
csbrasnett Apr 8, 2024
2129a4d
added resid tests
csbrasnett Apr 8, 2024
da16846
added mut/mod examples to help
csbrasnett Apr 8, 2024
0a52393
fixed resid specification and added tests
csbrasnett Apr 8, 2024
311704e
Adapt mutmod warning test to run on System
pckroon Apr 10, 2024
6af9f66
Merge branch 'marrink-lab:master' into mutate-fix
csbrasnett Apr 11, 2024
047b98b
updated mutmod annotating and appropriate tests
csbrasnett Apr 11, 2024
6680cbe
added more conditions and corrected tests
csbrasnett Apr 11, 2024
2933079
changed comments
csbrasnett Apr 11, 2024
5fb2b3c
added more tests to increase coverage
csbrasnett Apr 11, 2024
c4c72f0
removed a degenerate condition
csbrasnett Apr 11, 2024
3e1c5c1
simplified annotation function
csbrasnett Apr 16, 2024
643b7e5
addressed comments
csbrasnett Apr 22, 2024
7224854
removed unnecessary conditions
csbrasnett Apr 23, 2024
431b322
added info to docstring
csbrasnett Apr 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ htmlcov
doc/build
doc/source/api
doc/source/.doctrees

.idea/
2 changes: 2 additions & 0 deletions vermouth/data/quotes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ Happiness is a dry martini and a good woman... or a bad woman. -- George Burns
A classical Martini is made without Vermouth, although it is better with. -- Peter C Kroon

A classical Martini is made with up to 2 sizes of olives, although newer variants can contain up to three sizes of olives. -- Peter C Kroon

So I said 'I must get out of these wet clothes, and into a dry Martini' -- Homer Simpson
50 changes: 19 additions & 31 deletions vermouth/processors/annotate_mut_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,22 @@ def _format_resname(res):
out += res.get('insertion_code', '')
return out

def _resiter(mod, residue_graph, resspec, library, key, molecule):
pckroon marked this conversation as resolved.
Show resolved Hide resolved
mod_found = False
for res_idx in residue_graph:
if residue_matches(resspec, residue_graph, res_idx):
mod_found = True
if mod != 'none' and mod not in library:
csbrasnett marked this conversation as resolved.
Show resolved Hide resolved
raise NameError('{} is not known as a {} for '
'force field {}'
''.format(mod, key, molecule.force_field.name))
res = residue_graph.nodes[res_idx]
LOGGER.debug('Annotating {} with {} {}',
_format_resname(res), key, mod)
for node_idx in res['graph']:
molecule.nodes[node_idx][key] = molecule.nodes[node_idx].get(key, []) + [mod]
return mod_found


def annotate_modifications(molecule, modifications, mutations):
"""
Expand Down Expand Up @@ -219,39 +235,14 @@ def annotate_modifications(molecule, modifications, mutations):
for resspec, mod in mutmod:
# Ie. the target residue is chain specific
if (resspec.get('chain') is not None) and (resspec.get('chain') == chain):
mod_found = False
for res_idx in residue_graph:
if residue_matches(resspec, residue_graph, res_idx):
mod_found = True
if mod != 'none' and mod not in library:
raise NameError('{} is not known as a {} for '
'force field {}'
''.format(mod, key, molecule.force_field.name))
res = residue_graph.nodes[res_idx]
LOGGER.debug('Annotating {} with {} {}',
_format_resname(res), key, mod)
for node_idx in res['graph']:
molecule.nodes[node_idx][key] = molecule.nodes[node_idx].get(key, []) + [mod]
mod_found = _resiter(mod, residue_graph, resspec, library, key, molecule)
if mod_found == False:
LOGGER.warning('Mutation "{}" not found. '
'Check target resid!'
''.format(_format_resname(resspec)))
# If instead we're targeting all residues in the chain
pckroon marked this conversation as resolved.
Show resolved Hide resolved
elif resspec.get(chain) == None:
pckroon marked this conversation as resolved.
Show resolved Hide resolved
for res_idx in residue_graph:
if residue_matches(resspec, residue_graph, res_idx):
mod_found = True
if mod != 'none' and mod not in library:
raise NameError('{} is not known as a {} for '
'force field {}'
''.format(mod, key, molecule.force_field.name))
res = residue_graph.nodes[res_idx]
LOGGER.debug('Annotating {} with {} {}',
_format_resname(res), key, mod)
for node_idx in res['graph']:
molecule.nodes[node_idx][key] = molecule.nodes[node_idx].get(key, []) + [mod]


_resiter(mod, residue_graph, resspec, library, key, molecule)

class AnnotateMutMod(Processor):
"""
Expand Down Expand Up @@ -283,8 +274,5 @@ def run_molecule(self, molecule):
annotate_modifications(molecule, self.modifications, self.mutations)
return molecule
def run_system(self, system):
mols = []
for molecule in system.molecules:
mols.append(self.run_molecule(molecule))
system.molecules = mols
super().run_system(system)

Loading