Skip to content

Commit

Permalink
addressed comments
Browse files Browse the repository at this point in the history
- 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"
  • Loading branch information
csbrasnett committed May 7, 2024
1 parent b62c3b2 commit 8d75c3c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
4 changes: 2 additions & 2 deletions bin/martinize2
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def pdb_to_universal(
return canonicalized


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=None):
"""
Convert a system from one force field to an other at lower resolution.
"""
Expand All @@ -187,7 +187,7 @@ def martinize(system, mappings, to_ff, delete_unknown=False, idrs=False, disorde
vermouth.DoAverageBead(ignore_missing_graphs=True).run_system(system)
if idrs:
LOGGER.info("Annotating IDRs.", type="step")
vermouth.AnnotateIDRs(idr_regions=[(int(start), int(stop)) for start, stop in disordered_regions]).run_system(system)
vermouth.AnnotateIDRs(id_regions=[(int(start), int(stop)) for start, stop in disordered_regions]).run_system(system)
LOGGER.info("Applying the links.", type="step")
vermouth.DoLinks().run_system(system)
LOGGER.info("Placing the charge dummies.", type="step")
Expand Down
26 changes: 16 additions & 10 deletions vermouth/processors/annotate_idrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,22 @@
LOGGER = StyleAdapter(get_logger(__name__))


def annotate_disorder(molecule, idr_regions):
def annotate_disorder(molecule, id_regions, annotation="cgidr"):
"""
annotate the disordered regions of the molecule
Annotate the disordered regions of the molecule
molecule: :class:`vermouth.molecule.Molecule`
the molecule
idr_regions: list
list of tuples defining the resids of the idrs in the molecule
annotation: str
name of the annotation in the node
"""

for key, node in molecule.nodes.items():
_old_resid = node['_old_resid']
if _in_resid_region(_old_resid, idr_regions):
molecule.nodes[key]["cgidr"] = True
if _in_resid_region(_old_resid, id_regions):
molecule.nodes[key][annotation] = True

class AnnotateIDRs(Processor):
"""
Expand All @@ -43,21 +50,21 @@ class AnnotateIDRs(Processor):
"""

def __init__(self, idr_regions = None):
def __init__(self, id_regions=None):
"""
Parameters
----------
idr_regions:
id_regions:
regions defining the IDRs
"""
self.idr_regions = idr_regions
self.id_regions = id_regions

def run_molecule(self, molecule):
"""
Assign disordered regions for a single molecule
"""

annotate_disorder(molecule, self.idr_regions)
annotate_disorder(molecule, self.id_regions)

return molecule

Expand All @@ -71,8 +78,7 @@ def run_system(self, system):
----------
system: :class:`vermouth.system.System`
"""
if not self.idr_regions:
if not self.id_regions:
return system
self.system = system
LOGGER.info("Annotating disordered regions", type="step")
super().run_system(system)

0 comments on commit 8d75c3c

Please sign in to comment.