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]
run(tmax=200, li=0.2, lf=0.01, ei=0.3, ef=0.05, Ti=0.1, Tf=2, c=0, calcC=False)[source]
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.

  • 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
coordinate(sec, row, col)[source]

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


Copy to a new object.


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

setOrigin(x0, y0, z0)[source]
thresholdMap(min_cutoff=None, max_cutoff=None)[source]

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


Convert to a TEMPy Map.

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/MRC2015 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.

  • 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.
  • num_iter (int) – After reading density map, coordinates are predicted with the topology representing network method. This parameter is the total number of iterations of this algorithm.
  • 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’).

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