Technical Documentation
Utilities: TraceChain

The TraceChain class can be used to generate a path for a Chain and then place monomeric units along the path. Thus, it can be used to generate starting coordinates for Chain-based models.

At this time, a straight-line path and a circular path is available. It is also possible to trace the path from the (AtomVector) coordinates of another chain. The template need not be of the same size as the chain for which we are generating the path. To use the tracing feature, you must provide a method called pathfromavf(), see below.

To place the monomeric units, you must provide a template that contains an embedded coordinate frame, see below. The template will be duplicated and placed along the path. Each monomeric unit is offset from the previous by a distance and a torsional angle, the amount of both of which can be specified. The chain may contain more than one type of monomer as long as a template is provided for each type.

The TraceChain module is located in Yup.Tools. Thus, the required import statement is some variant of: from Yup.Tools.TraceChain import *.

Data Attributes

There are several data attributes but they are not meant to be manipulated directly:

Attribute

Description

Rise

Dictionary, keyed by the base style character, of distance [Å] to the next base unit.

Twist

Dictionary, keyed by the base style character, of the angle of rotation [°] of the next base unit relative to the current unit.

Scale

Dictionary, keyed by the base style character, of the number of monomeric units (e.g basepairs) represented by the base unit.

Template

Dictionary, keyed by the base style character, of the template for the base style.

BaseCoords

List of AtomVector slices, one per base unit

BaseRise

List of distance from the first to the current base unit, one per base unit

BaseStyle

List of base style character, one per base unit

BaseTwist

List of twist angles, one per base unit

BaseBase

List of base symbols, one per base unit

Path

List of Atom Vector of the center of each base unit, one per base unit plus one base unit projected beyond the last unit.

unittotal

Total number of base units

basetotal

Total number of base pairs

pathlength

Total length of the path traced by the center of the base units. This should be the same value as the last item in BaseRise.

Class

The TraceChain class consists of a constructor and eight methods.

TraceChain()

Constructor function

preparechain()

Prepare to generate a path

makeline()

Generate a straight line path

makecircle()

Generate a closed circular path

pathfromavf()

This must be defined in a derived class. This is a placeholder that will generate an exception.

followpath()

Follow a given path

tracepath()

Trace the path read from an AtomVector file.

makebasetwist()

Generate a table of twist angles, one for each base step. This method ignores the base sequence. Override this method if you want to take base sequence into consideration.

makebasecoords()

current

Methods


The constructor requires a tuple to define the characteristics of a base unit of at least one model type.

Method Name
Number of Arguments
Return Value
__init__
1
The TraceChain class
Argument
Type
Preset Value
parameters
tuple of tuples
-

This class must be initialized with a parameter list which contains a tuple for each base style. For a given base style the tuple contains five items:

STYLE
RISE
EQUILTWIST
SCALE
TEMPLATE
A character to identify the base style
The standard distance between successive base units
The standard twist between successive base units
The number of base pairs represented by one base unit
Coordinates of the origin, one point each on the X-, Y- and Z-axes and then atoms of a standard base unit in the order that they appear in the Atom Vector
'#'
3.4Å
34°
1
((0,0,0),(1,0,0),(0,1,0),(0,0,1),(0,2.5,0),(5,0,0),(0,0,0))
'@'
17Å
170°
5
((0,0,0),(1,0,0),(0,1,0),(0,0,1),(0,2.5,0),(5,0,0),(0,0,0))

The third row shows the values for the 3DNA base style where each base pair is represented by an asymmetrical base unit containing three atoms. The last row shows the entries for a base style that we might call 0.6DNA where the same asymmetrical base unit represents five basepairs; this is not actually implemented.

From parameters this method constructs the dictionaries: Rise, Twist, Scale and Template.


The preparechain() method is called to prepare to generate a path for the center of a chain.

Method Name
Number of Arguments
Return Value
preparechain
2
-
Argument
Type
Preset Value
basegroups
tuple of Group AtomMaps
-
coordinates
AtomVector
-

The base units of the chain are listed in basegroups and the generated coordinates will be saved in coordinates. It is assumed that the base style character is encoded in the (the last character of the) name of each group AtomMap that represents a base unit.

From the dictionaries constructed earlier, this method constructs the tables BaseCoords, BaseRise and BaseStyle and calculates the parameters: unittotal, basetotal and pathlength.


The makeline() method generates a straight line path, i.e., the coordinates of the center of a chain lies in a straight line.

Method Name
Number of Arguments
Return Value
makeline
1
-
Argument
Type
Preset Value
noise
float
10-9

The line extends from the origin along the X-axis. Random values are generated for the Y- and Z-axes; these are sampled from the Uniform distribution with minimum value -noise and maximum +noise. This method creates the table: Path, which is a list of single-atom AtomVectors.


The makecircle() method generates a circular path, i.e., the coordinates of the center of a chain lies in a circle whose circumference is the length of the chain.

Method Name
Number of Arguments
Return Value
makecircle
1
-
Argument
Type
Preset Value
noise
float
10-9

The circle lies in the X-Y plane. Random values are generated for the Z-axis; these are sampled from the Uniform distribution with minimum value -noise and maximum +noise. This method creates the table: Path, which is a list of single-atom AtomVectors.


The pathfromavf() method defined in this class is simply a placeholder that raises an exception when you try to use it. You must derive a class from TraceChain and define this method in the derived class. This method is called by the tracepath() method.

Method Name
Number of Arguments
Return Value
pathfromavf
2
list of coordinate tuples
Argument
Type
Preset Value
filename
string
-
record
integer
-

This method takes two arguments, the name of an Atom Vector file and the record number that is to be read. The purpose of this method is to read the desired record from the Atom Vector file and trace the path of the molecule. The concept of a path depends on the molecule type. For example, for an all-atom model of DNA, the path could trace the centroid of successive base pairs. In this example, the path does not necessarily run through actual atoms. As another example, for the rrDNAv1 model, the path would trace the Center atom of successive base pairs, each of which is represented by three atoms placed in a plane. In this example, the path runs through an actual atom from each base unit. Clearly, this method must be implemented separately for each type of model. Regardless of the scale of the model, this method must convert the path to a scale of one base pair per base unit. This method must return the path as a list of coordinate tuples.


The followpath() method is called by the tracepath() method. The path is converted to the base unit representation of the model for which the path is being generated. The last point of the path is also generated based on whether the curve is closed or not.

Method Name
Number of Arguments
Return Value
followpath
2
-
Argument
Type
Preset Value
Points
list
-
closed
list
-

The Points argument is a list of coordinate tuples. The closed argument indicates that the model is closed if it has a non-zero value or is open if the value is zero. This method creates the table: Path, which is a list of single-atom AtomVectors.


The tracepath() method calls the pathfromavf() method to read an AtomVector file to obtain the coordinates of a template. The template is then scaled to the dimensions of the model for which a new path is to be generated. Then the followpath() method is called to generate the actual path.

Method Name
Number of Arguments
Return Value
tracepath
3
-
Argument
Type
Preset Value
filename
string
-
record
integer
0
closed
integer
1

The filename argument is a string containing the name of an AtomVector file from which the template is to be obtained. The record argument is the number of the record that is to be actually read, the preset value of 0 means the last record. The closed argument indicates that the model is closed if it has a non-zero value or is open if the value is zero.


The makebasetwist() method generates a table of twist angles, one per base step. Regardless of base sequence, the standard twist is generated according to the tract style: 34° for 3DNA and 170° for 0.6DNA.

Method Name
Number of Arguments
Return Value
makebasetwist
0
-

Replace this method with your own implementation if you want to take base sequence into consideration.


The makebasecoords() method places the base units along a previously generated path. The base units may be of any style (indicated by a style character) for which a template exists.

Method Name
Number of Arguments
Return Value
makebasecoords
1
-
Argument
Type
Preset Value
deltatwist
float
0.0 degrees

Each base unit is rotated with respect to the previous unit by an angle: Twist + Scale * deltatwist. Twist is the value for the previous base unit and Scale is for the new base unit.


Usage
To generate a curve that:
Subclass
[0] Initialize
[1] Prepare
[2] Generate Path
[3] Place monomers
follows an existing curve
Derive class (e.g. Curve) from TraceChain and add method pathfromavf()
T = Curve(...)
T.preparechain(...)
T.tracepath(...)
T.makebasecoords(...)
is a straight line
Not required
T = TraceChain(...)
T.makeline(...)
is a circle
T.makecircle(...)
Functions

The MakeCircle() function generates the coordinates for a chain of base units along a circle.

Function Name
Number of Arguments
Return Value
MakeCircle
5
-
Argument
Type
Preset Value
parameters
(see __init__())
-
basegroups
(see preparechain())
-
coordinates
(see preparechain())
-
noise
(see makecircle())
10-9
deltatwist
(see makebasecoords())
0.0

The MakeLine() function generates the coordinates for a chain of base units along a straight line.

Function Name
Number of Arguments
Return Value
MakeLine
5
-
Argument
Type
Preset Value
parameters
(see __init__())
-
basegroups
(see preparechain())
-
coordinates
(see preparechain())
-
noise
(see makeline())
10-9
deltatwist
(see makebasecoords())
0.0

The generated coordinates are saved in the coordinates argument, which is an AtomVector provided by the caller.


Technical
Introduction
Directory
Vectors
Energy
Model
Assembly
Methods
FPF
FFF
AVF
TaroScript
YammpScript
Python
Utilities

Home
Information
News
User
Technical
Programmer
iYup
Download
Showcase
ETC