wechrom Classes and Modules
Class: wechrom.WechromSystem
- class wechrom.WechromSystem(pdbxFile, xmlFile='DEFAULT', memoryRange=4, verbose=False)[source]
Build a WEChroM system with topology and system information for openmm simulations The vanilla version should only have DNA beads
- positions
positions of all atoms in the initial pdbx file
- Type
np.array, N x 3
- atoms
index of all atoms (DNA)
- Type
list of openmm Atoms
- residues
index of all residues (base pairs)
- Type
list of openmm Residues
- dnaStrands
index of all atoms in the two strands I and J
- Type
dict of list of int
- dnaRes
index of all DNA residues
- Type
list of int
- nBp
number of DNA residues
- Type
int
- dna_Atom2Res, dna_Res2Atom
atom2res and res2atom relation for the two dna strands
- Type
dict of dict
- dnaTypes
name of the two strands I and J
- Type
list
- pdbx
- Type
openmm PDBxFile
- forcefield
built on the xml file
- Type
openmm forcefield
- system
built on topology from pdbx and forcefield
- Type
openmm system
- addForce(force, forceName)[source]
Add a force to the system, set the force group and store the corresponding str name
- Parameters
forces (openmm force) –
forceName (str) –
- addConnetivityForce(kCon=3000.0, bondLength=2.0, forceName='Con')[source]
Add a connectivity force to the system
- Parameters
kCon (float, optional) – k in harmonic spring 0.5k(r-r0)^2. Defaults to 3000.0.
bondLength (float, optional) – r0 in harmonic spring 0.5k(r-r0)^2. Defaults to 2.0.
forceName (str, optional) – Defaults to ‘Connectivity’.
- addExcludVolumeForce(kExcl=5856.0, rExcl=2.07, forceName='Ex-vol')[source]
Add the connectivity term to the system
- addIntraStrandMemoryForce(temPos, depth=0.3, width=0.2, forceName='Intra_m')[source]
Add the intra-strand associative memory force to the system
- Parameters
temPos (dict) – dict, 10 x 2 x memory_range x 3: positions of templates
depth (float, optional) – depth of the Gaussian Well. Defaults to 0.3. unit = kT
width (float, optional) – width of the Gaussian Well. Defaults to 0.2. unit = reduced length
Available (depth, width) – (0.15, 0.1),(0.2, 0.15), (0.25, 0.17), (0.3, 0.2)
- addInterStrandMemoryForce(temPos, depth=0.3, width=0.2, forceName='Inter_m')[source]
Add the inter-strand associative memory force to the system
- Parameters
temPos (dict) – dict, 10 x 2 x memory_range x 3: positions of templates
depth (float, optional) – depth of the Gaussian Well. Defaults to 0.3. unit = kT
width (float, optional) – width of the Gaussian Well, has a factor of 2 compared with the intra-strand width. Defaults to 0.2. unit = reduced length
Available (depth, width) – (0.15, 0.1),(0.2, 0.15), (0.25, 0.17), (0.3, 0.2) should keep the same as intra-strand
- addDefaultForces()[source]
Add default forces designed for the wechrom system, including the connectivity term, the excluded-volume term, generating associative memory templates and adding inter- and intra- strand associative memory terms
- initializeSimulation(platform='CPU', temperature=300, collisionRate=1.0, timeStep=20.0)[source]
Initialize an openmm simulation.
- Parameters
platform (str, optional) – platform. Defaults to ‘CPU’. Can be ‘CPU’, ‘CUDA’ or ‘OpenCL’
temperature (int, optional) – temperature in kelvin. Defaults to 300.
collisionRate (float, optional) – collision rate for the langevin integrator in 1/picosecond. Defaults to 1.0.
timeStep (float, optional) – simulation time step in femtosecond. Defaults to 20.0.
- platform
CPU, CUDA or OpenCL. Defaults to CPU
- Type
openmm platform
- integrator
a LangevinIntegrator with given temperature, collision rate and timestep
- Type
openmm integrator
- simulation
a simulation with wechrom topology, system, instance’s integrator and given platform. The initial positions are set by wechrom pdbx file and the initial velocities are set to temperature. Local energy is minimized.
- Type
openmm simulation
- runSteps(steps=1000, reportFreq=100, append=False, outputDir='DEFAULT', energyFilename='energy.txt', dcdFilename='movie.dcd', chkFilename='checkpt.chk')[source]
Run simulation on openmm. Should be called after initializeSimulation(). Report energy for each force and trajectories in dcd format at the given report frequency. Save the last checkpoint
- Parameters
outputDir (str, optional) – output directory. Defaults to ‘DEFAULT’.
steps (int, optional) – total steps for the simulation. Defaults to 1000.
reportFreq (int, optional) – report frequency. Defaults to 100.
append (bool, optional) – append to an old trajectory and energy or not. Defaults to False.
energyFilename (str, optional) – file name to report energy. Defaults to ‘energy.txt’.
dcdFilename (str, optional) – file name to report trajectory. Defaults to ‘movie.dcd’.
chkFilename (str, optional) – file name for the last checkpoint. Defaults to ‘checkpt.chk’.
Class: wechrom.SingleNucleoSystem
- class wechrom.SingleNucleoSystem(pdbxFile, xmlFile='DEFAULT', memoryRange=4, nucZero=- 1, verbose=False)[source]
Build a single-nucleosome WEChroM system with topology and system information for openmm simulations
- Parameters
WechromSystem (object) – DNA only system
- proTypes
names of protein atoms
- Type
list of str
- protein
index of protein atoms
- Type
list of int
- proRes
index of protein residues
- Type
list of int
- pro_Atom2Res
atom id to res id relation for proteins
- Type
dict
- pro_Res2Atom
res id to atom id relation for proteins
- Type
dict
- nucZero
res id of the zero point DNA bp of the nucleosome
- Type
int
- addExcludVolumeForce(kExcl=5856.0, rExclDna=2.07, rExclPro=26.0, forceName='Ex-vol')[source]
Add the connectivity term to the system. Overide the original method in WechromSystem
- addNucleoCenterMemoryForce(centerBonds, centerDepth=0.4, centerWidth=3.0, forceName='cen_nuc')[source]
Add the nucleosome center associative memory term to the system.
Module: wechrom.prepare_memory
- wechrom.prepare_memory.generate_naked_memory_files(memory_dir='DEFAULT', memory_filename='naked.mem', memory_range=4)[source]
generate the file to store associative memory fragments
- Parameters
memory_dir (str, optional) – Defaults to current workin directory.
memory_filename (str, optional) – Defaults to ‘naked.mem’.
memory_range (int, optional) – Defaults to 4.
- wechrom.prepare_memory.generate_nucleo_memory_files(memory_dir='DEFAULT', memory_filename='nucleo.mem', database_location='data/memory_template/', neighbor_radius=100.0)[source]
generate the file to store associative memory fragments for nucleosomes
- Parameters
memory_dir (str, optional) – Defaults to current workin directory.
memory_filename (str, optional) – Defaults to ‘nucleo.mem’.
database_location (str, optional) – Defaults to ‘data/memory_template/’.
neighbor_radius (float, optional) – the radius to select neighbor contacts. in Angstrom for MDAnalysis. Defaults to 100.0
- wechrom.prepare_memory.get_naked_memory_template_bonds(memory_list_dir='DEFAULT', memory_list_filename='naked.mem', database_location='data/memory_template/')[source]
Extract the positions of template associative memory fragments
- Parameters
memory_list_dir (str, optional) – directory of the memory list. Defaults to current workin directory.
memory_list_filename (str, optional) – filename of the memory list. Defaults to ‘naked.mem’.
database_location (str, optional) – location of the database. Defaults to ‘data/memory_template/’.
- Returns
- positions of templates
layer 1(10): template, keys 0-9 layer 2(2): dna type (strand), keys ‘I’, ‘J’ layer 3(np.array, memory_range x 3): positions of template residues in the range of memory_range
- Return type
dict, 10 x 2 x memory_range x 3
- wechrom.prepare_memory.get_nucleo_memory_template_bonds(memory_list_dir='DEFAULT', memory_list_filename='nucleo.mem', database_location='data/memory_template/')[source]
Extract the positions of template associative memory fragments
- Parameters
memory_list_dir (str, optional) – directory of the memory list. Defaults to current workin directory.
memory_list_filename (str, optional) – filename of the memory list. Defaults to ‘nucleo.mem’.
database_location (str, optional) – location of the database. Defaults to ‘data/memory_template/’.
- Returns
lengths of center templates bonds, 1st layer is type, 2nd layer is relative res_id dict, 2 x 2 x N1 x N2: lengths of neighbor templates bonds between the pair of (type, res_id) atoms
- Return type
dict, 2 x N
- wechrom.prepare_memory.read_memory_template(template_list_dir='DEFAULT', template_list_filename='data/naked_database_list')[source]
Read the list of associative memory template filenames
- Parameters
template_list_dir (str, optional) – directory of the template list file. Defaults to ‘DEFAULT’.
template_list (str, optional) – name of the template list file. Defaults to ‘data/naked_database_list’.
- Raises
Exception – custom template list is not supported right now
- Returns
fist column ‘filename’ and second column ‘n_bp’
- Return type
pandas.DataFrame
Module: wechrom.utils
- wechrom.utils.coarse_grain_atompdb_2_wechromcif(pdb_filename, out_dir='/home/docs/checkouts/readthedocs.org/user_builds/wechrom/checkouts/latest/docs/source', out_file_prefix='coarse_grain', out_pdb=False)[source]
Coarse grain an atomistic DNA pdb file into a wechrom cif file. *YOU MAY NEED TO MODIFY THIS FUNCTION DEPENDING ON YOUR PDB FILE*
- Parameters
pdb_filename (str or file) – pdb file
out_dir (str, optional) – output directory. Defaults to os.getcwd().
out_file_prefix (str, optional) – output file prefix. Defaults to ‘coarse_grain’.
out_pdb (bool, optional) – whether to generate a corase grained pdb file. Defaults to False.
- wechrom.utils.num_inter_memory_bonds(n_bp, memory_range, n_template)[source]
Calculate the expected number of bonds for inter-strand associative memory force
- Parameters
n_bp (int) – number of basepairs in the system
memory_range (int) – size of the memory
n_template (int) – number of templates used as memories
- Returns
number of expected inter-strand bonds
- Return type
int
- wechrom.utils.num_intra_memory_bonds(n_bp, memory_range, n_template)[source]
Calculate the expected number of bonds for intra-strand associative memory force
- Parameters
n_bp (int) – number of basepairs in the system
memory_range (int) – size of the memory
n_template (int) – number of templates used as memories
- Returns
number of expected intra-strand bonds
- Return type
int