BTL logoThe Bioinformatics Template Library (BTL) Birkbeck Shield 






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.

Components

Files


ATOM_processor


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
 
 

back

PDBSort


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
 
 

back

AminoAcidProperty


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
 
 

back

PIR_processor


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 or as individual strings.
Authors: W.R.Pitt
Files: PIR_processor.h
Dependencies: none

Operations
 
 

back

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

Operations
 
 

back

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

Operations
 
 

back

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)

Operations
 
 

back

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.

Operations
 
 

back

fourier_transform


Two dimensional FFT. 1D and 3D versions also available

Operations
 
 

back

mean


Calculate the mean value of the elements in a container.

Operations
 
 

back

mean_absolute_deviation


Calculate mean absolute deviation from the mean of the elements in a container.

Operations
 
 

back

variance


Calculate the sample variance of the elements in a container.

Operations
 
 

back

normal_statistics


Calculate the mean, mean absolute deviation from mean, sample variance, skew and kurtosis of the distribution of the elements in a container.

Operations
 
 

back

max_mismatch


Returns the maximum difference between equivalent elements in two containers in the sense of (a-b)

Operations
 
 

back

max_absolute_mismatch


Returns the largest absolute difference between equivalent elements in two containers

Operations
 
 

back

min_mismatch


Returns the minimum difference between equivalent elements in two containers in the sense of (a-b)

Operations
 
 

back

min_absolute_mismatch


Returns the smallest absolute difference between equivalent elements in two containers

Operations
 
 

back

every_less_equal


Returns true if every element of a is less than or equal to the equivalent element of b

Operations
 
 

back

every_less


Returns true if every element of a is less than the equivalent element of b

Operations
 
 

back

less_absolute


Compare the absolute values of two arguements true if |x| < |y|

Operations
 
 

back

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 numbers(seed); T temp = numbers(); The seed integer should be < 1073741822 for float, double and long numbers and < 32765 in the case of of int data. N.B. it is best not to generate a sequence of more than 2**70 numbers using the same seed. This generator fails the birthday spacings test i.e some differences between pairs of numbers occur more often than desired. See Knuth's Art of Computer Programming 3rd Edition for solutions

Operations
 
 

back

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).

Operations
 
 

back

random_exponential


Portable random number generator that produces float or double precision random numbers from an exponential distibution.

Operations
 
 

back

numeric_vector


this template class represents a numerical vector of any size.

 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.
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 &m);
Dependencies: NumericLimits.h

Operations
 
 

back

scalar_product


Scalar/dot product of two vectors.

Operations
 
 

back

direct_product


Direct product of two matrices or vectors .

Operations
 
 

back

triple_vector_product


Vector product of three triples.

Operations
 
 

back

triple_scalar_product


Scalar product of three triples.

Operations
 
 

back

separation_squared


Calculate the squared distance between the points represented by two vectors.

Operations
 
 

back

separation


Calculate the distance between the points represented by two vectors.

Operations
 
 

back

sum


Returns the sum of the vector elements.

Operations
 
 

back

sum_precise


Returns the sum of the vector elements, but accumulates the elements in order of ascending value in order to minimise rounding errors.

Operations
 
 

back

sum_of_squares


Returns the sum of the squares of the vector elements.

Operations
 
 

back

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.

Operations
 
 

back

magnitude


Returns the length of a vector.

Operations
 
 

back

magnitude_precise


Returns the precise length of a vector.

Operations
 
 

back

rotate


Rotates each triple in a container about a given axis and origin by a given number of radians.

Operations
 
 

back

translate


Translates a each triple in a container by a given vector

Operations
 
 

back

matrix


This template class represents a numerical matrix of any dimension. Matrices of dimension 1 are more efficiently modelled using the numeric_vector.

 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.
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 &m);
Dependencies: btl_numeric_vector.h, btl_vector_algorithms.h, NumericLimits.h

Operations
 
 

back

matrix_product


Matrix multiplication. The output matrix is nrows1*ncols2 in size.
Restrictions: ncols1 must equal nrows2.

