Version 3.0 alpha
Description
The focus of this library is on the data structures and algorithms used within the fields of bioinformatics and molecular modelling. The approach used closely follows that of the Standard Template Library (STL) which is part of ISO/ANSI standard C++. This library uses templates to implement generic programming. Templates allow the development of efficient programming modules using compile-time mechanisms. Although the BTL has been designed with biomolecular applications in mind it contains classes of more general utility. For instance, the matrix container and associated algorithms could be used for matrix algebra in many contexts.
Floating Point Precision
The floating point precision of the library as a whole is defined as the user defined type BTL_REAL. A typedef statement in the BTL.h. e.g.
typedef double BTL_REAL;
To change the precision used simply alter this statement and recompile your code. Of course not all floating point variables in the library are of type BTL_REAL, some, for instance, are fixed at type double to avoid large round off errors. In spite of this, setting BTL_REAL to be of type float may well result significant round off problems in certain calculations such as those used by the eigen_solution() algorithm.
Debugging Version of Library
If the DEBUG_VERSION symbol is defined then the library will carry out extra error checking such as some array bounds checking. This checking will obviously make the library more robust but will also increase excecution times. Simply comment out the define statement in the BTL.h file, if the extra checking is not required.
This is simple class for reading ATOM records from clean PDB format
files.
Friends: an output operator
Authors: M.A.Williams
Files: ATOM_processor.h
Dependencies: None
Operations
This class defines a functor or function object which can be used
by a generic sort routine to sort atoms into the order used in Brookhaven
pdb format files. Order is defined by strings, 2 or 3 characters long.
Authors: W.R.Pitt
Files: pdb_sort.h
Dependencies: none
Operations
This class defines a function object that will, given an amino acid
single letter code with return a property value for that residue type.
Authors: W.R.Pitt
Files: amino_acid_property.h
Dependencies: none
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
V = xi + yj + zk + ...
However, its primary use will probably in representing the position
of atoms in three dimensions. The default contructor contructs a 3 element
numeric_vector.
There are several types associated with this class:
value_type : by default the same as the type BTL_REAL
which is defined in BTL.h
iterator : this is a STL type iterator. It can be used
to randomly access the elements of the numeric_vector e.g.
numeric_vector<> v1; ... for (numeric_vector<>::iterator
i = v1.begin(); i != v1.end(); i++) cout << *i;
const_iterator : used to access a const numeric_vector.
size_type : this is an unsigned integer type that represents
the size of any numeric_vector object.
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
There are two types associated with this class:
value_type : this type is the same as the numeric_vector::value_type
and defines the type of the elements of the matrix.
size_type : this type is the same as the numeric_vector::size_type
and defines the type of the matrix indexes. It should always be an unsigned
integer type.
Authors: D.S.Moss, W.R.Pitt, I.Tickle, M.A.Williams.
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
Operations
(1)M=LL(tr) (2)compute L(-1) (3)M(-1)=L(-1)(tr)L(-1) Input should
contain numerical data that can be interpreted as a symmetric positive
definite matrix. The output is the inverse of this matrix in the form of
a matrix of the same size as the input and probably containing data of
type BTL_REAL.
Operations
Operations
Operations
Operations
Operations
Operations
friend ostream& operator<<(ostream &os, const BTL_VertexWithEdges
&m);
Generalizations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
friend ostream& operator<<(ostream &os, const BTL_Edge
&m);
Generalizations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
Generalizations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
Generalizations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
N.B. The graph classes command syntax will be
revised in the 3.0beta version
Specializations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
Operations
N.B. The graph classes command syntax will be
revised in the 3.0beta version
Operations
This page was created automatically using Together/C++
Information Export in conjunction with the Borland C++ development suite.
This class is a simple PIR sequence file processor. It is not complete
and is only included for use by the demo programs that come with this library.
It can parse a PIR format containing any number of sequences and provide
the data as a vector
Authors: W.R.Pitt
Files: PIR_processor.h
Dependencies: none
PPM_processor
This class is a simple ascii PPM image file processor. It is not
complete and is only included for use by the demo programs that come with
this library.
Authors: W.R.Pitt
Friends: ostream operator
Files: PPM_processor.h
Dependencies: none
XYZ_processor
This is simple class for reading xyz format files. It is really
only included in the library so that real data can be used in the test
programs.
Friends: an output operator
Authors: W.R.Pitt
Files: XYZ_processor.h
Dependencies: None
needleman_wunsch_similarity
Pairwise similarity score for two sequences.
Restrictions: The containers holding
the sequences must have at least forward iterators and an equality operator
(==) should be defined for pairs of elements. The score for any pair of
elements is match_score (or mismatch_score) - total gap penalty. The total
gap penalty = gap_penalty + (length_of_gap * gap_length_multiplier)
needleman_wusch_align
Pairwise alignment for two complete sequences. The score for any
pair of elements is match_score (or mismatch_score) - total gap penalty.
The total gap penalty = gap_penalty + (length_of_gap * gap_length_multiplier).
The aligned sequence elements are placed alternately in the output container
i.e with the odd elements representing the first sequence.
Restrictions: The containers holding
the sequences must have at least forward iterators and an equality operator
(==) should be defined for pairs of elements. The result container should
either have no fixed size or be created at least twice the size of the
longer sequence.
fourier_transform
Two dimensional FFT. 1D and 3D versions also available
mean
Calculate the mean value of the elements in a container.
mean_absolute_deviation
Calculate mean absolute deviation from the mean of the elements
in a container.
variance
Calculate the sample variance of the elements in a container.
normal_statistics
Calculate the mean, mean absolute deviation from mean, sample variance,
skew and kurtosis of the distribution of the elements in a container.
max_mismatch
Returns the maximum difference between equivalent elements in two
containers in the sense of (a-b)
max_absolute_mismatch
Returns the largest absolute difference between equivalent elements
in two containers
min_mismatch
Returns the minimum difference between equivalent elements in two
containers in the sense of (a-b)
min_absolute_mismatch
Returns the smallest absolute difference between equivalent elements
in two containers
every_less_equal
Returns true if every element of a is less than or equal to the
equivalent element of b
every_less
Returns true if every element of a is less than the equivalent element
of b
less_absolute
Compare the absolute values of two arguements true if |x| < |y|
random_uniform
Portable random number generator that produces float,double, int
and long random numbers. In the case of float & double the numbers
are uniformly distributed in the range 0 to 1. In the case of long they
are uniformly distributed in the range 0 to 2**31 and in the int case from
0 to 2**15. It is an implementation of Donald Knuth's floating point ranf_array
generator, a lagged additive generator x(i) = (x(i-KK) + x(i-LL))mod 1.0
for float and double numbers and Knuth's lagged subtractive generator x(i)
= (x(i-KK) - x(i-LL))mod 2**MM where MM = 15 for int and MM=30 for long.
An object containing random numbers is constructed and used by random_uniform
random_normal
Portable random number generator that produces float or double precision
random numbers from a normal distibution using the ratio method of Kinderman
& Monahan (see Knuth TAOCP).
random_exponential
Portable random number generator that produces float or double precision
random numbers from an exponential distibution.
numeric_vector
this template class represents a numerical vector of any size.
Authors: D.S.Moss, W.R.Pitt, M.A.Williams
Files: btl_numeric_vector.h
Friends: Friend equivalents to some functions are available
and are documented with these functions. Also available is: friend ostream&
operator<<(ostream &os, const numeric_vector
Dependencies: NumericLimits.h
scalar_product
Scalar/dot product of two vectors.
direct_product
Direct product of two matrices or vectors .
triple_vector_product
Vector product of three triples.
triple_scalar_product
Scalar product of three triples.
separation_squared
Calculate the squared distance between the points represented by
two vectors.
separation
Calculate the distance between the points represented by two vectors.
sum
Returns the sum of the vector elements.
sum_precise
Returns the sum of the vector elements, but accumulates the elements
in order of ascending value in order to minimise rounding errors.
sum_of_squares
Returns the sum of the squares of the vector elements.
sum_of_squares_precise
Returns the sum of the squares of the vector elements, but accumulates
the elements in order of ascending value in order to minimise rounding
errors.
magnitude
Returns the length of a vector.
magnitude_precise
Returns the precise length of a vector.
rotate
Rotates each triple in a container about a given axis and origin
by a given number of radians.
translate
Translates a each triple in a container by a given vector
matrix
This template class represents a numerical matrix of any dimension.
Matrices of dimension 1 are more efficiently modelled using the numeric_vector.
Files: btl_matrix.h
Friends: Friend equivalents to some functions are available
and are documented with these functions. Also available is: friend ostream&
operator<<(ostream &os, const matrix
Dependencies: btl_numeric_vector.h,
btl_vector_algorithms.h,
NumericLimits.h
matrix_product
Matrix multiplication. The output matrix is nrows1*ncols2 in size.
Restrictions: ncols1 must equal
nrows2.
matrixtranspose_matrix_product
Matrix multiplication: Transpose(M1)*M2. The output matrix is ncols1*ncols2
in size.
Restrictions: Both matrices must
have the same number of rows
matrix_matrixtranspose_product
Matrix multiplication: M1*Transpose(M2) The output matrix is nrows1*nrows2
in size.
Restrictions: Both matrices must
have the same number of columns
transpose
Matrix transpose. Can be used in-place.
column_means
Calculate the mean of each column of a matrix and store the answers
in a container of size >= ncols.
copy_column
Copy a column of this matrix into another container. Columns are
numbered from 1. in the FORTRAN manner.
determinant
Calculates matrix determinant
Restrictions: Square matrices only.
minor
Find the minor of a matrix. The minor denoted by minor(.,.,,.,i,j)
is found by eliminating the row i and column j from the parent matrix.
adjoint
Matrix adjoint
Restrictions: Square matrices only.
inverse_square
Calculate inverse of a small square matrix (inverse = adjoint/determinant).
The result matrix should be of a floating point type.
eigen_solution
Eigenvalues and eigenvectors of a symmetric matrix
Restrictions: The input matrix
must be real, square and symmetric, the output vector of eigen values will
be nrows in size and the output matrix of eigenvectors will be nrows*nrows
in size.
inverse_cholesy
Inverts a symmetric positive definite matrix. Employs Cholesky decomposition
in three steps:
lsqfit_rmsd
Calculate the root mean squared deviation after a least squares
fit of the two sets of coordinates using the method of Kearsley(Acta Cryst.
'89, A45, 208-10). Both sets of coordinates remain unchanged by this function
Restrictions: Each set must have
the same number of coordinates. Each coordinate must be orthogonal and
in three dimensions (i.e. normal x,y,z coordinates). WARNING: if coordinates
with varying dimensions are input then this may well not be detected.
centroid
Calculate the centroid of a set of x,y,z coordinates held in an
n x 3 matrix.
rotation_from_fit
Create fitting rotation matrix from the eigen vector that corresponds
to the smallest eigen vector of Kearsley's matrix.
rmsd
Calculate the root mean squared deviation of two sets of coordinates.
Restrictions: Each set must have
the same number of coordinates. There is no restriction on the number of
dimensions which the coordinates represent (except that it must be the
same in every case). WARNING: if coordinates with varying dimensions are
input then this may well not be detected.
check_3d_data
Check that both input containers have the same number of elements
and that number is multiple of 3. Output the number of x,y,z positions.
BTL_VertexWithEdges
This class represents an vertex that has links to edge objects.
It is to be used in combination with class BTL_GraphWithEdges.
Authors: W.R.Pitt
Files: btl_graph_with_edges.h
Friends: friend class BTL_GraphWithEdges<T1,T2>>;
Dependencies: None, except by inheritance.
BTL_Edge
This class represents an edge of a graph. It is to be used in combination
with class BTL_GraphWithEdges.
Authors: W.R.Pitt
Files: btl_graph_with_edges.h
Friends: friend class BTL_GraphWithEdges<T1,T2>>;
Dependencies: BTL_VertexWithEdges
BTL_GraphWithEdges
Graph container with any type of data at the vertices of the graph
and any type of data at the edges. The default behaviour is have undirected
edges. This can be changed to directed if specified in the constructor.
No self links (edges from one vertex to itself) are allowed.
Authors: W.R.Pitt
Files: btl_graph_with_edges.h
Friends: friend ostream& operator<<<(ostream &os,
const BTL_GraphWithEdges &m);
Dependencies: BTL_Vertex, BTL_II
Operations
BTL_Vertex
This class encapsulates a graph vertex and is designed for use with
the graph class. Each vertex contains a reference to a data object and
pointers to other vertices. It is a template class the single template
parameter is a type of dereferencer.
Authors: W.R.Pitt
Files: btl_graph.h
Dependencies: BTL_II, and BTL_IteratorDerefencer,
or BTL_InDencer
Operations
BTL_Graph
Graph container with any type of data at vertices of the graph and
no data associated with edges. The default behaviour is have undirected
edges. This can be changed to directed if specified in the constructor.
No self links (edges from one vertex to itself) are allowed.
Authors: W.R.Pitt
Files: btl_graph.h
Friends: operator<<
Dependencies: BTL_VertexBase and its subclasses.
BTL_DFSIterator
This is a an iterator for iterating over a connected sub-graph in
depth first order. It is designed to work with the BTL_Graph and BTL_GraphWithEdges
but takes that type of graph as its template parameter and could be used
on any graph and vertex type if they have a given set of functions.
Authors: W.R.Pitt
Files: DFSIterator.h
Dependencies: None
BTL_ConstDFSIterator
The const version of the BTL_DFSIterator.
Authors: W.R.Pitt
Files: DFSIterator.h
Dependencies: None
ATOM_processor
Default constructor (does nothing)
Default destructor (does nothing)
Returns true if no coordinates have been read
Read a PDB format file with the given name, selecting only those chains
whose id letter occurs in a given string and using the alternate set of
coordinates identified by the user-supplied character. The default reads
records with any chain id and either no alternate id or the first encounterd
alternate id.
Return a reference to the atom number in a STL vector of int.
Return a reference to the atom n in a STL vector of char. Each name
is stored as 4 chars.
Return a reference to the atom names in a STL vector of char. Each
name is stored as 3 chars.
Return a reference to the residue number in a STL vector of int.
Return a reference to the chain names in a STL vector of char. Each
name is stored as a single char.
Return a reference to the read coordinates in a STL vector of float.
Coordinates are stored in the following order: x,y,z,x,y,z,x,...
Return a reference to the occupancy in a STL vector of float.
Return a reference to the b_factor in a STL vector of float.
PDBSort
Returns true is 1st string comes before the 2nd in pdb order. Returns
false otherwise
The c style string version of the above function
AminoAcidProperty
Default constructor. The default property type is KyteHydropathy.
Construct function object which will return property values of a given
type.
Operator that will return a property value given a single letter amino
acid code.
PIR_processor
Default constructor (does nothing)
Return true if no sequences have been read in, false otherwise.
Read a file with a given name. If this function is called more than
once, the new sequences are added to those already there.
Return any sequences that been read in.
Return a single sequence, given a valid index number
PPM_processor
Read in a file with a given name.
Get image data.
Write image data.
Read width of image.
Read image height.
XYZ_processor
Default constructor (does nothing)
Returns true if no coordinates have been read
Read an xyz format file with the given name
Return a reference to the read coordinates in a STL vector of float.
Coordinates are stored in the following order: x,y,z,x,y,z,x,...
Return a reference to the read atomic elements in a STL vector of char.
Each element is stored as 2 chars.
needleman_wunsch_similarity
needleman_wusch_align
fourier_transform
mean
mean_absolute_deviation
variance
normal_statistics
max_mismatch
max_absolute_mismatch
min_mismatch
min_absolute_mismatch
every_less_equal
every_less
less_absolute
random_uniform
random_normal
random_exponential
numeric_vector
Constructs a 3D vector and initialises each value to zero.
Constructs a 3D vector with initialization and initialises the values
with the numbers given.
Constructor for a vector of n elements. All n values initiated to a
value v. The default value is zero .
Construct from an array given a value_type*. This constructor is obsolete
and will be deleted in future releases.
Copy constructor.
Destructor.
Returns iterator that can be used to begin traversing through all elements
of the numeric_vector. (There is also a const version of this function.)
Returns an iterator can be used in comparison for ending traversal
through the numeric_vector. (There is also a const version of this function.)
Returns the element, i positions from the beginning of the numeric_vector,
in constant time. (C-style i >= 0). (There is also a const version of this
function.)
Returns the i-th element in the numeric_vector (Fortran style i >=
1). (There is also a const version of this function).
Returns the number of elements in the numeric_vector.
This function is added to give compatibility with TNT.
Vector assignment.
Vector addition.
Vector addition and assignment.
Vector subtraction.
Vector negation (unary minus operator).
Vector subtraction and assignment.
Add a scalar to each element in the numeric_vector.
Add and assign a scalar to each element in the numeric_vector.
Subtract a scalar from each element in the numeric_vector.
Subtract and assign a scalar from each element in the numeric_vector.
Vector scalar/dot product.
Vector cross product.
Vector multiplication by a scalar.
Vector multiplication by a scalar and assignment.
Vector division by a scalar.
Vector division by a scalar and assignment.
Equality operator
scalar_product
direct_product
triple_vector_product
triple_scalar_product
separation_squared
separation
sum
sum_precise
sum_of_squares
sum_of_squares_precise
magnitude
magnitude_precise
rotate
translate
matrix
Constructor for default 3x3 matrix and initialise elements to zero.
Constructs an identity matrix of size p*p.
Constructs a matrix with p rows and q columns. Initialises each element
to a value v. The default value is zero
Constructs a matrix with p rows and q columns. Elements are initialised
to those in given array. This is obsolete and will be deleted in future
releases
Constructor for a 3x3 Matrix with initialisation
Copy constructor
Destructor
Returns an iterator that points to the first element in the Matrix.
(There is also a const version of this function.)
Returns an iterator that can be used in a comparison for ending a traversal
through this Matrix. (There is also a const version of this function.)
Size of Matrix (the number of rows times the number of columns)
This function is added to give compatibility with TNT.
Read number of rows (for compatability with TNT).
Read number of columns (for compatability with TNT).
Read number of rows.
Set number of columns.
Set number of rows.
Read number of columns.
This function is added to give compatibility with TNT.
Returns a matrix element given its indices e.g. x(i,j) i = row, j =
col N.B. (i,j >= 1). (There is also a const (read only) version of this
function.)
Returns an iterator that points to the first element of a given row.
N.B. ( 0 <= i < nrows ). (There is also a const (read only) version
of this function.)
Matrix assignment
Matrix multiplication e.g. matrix m1,m2,m3; .... m3 = m1 * m2;
Postmultiplication of a Matrix by a numeric_vector. e.g. matrix m;
numeric_vector v1,v2; ... v2 = m * v1;
Restrictions: The size of v must
equal the number of columns in this Matrix.
Multiple each element by a number.
Multiple each element by a number
Divide each element by a number
Divide each element by a number
Subtraction of a number from each element.
Subtraction of a number from each element.
Addition of a number to each element.
Addition of a number to each element.
Subtraction of a vector from the rows of a matrix
Restrictions: The the size of numeric_vector
v must equal the number of columns in this matrix.
Subtraction of a vector from the rows of a matrix
Restrictions: The the size of numeric_vector
v must equal the number of columns in this matrix.
Addition of a vector to the rows of a matrix
Restrictions: The the size of numeric_vector
v must equal the number of columns in this matrix.
Addition of a vector to the rows of a matrix
Restrictions: The the size of numeric_vector
v must equal the number of columns in this matrix.
matrix subtraction
Restrictions: The the size of matrix
m must equal the size of this matrix.
Matrix subtraction
Restrictions: The the size of Matrix
m must equal the size of this Matrix.
Matrix addition
Restrictions: The the size of Matrix
m must equal the size of this Matrix.
Matrix addition
Restrictions: The the size of Matrix
m must equal the size of this Matrix.
Matrix multiplication Transpose(m1) * m2 N.B. this is less efficient
than (but not equivalent to) operator%
Restrictions: Both *this and the
input Matrix must have the same number of rows
Matrix multiplication m1 * Transpose(m2) N.B. this is more efficient
than (but not equivalent to) operator&
Restrictions: Both *this and the
input Matrix must have the same number of columns
Equality operator
matrix_product
matrixtranspose_matrix_product
matrix_matrixtranspose_product
transpose
column_means
copy_column
determinant
minor
adjoint
inverse_square
eigen_solution
inverse_cholesy
lsqfit_rmsd
centroid
rotation_from_fit
rmsd
check_3d_data
BTL_VertexWithEdges
Constructor empty vertex.
Delete vertex and its contents.
Return iterator that references first edge connected to Vertex. (There
is also a const version of this function.)
Return iterator that references the position in memory after the last
edge connected to Vertex. (There is also a const version of this function.)
BTL_Edge
Construct empty edge
Copy constructor
Destructor
Returns an iterator that can be deferenced to obtain the data object
associated with this edge (There is a const version of this function as
well)
Returns pointer to the first vertex connected to this edge.
Returns pointer to the second vertex connected to this edge.
BTL_GraphWithEdges
Construct empty undirected graph.
Construct new undirected or directed graph i.e. BTL_GraphWithEdges
g1(directed); or BTL_Graph g2(undirected);
Delete graph and all vertices and edges in it.
Add new vertex to graph.
Delete vertex from graph. Return false if vertex not found in this
graph.
Insert edge into this graph. Return endEdge() if input is invalid.
Remove edge from this graph. Return false if input is invalid.
Return iterator that references first edge data item. (There is a const
version of this function as well)
Return iterator that references the position in memory after the last
edge data item. (There is a const version of this function as well)
Return EdgeIterator that references first edge in graph. (There is
a const version of this function as well)
Return EdgeIterator that references the position in memory after the
last edge in graph.(There is a const version of this function as well)
BTL_Vertex
Construct new empty Vertex
Copy constructor.
Destructor
Get an iterator that references the data item associated with this
vertex. With graphs that use STL an vector or deque to store data items
this iterator may become invalid after insertions or deletions of vertices.
(There is also a const version of this function.)
Read/write access to visited flag. This can be used in Graph searching
routines.
Return iterator that references first vertex connected to this vertex.(There
is a const version of this function as well)
Return iterator that references the position in memory after the last
vertex connected to this vertex.(There is a const version of this function
as well)
Return iterator that references first vertex connected to this vertex.
(There is a const version of this function as well)
Return iterator that references the position in memory after the last
vertex connected to this vertex.(There is a const version of this function
as well)
BTL_Graph
Construct new undirected graph
Construct new undirected or directed graph i.e. BTL_Graph g1(directed);
or BTL_Graph g2(undirected);
Delete Graph and all the vertices in it
Get the edge directionality of this graph.
Add new vertex to graph.
Remove a vertex (and all pointers to it) from the graph. Return false
if vertex was not found in the graph.
Add a pointer between two vertices. Return false if either vertex is
not in this graph or is link already present
Remove pointer/link between two vertices. Return false if link not
there
Set the visited field of all vertices in this graph.
Find a vertex within this Graph.(There is a const version of this function
as well)
Return iterator that references first data item.(There is a const version
of this function as well)
Return iterator that references the position in memory after the last
data item. (There is a const version of this function as well)
Return iterator that references the first Vertex. (There is a const
version of this function as well)
Return iterator that references the position in memory after the last
Vertex. (There is a const version of this function as well)
Give the number of vertices within the Graph
BTL_DFSIterator
Default constructor.
Construct with iterator. This is essential if operator++ etc. is to
be used.
Move iterator forward one in depth first search order.
Returns false when current position is one past the end of the last
element in the container.
Move iterator forward one in depth first search order.
Equality operator
Dereference operator
BTL_ConstDFSIterator
Default constructor.
Construct with iterator. This is essential if operator++ etc. is to
be used.
Move iterator forward one in depth first search order.
Returns false when current position is one past the end of the last
element in the container.
Move iterator forward one in depth first search order.
Equality operator
Dereference operator
Questions
or comments are welcome, please send them to Mark
A. Williams.