polychrom.legacy package

Submodules

polychrom.legacy.contactmaps module

This file contains a bunch of method to work on contact maps of a Hi-C data.

polychrom.legacy.contactmaps.averageBinnedContactMap(filenames, chains=None, binSize=None, cutoff=1.7, n=4, loadFunction=<function load>, exceptionsToIgnore=None, printProbability=1, map_function=<class 'map'>)[source]

Returns an average contact map of a set of conformations. Non-existing files are ignored if exceptionsToIgnore is set to IOError. example:

An example:

Parameters
  • filenames (list of strings) – Filenames to average map over

  • chains (list of tuples or Nx2 array) – (start,end+1) of each chain

  • binSize (int) – size of each bin in monomers

  • cutoff (float, optional) – Cutoff to calculate contacts

  • n (int, optional) – Number of threads to use. By default 4 to minimize RAM consumption.

  • exceptionsToIgnore (list of Exceptions) – List of exceptions to ignore when finding the contact map. Put IOError there if you want it to ignore missing files.

Returns

  • tuple of two values

  • (i) MxM numpy array with the conntact map binned to binSize resolution.

  • (ii) chromosomeStarts a list of start sites for binned map.

polychrom.legacy.contactmaps.averagePureContactMap(filenames, cutoff=1.7, n=4, loadFunction=<function load>, exceptionsToIgnore=[], printProbability=0.005, map_function=<class 'map'>)[source]

Parameters

cutofffloat, optional

Cutoff to calculate contacts

nint, optional

Number of threads to use. By default 4 to minimize RAM consumption with pure maps.

exceptionsToIgnorelist of Exceptions

List of exceptions to ignore when finding the contact map. Put IOError there if you want it to ignore missing files.

Returns

An NxN (for pure map) numpy array with the contact map.

polychrom.legacy.contactmaps.pureMap(data, cutoff=1.7, contactMap=None)[source]

calculates an all-by-all contact map of a single polymer chain. Doesn’t work for multi-chain polymers!!! If contact map is supplied, it just updates it

Parameters
  • data (Nx3 or 3xN array) – polymer conformation

  • cutoff (float) – cutoff for contacts

  • contactMap (NxN array, optional) – contact map to update, if averaging is used

polychrom.legacy.contactmaps.rescalePoints(points, bins)[source]

converts array of contacts to the reduced resolution contact map

polychrom.legacy.contactmaps.rescaledMap(data, bins, cutoff=1.7, contactMap=None)[source]

calculates a rescaled contact map of a structure :param data: polymer conformation :type data: Nx3 or 3xN array :param bins: bin starts :type bins: Lx1 array :param cutoff: cutoff for contacts :type cutoff: float, optional

Returns

resXres array with the contact map

polychrom.legacy.forces module

polychrom.legacy.forces.add_lamina_attraction(sim_object, width=1, depth=1, r=None, particles=None)[source]
polychrom.legacy.forces.add_nucleolus(sim_object, k=1, r=None)[source]

method

polychrom.legacy.forces.attraction_to_the_core(sim_object, k, r0, coreParticles=[])[source]

Attracts a subset of particles to the core, repells the rest from the core

polychrom.legacy.forces.attractive_interaction(sim_object, i, j, epsilon, sigma=None, length=3)[source]

Adds attractive short-range interaction of strength epsilon between particles i,j and a few neighboring particles requires :py:func:’LennardJones Force<Simulation.addLennardJonesForce>’

Parameters
  • i (int) – Interacting particles

  • j (int) – Interacting particles

  • epsilon (float) – LJ strength

  • sigma (float, optional) – LJ length. If you increase it past 1.5, note the cutoff!

  • length (int, optional, default = 3) – Number of particles around i,j that also attract each other

polychrom.legacy.forces.check_connectivity(sim_object, newcoords=None, maxBondSizeMultipler=10)[source]

checks connectivity of all harmonic (& abslim) bonds can be passed to doBlock as a checkFunction, in which case it will also trigger re-initialization to modify the maximum bond size multipler, pass this function to doBlock as, e.g. doBlock( 100,checkFunctions = [lambda x:a.checkConnectivity(x,6)])

polychrom.legacy.forces.create_walls(sim_object, left=None, right=None, k=0.5)[source]

creates walls at x = left, x = right, x direction only

polychrom.legacy.forces.exclude_sphere(sim_object, r=5, position=(0, 0, 0))[source]