Operations
 
 

back

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

Operations
 
 

back

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

Operations
 
 

back

transpose


Matrix transpose. Can be used in-place.

Operations
 
 

back

column_means


Calculate the mean of each column of a matrix and store the answers in a container of size >= ncols.

Operations
 
 

back

copy_column


Copy a column of this matrix into another container. Columns are numbered from 1. in the FORTRAN manner.

Operations
 
 

back

determinant


Calculates matrix determinant
Restrictions: Square matrices only.

Operations
 
 

back

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.

Operations
 
 

back

adjoint


Matrix adjoint
Restrictions: Square matrices only.

Operations
 
 

back

inverse_square


Calculate inverse of a small square matrix (inverse = adjoint/determinant). The result matrix should be of a floating point type.

Operations
 
 

back

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.

Operations
 
 

back

inverse_cholesy


Inverts a symmetric positive definite matrix. Employs Cholesky decomposition in three steps:

 (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
 
 

back

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.

Operations
 
 

back

centroid


Calculate the centroid of a set of x,y,z coordinates held in an n x 3 matrix.

Operations
 
 

back

rotation_from_fit


Create fitting rotation matrix from the eigen vector that corresponds to the smallest eigen vector of Kearsley's matrix.

Operations
 
 

back

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.

Operations
 
 

back

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.

Operations
 
 

back

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&ltT1,T2>>;

friend ostream& operator<<(ostream &os, const BTL_VertexWithEdges &m);
Dependencies: None, except by inheritance.

Generalizations

N.B. The graph classes command syntax will be revised in the 3.0beta version

Operations
 
  back

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&ltT1,T2>>;

friend ostream& operator<<(ostream &os, const BTL_Edge &m);
Dependencies: BTL_VertexWithEdges

Generalizations

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Operations
 
  back

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

Generalizations

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Specializations
 
  Operations
 
  back

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

Generalizations

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Specializations
 
  Operations
 
  back

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.

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Specializations
 
 

Operations
 
  back

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

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Operations
 
 

back

BTL_ConstDFSIterator


The const version of the BTL_DFSIterator.
Authors: W.R.Pitt
Files: DFSIterator.h
Dependencies: None

N.B. The graph classes command syntax will be revised in the 3.0beta version
 

Operations
 
 

back

back up ATOM_processor


back up PDBSort


back up AminoAcidProperty


back up PIR_processor


back up PPM_processor


back up XYZ_processor


back up needleman_wunsch_similarity


back up needleman_wusch_align


back up fourier_transform


back up mean


back up mean_absolute_deviation


back up variance


back up normal_statistics


back up max_mismatch


back up max_absolute_mismatch


back up min_mismatch


back up min_absolute_mismatch


back up every_less_equal


back up every_less


back up less_absolute


back up random_uniform


back up random_normal


back up random_exponential


back up numeric_vector


back up scalar_product


back up direct_product


back up triple_vector_product


back up triple_scalar_product


back up separation_squared


back up separation


back up sum


back up sum_precise


back up sum_of_squares


back up sum_of_squares_precise


back up magnitude


back up magnitude_precise


back up rotate


back up translate


back up matrix


back up matrix_product


back up matrixtranspose_matrix_product


back up matrix_matrixtranspose_product


back up transpose


back up column_means


back up copy_column


back up determinant


back up minor


back up adjoint


back up inverse_square


back up eigen_solution


back up inverse_cholesy


back up lsqfit_rmsd


back up centroid


back up rotation_from_fit


back up rmsd


back up check_3d_data


back up BTL_VertexWithEdges


back up BTL_Edge


back up BTL_GraphWithEdges


back up BTL_Vertex


back up BTL_Graph


back up BTL_DFSIterator


back up BTL_ConstDFSIterator


Go Back to the Software Engineering Home PageQuestions or comments are welcome, please send them to Mark A. Williams.

 This page was created automatically using Together/C++ Information Export in conjunction with the Borland C++ development suite.