vermouth.processors.annotate_mut_mod module¶
Provides a processor that annotates a molecule with desired mutations and modifications.
- class vermouth.processors.annotate_mut_mod.AnnotateMutMod(modifications=None, mutations=None)[source]¶
Bases:
Processor
Annotates residues to have the required ‘modification’ and ‘mutation’ attributes on all nodes.
See also
- vermouth.processors.annotate_mut_mod.annotate_modifications(molecule, modifications, mutations, resspec_counts)[source]¶
Annotate nodes in molecule with the desired modifications and mutations
- Parameters:
molecule (networkx.Graph)
modifications (list[tuple[dict, str]]) – The modifications to apply. The first element is a dictionary contain the attributes a residue has to fulfill. It can contain the elements ‘chain’, ‘resname’ and ‘resid’. The second element is the modification that should be applied.
mutations (list[tuple[dict, str]]) – The mutations to apply. The first element is a dictionary contain the attributes a residue has to fulfill. It can contain the elements ‘chain’, ‘resname’ and ‘resid’. The second element is the mutation that should be applied.
resspec_counts (list[dict]) – List modified in place containing information about whether a modification/mutation has been applied successfully. If the target is found, the dictionary has one entry, {‘success’: True}. If not, ‘success’ is False and there are additional items to indicate information about the failure.
- Raises:
NameError – When a modification is not recognized.
- vermouth.processors.annotate_mut_mod.parse_residue_spec(resspec)[source]¶
Parse a residue specification: [<chain>-][<resname>][[#]<resid>] where resid is /[0-9]+/. If resname ends in a number and a resid is also specified, the # separator is required. Returns a dictionary with keys ‘chain’, ‘resname’, and ‘resid’ for the fields that are specified. Resid will be an int.
- vermouth.processors.annotate_mut_mod.residue_matches(resspec, residue_graph, res_idx)[source]¶
Returns True iff resspec describes residue_graph.nodes[res_idx]. The ‘resname’s nter and cter match the residues with a degree of 1 and with the lowest and highest residue numbers respectively.
- Parameters:
resspec (dict) – Attributes that must be present in the residue node. ‘resname’ is treated specially as described above.
residue_graph (networkx.Graph) – A graph with one node per residue.
res_idx (collections.abc.Hashable) – A node index in residue_graph.
- Returns:
Whether resspec describes the node res_idx in residue_graph.
- Return type: