EMD File

This module defines functions for parsing and writing EMD map files.

class TRNET(n_nodes)[source]

Class for building topology representing networks using EM density maps. It uses the algorithm described in [TM94].

[TM94]Martinetz T, Schulten K, Topology Representing Networks. Neural Networks 1994 7(3):507-552.
inputMap(emdmap, sample='density')[source]
outputEdges()[source]
run(**kwargs)[source]
Parameters:
  • tmax (int) – multiplicative factor such that the maximum total number of iterations is tmax times the number of beads default 200
  • li (float) – initial Gaussian bandwidth for determining how much each node is moved As the iterations progress, the bandwidth increases from li to lf. default 0.2
  • lf (float) – final Gaussian bandwidth for determining how much each node is moved As the iterations progress, the bandwidth increases from li to lf. default 0.01
  • ei (float) – initial value of the adaptive step size As the iterations progress, the step size increases from ei to ef. default 0.3
  • ef (float) – final value of the adaptive step size As the iterations progress, the step size increases from ei to ef. default 0.05
  • c (float) – cutoff for moving the nodes. When c=0, all nodes are moved in each iteration. When c>0, only the nearest c/#nodes nodes are moved. This parameter is used for optimization. default 0
  • calcC (bool) – whether to calculate the connectivity matrix from TRN. This is False by default because the connectivity is usually built by ANM or GNM. default False
  • Ti (float) – initial value of the adaptive threshold for building the connectivity. Not used if calcC is False. default 0.1
  • Tf (float) – final value of the adaptive threshold for building the connectivity. Not used if calcC is False. default 2
runOnce(t, l, ep, T, c=0)[source]
run_n_pause(k0, k, tmax=200, li=0.2, lf=0.01, ei=0.3, ef=0.05, Ti=0.1, Tf=2)[source]
class EMDMAP(stream, min_cutoff, max_cutoff)[source]

Class for handling EM density maps in EMD/MRC2014 format.

Parameters:
  • stream – a file stream containing data from an EMD/MRC file.
  • min_cutoff (None, float) – minimum cutoff for thresholding
  • max_cutoff (None, float) – maximum cutoff for thresholding
center()[source]
coordinate(sec, row, col)[source]

Given a position as sec, row and col, it will return its coordinate in Angstroms.

copyMap()[source]

Copy to a new object.

drawsample()[source]
drawsample_uniform()[source]
getApix()[source]
getOrigin()[source]
getTitle()[source]
numidx2matidx(numidx)[source]

Given index of the position, it will return the numbers of section, row and column.

setApix(apix)[source]
setOrigin(x0, y0, z0)[source]
setTitle(title)[source]
thresholdMap(min_cutoff=None, max_cutoff=None)[source]

Thresholds a map and returns a new map like the equivalent function in TEMPy

toTEMPyMap()[source]

Convert to a TEMPy Map.

apix
filename
origin
parseEMDStream(stream, **kwargs)[source]

Parse lines of data stream from an EMD/MRC2014 file and optionally return an AtomGroup containing TRN nodes based on it.

Parameters:stream – Any object with the method readlines (e.g. file, buffer, stdin)
parseEMD(emd, **kwargs)[source]

Parses an EM density map in EMD/MRC2014 format and optionally returns an AtomGroup containing beads built in the density using the TRN algorithm [_TM94].

This function extends parseEMDStream().

See Cryo-EM Dynamics (CryoDy) for a usage example.

Parameters:
  • emd (str) – an EMD identifier or a file name. A 4-digit EMDataBank identifier can be provided to download it via FTP.
  • min_cutoff (float) – minimum density cutoff to read EMD map. The regions with lower density than this cutoff are discarded. This corresponds to the previous cutoff and take values from it.
  • max_cutoff (float) – maximum density cutoff to read EMD map. The regions with higher density than this cutoff are discarded.
  • n_nodes (int) – A bead based network will be constructed into the provided density map. This parameter will set the number of beads to fit to density map. Default is 0. Please change it to some number to run the TRN algorithm. Other parameters are passed through as kwargs to TRNET.run() as described in its docs.
  • map (bool) – Return the density map itself. Default is False in line with previous behaviour. This value is reset to True if n_nodes is 0 or less.
writeEMD(filename, emd)[source]

Writes a map file in MRC2014 format (counting words 25 to 49 as ‘extra’).

Parameters:
  • filename (str) – name for output file
  • emd (EMD) – an EMD object containing data to be written to file