Excludes particles from a sphere of radius r at certain position.

polychrom.legacy.forces.fix_particles_Z_coordinate(sim_object, particles, zCoordinates, k=0.3, useOtherAxis='z', mode='abs', gap=None)[source]

Limits position of a set of particles in z coordinate

Parameters
  • particles (list) – List of particles to be fixed.

  • zCoordinates (list, or tuple of length 2) – If has length of particles, then should contain all Z coordinates If has length 2, then contains z coordinates of first and Nth particles, and the rest is approximated linearly.

  • k (float, optional) – Strength of attraction, measured in kT/(bondlength)

  • useOtherAxis ("x","y" or "z", optional) – Apply the same in the other dimension

  • gap (float or None) – if gap is not None, then the force creates a gap of the width “gap” (+- 0.5 * gap) during which the force is not acting. The force starts acting after the particle moved 0.5 * gap.

polychrom.legacy.forces.gravity(sim_object, k=0.1, cutoff=None)[source]

adds force pulling downwards in z direction When using cutoff, acts only when z>cutoff

polychrom.legacy.forces.lamina_attraction(sim_object, width=1, depth=1, r=None)[source]

Attracts one domain to the lamina. Infers radius from spherical confinement, that has to be initialized already.

Parameters
  • width (float, optional) – Width of attractive layer next to the lamina, nm.

  • depth (float, optional) – Depth of attractive potential in kT note- depth < 0 for attractive! >0 is repulsive

  • r (float, optional) – Radius of an attractive cage. If not specified, inferred from previously defined spherical potential.

polychrom.legacy.forces.lennard_jones_force(sim_object, cutoff=2.5, domains=False, epsilonRep=0.24, epsilonAttr=0.27, blindFraction=-1, sigmaRep=None, sigmaAttr=None)[source]

Adds a lennard-jones force, that allows for mutual attraction. This is the slowest force out of all repulsive.

Note

This is the only force that allows for so-called “exceptions’. Exceptions allow you to change parameters of the force for a specific pair of particles. This can be used to create short-range attraction between pairs of particles. See manual for Openmm.NonbondedForce.addException.

Parameters
  • cutoff (float, optional) – Radius cutoff value. Default is good.

  • domains (bool, optional) – Use domains, defined by :py:func:’setDomains <Simulation.setDomains>’

  • epsilonRep (float, optional) – Epsilon (attraction strength) for LJ-force for all particles (except for domain) in kT

  • epsilonAttr (float, optional) – Epsilon for attractive domain (if domains are used) in kT

  • blindFraction (float, 0<x<1) – Fraction of particles that are “transparent” - used here instead of truncation

  • sigmaRep (float, optional) – Radius of particles in the LJ force. For advanced fine-tuning.

  • sigmaAttr (float, optional) – Radius of particles in the LJ force. For advanced fine-tuning.

polychrom.legacy.forces.minimizing_repulsive_Force(sim_object)[source]

Adds a special force which could be use for very efficient resolution of crossings Use this force to perform (local) energy minimization if your monomers are all “on top of each other” E.g. if you start your simulations with fractional brownyan motion with h < 0.4 Then switch to a normal force, and re-do energy minimization.

polychrom.legacy.forces.old_energy_minimization(sim_object, stepsPerIteration=100, maxIterations=1000, failNotConverged=True)[source]

Runs system at smaller timestep and higher collision rate to resolve possible conflicts.

Now we’re moving towards local energy minimization, this is here for backwards compatibility.

polychrom.legacy.forces.soft_lennard_jones_force(sim_object, epsilon=0.42, trunc=2, cutoff=2.5)[source]

A softened version of lennard-Jones force. Now we’re moving to polynomial forces, so go there instead.

polychrom.legacy.forces.spherical_well(sim_object, r=10, depth=1)[source]

pushes particles towards a boundary of a cylindrical well to create uniform well coverage

polychrom.legacy.forces.useDomains(sim_object, domains=None, filename=None)[source]

Sets up domains for the simulation. Also, pickles domain vector to “domains.dat”.

Parameters
  • domains (boolean array or None) – N-long array with domain vector

  • filename (str or None) – Filename with pickled domain vector

polychrom.legacy.legacy_format module

class polychrom.legacy.legacy_format.LegacyReporter(folder)[source]

Bases: object

__init__(folder)[source]
dump_data()[source]
report(name, values)[source]

Module contents