pygen_structures.convenience_functions module¶
This module contains convenience functions which are likely to be the main way users interact with the code.
-
pygen_structures.convenience_functions.
code_to_mol
(sequence: str, rtf: pygen_structures.charmm_containers.CHARMMResidueTopologyFile, patches: (typing.Dict[str, typing.List[int]], None) = None, name: (<class 'str'>, None) = None, segid: (<class 'str'>, None) = None, default_histidine='HSE') → pygen_structures.mol_containers.molecule.Molecule¶ Generate a
Molecule
from one letter protein code.First and last patches can be supplied in the sequence string by providing patch names separated by dashes:
e.g.
'NNEU-AFK-CT2'
- Parameters
sequence – a sequence of one letter protein codes
rtf – a
CHARMMResidueTopologyFile
to supply patch and residue definitions.patches – a dict mapping patch names to a list of the indices of the residues they are to be applied to.
name – name of the molecule for the PSF/PDB
segid – the segment ID for the created molecule. Must contain four characters or fewer.
default_histidine – default histidine version to use.
- Returns
A
Molecule
with the given sequence
-
pygen_structures.convenience_functions.
load_charmm_dir
(directory_root: str = '/home/docs/checkouts/readthedocs.org/user_builds/pygen-structures/checkouts/latest/pygen_structures/toppar') -> (<class 'pygen_structures.charmm_containers.CHARMMResidueTopologyFile'>, <class 'pygen_structures.charmm_containers.CHARMMParameterFile'>)¶ Scans a CHARMM toppar folder and reads in the rtf, prm and str files to a CHARMMResidueTopologyFile and a CHARMMParameterFile. Takes the highest version of the same file.
- Parameters
str – the path to the toppar folder. Defaults to builtin.
- Returns
CHARMMResidueTopologyFile
,CHARMMParameterFile
-
pygen_structures.convenience_functions.
pdb_to_mol
(pdb_path: str, rtf: pygen_structures.charmm_containers.CHARMMResidueTopologyFile, patches: (typing.Dict[str, typing.Tuple[int, str]], None) = None, default_histidine: str = 'HSE', kept_chain: str = 'A', segment_name: (<class 'str'>, None) = None) → pygen_structures.mol_containers.molecule.Molecule¶ Generate a Molecule from a PDB file. PDB files are assumed to contain only a single molecule.
Works by reading the list of residues, assigning the coordinates based on the atom names, and then generating the positions for the missing atoms. At present, only works for short and very simple sequences, and does not try to perceive missing residues. Patches must be manually applied manually.
- Parameters
pdb_path – the path to a PDB file
rtf – a
CHARMMResidueTopologyFile
to supply patch and residue definitions.patches – a dict mapping patch names to a list of the indices of the residues they are to be applied to.
default_histidine – default histidine version to use.
kept_chain – PDB chain to keep (atoms with no chain are) always kept.
segment_name – segment ID to be used in the
Molecule
. Must contain four characters or fewer.
- Returns
a
Molecule
generated from the PDB file.
-
pygen_structures.convenience_functions.
sequence_to_mol
(sequence: List[str], rtf: pygen_structures.charmm_containers.CHARMMResidueTopologyFile, patches: (typing.Dict[str, typing.List[int]], None) = None, name: (<class 'str'>, None) = None, segid: (<class 'str'>, None) = None) → pygen_structures.mol_containers.molecule.Molecule¶ A function for the lazy. Calls
Molecule.from_sequence
with the supplied args.- Parameters
sequence – a list of CHARMM residue names
rtf – a
CHARMMResidueTopologyFile
to supply patch and residue definitions.patches – a dict mapping patch names to a list of the indices of the residues they are to be applied to.
name – name of the molecule for the PSF/PDB
segid – the segment ID for the created molecule. Must contain four characters or fewer.
- Returns
a
Molecule
generated from the given sequence.