Most of these classes have been
extensively used for a number of
years. Several TIGR gene-finders were constructed using this class
library, including TigrScan and Unveil. This software is available as open source under the ARTISTIC LICENSE. The regular expression classes are offered as wrappers for the GNU regex library, which has its own license. See the source code for details. Changes and additions are welcome. Please contact bmajoros@tigr.org. |
|
|
Represents an arbitrary alphabet of discrete symbols,
whether DNA, amino acids, or other. Consists of Symbol objects
(which are interchangeable with native ints). |
|
Alphabet(const char * = NULL); | constructor |
int add(char); | Add a character to the
alphabet. |
bool load(istream &); | Load alphabet from file. |
int getNumElements() const; | Size of alphabet. |
inline char lookup(int) const; | Get the ith symbol in the
alphabet. |
inline int lookup(char) const; | Get the index of a given
symbol. |
void printOn(ostream &); | Display alphabet on stream. |
char complement(char); | Crick-Watson DNA complement of
symbol |
Symbol complement(Symbol); | Crick-Watson DNA complement of symbol |
bool save(ostream &); | Write alphabet into file. |
bool isDefined(char) const; | Check whether symbol is
present in
alphabet. |
|
|
An alphabet of amino acid symbols. |
|
AminoAlphabet(); | constructor |
static AminoAlphabet global; | Global instance of this class. |
|
|
Represents a binomial distribution. |
|
static inline double density(int exactNumSuccesses, int
numTrials, double probSuccess); |
Returns P(s|n,p)=probability of observing exactly s successes in n bernoulli trials, given probability of sucess p. |
static double rightTailedPValue(int thisManyOrMoreSuccesses,int numTrials, double probabilityOfSuccess); | Returns P(s|n,p)=probability
of
observing s or more successes in n bernoulli trials, given
probability of sucess p. |
|
|
|
|
An array that has a fixed size. Elements are
kept sorted. If you add too many things to the array, elements
are lost out the left or right side. |
|
BoundedSortedArray(int size,KeepType); | constructor. KeepType= {KEEP_LOW_VALUES,
KEEP_HIGH_VALUES}. ScalarType should be int,float,double,
etc. for maintaining the ordering of the array. |
bool add(const ObjectType &,ScalarType); | Insert an element into the
array,
with a value for maintaining sorted order. |
ObjectType &operator[](int); | Access element of array. |
const ObjectType &operator[](int) const; | Access element of const array. |
ScalarType getValue(int i) const; | Access the scalar value of array element. |
|
|
Alphabet containing symbols {A,T,C,G,N}. |
|
DnaAlphabet(); | constructor |
static DnaAlphabet global; | Global instance of this object. |
|
|
Alphabet containing symbols {a,t,c,g,n} |
|
LowercaseDnaAlphabet(); | constructor |
static LowercaseDnaAlphabet global; | Global instance of this object. |
|
|
Allows access to UNIX environment variables. |
|
static TigrString lookup(const TigrString &); | Look up given environment
variable. |
|
|
|
|
Iterator for FixedSizePriorityList. Defined in
FixedSizePriorityList.H. |
|
FSPLIterator(typename TigrList<T>::iterator); | constructor |
FSPLIterator(); | constructor |
virtual void operator++(); | Advance to next element |
virtual void operator++(int); | Advance to next element |
virtual T &operator*(); | Access this element |
virtual bool operator==(const TigrIterator<T> &) const; | Compare iterators |
virtual bool operator!=(const TigrIterator<T> &i) const | Compare iterators |
virtual TigrIterator<T> &clone(); | Clone iterator |
operator typename TigrList<T>::iterator(); | Cast this iterator to a
TigrList::iterator |
|
|
|
|
A linked list having a maximum size. If you
insert too many elements, the smallest elements are deleted to maintain
the size restriction. |
|
FixedSizePriorityList(int capacity, TigrComparator<T>& = *new DirectComparator<T>()); | constructor |
int getCapacity() const; | Returns maximum size of list |
int size() const; | Returns current size of list |
bool empty() const; | Returns true if list is empty |
bool insert(T); | Adds element to list |
bool push_back(T t); | Adds element to list (same as
insert) |
T &getMin(); | Returns smallest element |
T &getMax(); | Returns largest element |
FSPLIterator<T> begin(); | Starting iterator |
FSPLIterator<T> end(); | Ending iterator |
void erase(FSPLIterator<T>); | Remove an element from the list |
void clear(); | Remove all elements ffrom the
list |
|
|
|
|
A priority queue implemented as a fast binary tree
(i.e., nodes have pointers to children and parent) and with a fixed
capacity, so that when the queue is full, each insertion causes the
smallest element to fall out of the queue. |
|
FixedSizePriorityQueue(int capacity, TigrComparator<T>& = *new DirectComparator<T>()); | constructor |
int getCapacity() const; | Returns maximum# elements
that
will fit |
int getNumElements() const; | Returns number of elements in
the
queue |
bool isEmpty() const; | True iff queue is empty |
bool insert(T); | Add element to queue |
T &peekMin() const; | Returns minimum element, no
removal |
T &peekMax() const; | Returns max element; no removal |
TigrFastBinTree<T>:: iterator begin(); | Starting iterator |
TigrFastBinTree<T>:: iterator end(); | Ending iterator |
|
|
LINUX-specific class for monitoring memory usage of
the current program during execution. |
|
static void report(const TigrString &label,ostream & =cout); | Prints a message to the ostream reporting current
memory
usage |
|
|
A sequence of discrete Symbols. |
|
static Sequence *load(const TigrString &filename,Alphabet &, TigrString &substrateId); | Loads the sequence with the
given
substrateId (after the '>' on the defline) from the given file |
static Sequence *load(const TigrString &filename,Alphabet &); | Loads the first sequence from
the
given file |
Sequence(const TigrString &,Alphabet &); | constructor - builds a
Sequence
from the given string under the given alphabet |
Sequence(); | constructor - builds an empty
Sequence |
Sequence(const char *,Alphabet &); | constructor - builds a
Sequence
from the given string under the given alphabet |
virtual ~Sequence(); | destructor |
void copyFrom(const TigrString &,Alphabet &); | Make this sequence identical
to
that sequence |
void setPhase(int); | Associate a phase value with
this
sequence |
int getPhase() const; | Get the phase value that was
previous set via setPhase() |
void append(Symbol); | Append a single symbol to the
sequence |
void append(const Sequence &); | Append another sequence to the
end
of this sequence |
void prepend(Symbol); | Prepend a single symbol to the
beginning of this sequence |
Symbol operator [](int) const; | Access the const symbol at the
given index |
Symbol &operator [](int); | Access the symbol at the given
index |
const Sequence &operator=(const Sequence &); | copy assignment operator |
int getLength() const; | Returns length of sequence |
void printOn(ostream &) const; | Prints sequence on an ostream
as a
sequence of integers (using the int encoding internal to the alphabet) |
void printOn(ostream &,Alphabet &) const; | Prints sequence on ostream as
sequence of characters, as defined by alphabet |
TigrString *toString(Alphabet &,int startingAt=0) const; | Convert sequence object to
string,
with optional offset index |
void clear(); | Become the empty sequence |
virtual void getSubsequence(int begin,int len,Sequence &s) const; | Copies subsequence of this sequence into s |
bool subsequenceOccursAt(const Sequence &s,int pos) const; | True iff s occurs as a
substring of
this sequence at position pos |
Sequence *reverseComplement(Alphabet &) const; | Returns the Watson-Crick
reverse
complementary sequence of this one |
void reverseComplement(Alphabet &,Sequence &) const; | Computes reverse complement
into
the provided sequence |
bool isEmpty() const; | True iff this sequence is empty |
|
|
A single symbol in an Alphabet. Represented as
an int value. Requires use of Alphabet to translate into char
lexeme. Can be stored in Sequences. |
|
Symbol(int =0); | constructor |
bool operator==(const Symbol &); | Same as that symbol? |
operator int() const; | Get underlying int
representation. |
int getIndex() const; | Get underlying int
representation. |
Symbol &operator++(); | Get symbol with next higher in
value |
|
|
|
|
Single-dimensional fixed-size array of objects of type
T. Define DEBUG to turn on bounds-checking. |
|
TigrArray1D(int size); | constructor - build array of
given
size |
TigrArray1D(const TigrArray1D &); | copy constructor |
virtual ~TigrArray1D(); | destructor - deallocates array
(but
not objects pointed to if T is a pointer!) |
T &operator[](int); | Access element at given index. |
const T &operator[](int) const; | Access element at given index. |
int size() const; | Returns capacity of array (#
elements) |
void printOn(ostream &os); | Print on ostream (used by
operator
<<) |
void resize(int newSize); | Delete array and reallocate to
given size |
void setAllTo(T); | Store given value at all
locations |
void saveBytes(TigrFile &); | Write raw byte representation
into
file |
void loadBytes(TigrFile &); | Read raw byte representation from file |
TigrArray1D<T> &operator=(const TigrArray1D<T> &); | Copy assignment operator |
|
|
|
|
A class that can sort the elements of a
TigrArray1D<T>, given a TigrComparator for T. |
|
TigrArray1DSorter(TigrArray1D<T> &,TigrComparator<T> &); | constructor - the comparator
must
define the desired ordering |
TigrArray1D<T> *sortAscending(); | Sort the elements in ascending
order and return the resulting array (original array unmodifed) |
TigrArray1D<T> *sortDescending(); | Sort the elements in
descending
order and return the resulting array (original array unmodified) |
TigrArray1D<int> *sortAscendByIndex(); | Returns array of indices of
progressive elements in sorted order (ascending), without modifying the
original array |
TigrArray1D<int> *sortDescendByIndex(); | Returns array of indices of progressive elements in sorted order (descending), without modifying the original array |
void sortAscendInPlace(); | Sort in place; ascending |
void sortDescendInPlace(); | Sort in place; descending |
|
|
|
|
Two-dimensional array of objects of type T.
Fixed dimensions. Define DEBUG to turn on bounds-checking.
Use standard A[i][j] notation to access elements (by reference).
First dimension is rows, second dimension is columns. |
|
TigrArray2D(int rows,int cols); | constructor |
TigrArray2D(const TigrArray2D &); | copy constructor |
virtual ~TigrArray2D(); | destructor |
RowIn2DArray<T> operator[](int); | Using a single index (i.e.
array[i]) returns a RowIn2DArray object, which can then accept a second
index. Thus, array[i][j] gives you a reference to an object of
type T. |
const RowIn2DArray<T> operator[](int) const; | Const version of [] |
T &index(int,int); | Same as array[i][j] |
int getFirstDim() const; | Returns first dimension size |
int getSecondDim() const; | Returns second dimension size |
void printOn(ostream &) const; | Print on ostream (used by
operator
<<) |
void readFrom(istream &); | Reads an array from an
istream,
filling up rows before columns (first index increases faster than
second) |
void setAllTo(T); | Store given object at all
locations |
void resize(int rows,int cols); | Delete array and resize to
given
dimensions |
void saveBytes(TigrFile &); | Write raw bytes into file |
void loadBytes(TigrFile &); | Read raw bytes from fil |
|
|
|
|
Binary tree in which each node has a pointer to its
children but not to its parent. If you want faster performance,
use TigrFastBinTree, which stores a parent pointer in each node.
T is the stored data type (not the node type -- a node type is defined
within the binary tree that has a T member). |
|
TigrBinaryTree(TigrComparator<T>& = *new DirectComparator<T>()); | constructor - requires a comparator over T's to
defined
the ordering |
virtual ~TigrBinaryTree(); | destructor |
virtual bool insert(T); | Insert an element |
virtual T &maximum() const; | Get the largest element |
virtual T &minimum() const; | Get the smallest element |
virtual unsigned getCardinality(); | Find out how many elements are in the tree |
bool isEmpty() const; | True iff tree is currently empty |
virtual void purge(); | Remove all objects from the tree |
TigrBinTreeIter<T> begin(); | Get begin iterator |
TigrBinTreeIter<T> end(); | Get ending iterator |
void remove(T); | Remove object from tree |
bool getPredecessor(T X,T &Y); | Find predecessor of X and store that in Y; returns
false
iff none found |
bool getSuccessor(T X,T &Y); | Find successor of X and store that in Y; returns
false
iff none found |
TigrComparator<T> &getComparator(); | Returns comparator supplied in constructor |
|
|
|
|
Iterator for binary trees (TigrBinaryTree).
Three iteration types: PREORDER, POSTORDER, INORDER. |
|
TigrBinTreeIter(TigrBinaryTree<T> *,IterationType=INORDER); | constructor; defaults to
INORDER |
T &operator*(); | Returns current element |
operator bool(); |
True iff iteration is not
finished |
TigrBinTreeIter<T> &operator++(); | Advance iterator to next
element |
bool operator==(const TigrBinTreeIter<T> &) const; | True iff this iterator points
to same element as the other iterator |
|
|
A set represented by a bit-vector, with one bit per
element. |
|
TigrBitSet(unsigned long Size=0); | constructor - build set with
given
max size |
virtual ~TigrBitSet(); | virtual destructor |
void operator =(TigrBitSet &); | copy assignment operator |
void operator -=(TigrBitSet &); | Subtract other set from this
one
and store the result here |
void operator +=(TigrBitSet &); | Store union of this set and
that
set here |
void operator *=(TigrBitSet &); | Store intersection of that set
and
this set here |
bool operator ==(TigrBitSet &); | True iff this set has same
elements
as that one |
TigrBitSet *operator -(TigrBitSet &); | Subtract other set from this
one
and return resulting set |
TigrBitSet *operator +(TigrBitSet &); | Compute union of this set and
that
set and return the result |
TigrBitSet *operator *(TigrBitSet &); | Compute intersection of this
set
and that set and return the result |
bool isMember(unsigned long index); | True iff given bit is set
(element
is present) |
unsigned long cardinality(); | Return number of elements in
set |
unsigned long getMaxSize(); | Return max capacity of this set |
void addAll(); | Become the universal set (all
bits
on) |
void addMember(unsigned
long index); |
Insert element into set |
void complement(); | Complement all bits |
void getRawBytes(unsigned char *&,unsigned long &maxSize, unsigned long &numBytes); | Returns underlying representation |
void load(FILE *fp); | Loads set from file that was
previous saved via save(FILE*) |
void purge(); | Become the empty set |
void removeMember(unsigned long index); | Remove element from set |
void replaceRawBytes(unsigned char *,unsigned long maxSize, unsigned long numBytes); | Replace underlying bytes -
useful
if you just want to use this class to manipulate long bit vectors |
void save(FILE *fp); | Store raw bytes in file |
void setSize(unsigned long Size); | Delete set and reallocate to
new
size |
|
|
Computes a chi-squared goodness-of-fit test. |
|
TigrChi2FitTest(TigrVector<int> &observedCounts, TigrVector<int> &expectedCounts, TigrChi2Table &); | constructor - takes observed
counts
and expected counts for paired data, and a chi-squared distribution
object, and performs the goodness-of-fit test |
bool goodFit(); | Ttrue if good fit |
double getChiSquared(); | Returns chi-squared statistic |
double getP(); | Returns P-value associated
with
chi-squared statistic |
|
|
Computes a chi-squared test of independence. |
|
TigrChi2IndepTest(TigrArray2D<int> &contingencyTable,TigrChi2Table &); | constructor - takes a
contingency
table of observed counts and a chi-squared distribution, and performs
the test |
bool areIndependent(); | True iff variables are
probably
independent |
double getChiSquared(); | Returns chi-squared statistic |
double getP(); | Returns P-value associated
with
chi-squared statistic |
inline bool areDependent(); | True iff variables are
probably not
independent |
|
|
Stores chi-squared distribution table. DEFAULT_PATH="tigr++/chi-squared.txt".
Employs linear interpolation. |
|
TigrChi2Table(TigrString filename=DEFAULT_PATH); | constructor - takes path to
file
containing chi-squared distribution table |
float lookupChi(int df,float alpha); | Get chi-squared value for
given
degrees of freedom df and alpha level |
float lookupP(int df,float chiSquared); | Get alpha level for given
chi-squared value and degrees of freedom |
|
|
Parses command line and provides access to arguments
and options. |
|
TigrCommandLine(int argc,char *argv[],const char *options); | constructor - options are of
the
form "a:bc:" where a and c take parameters and b does not |
TigrString arg(int); | Return ith argument; first
argument
has index 0 |
TigrString optParm(char); | Return the parameter supplied with the given option |
bool option(char); | True iff the user specified
"-c"
for char c |
int numArgs(); | Number of args on command line
(not
including options) |
|
|
|
|
Abstract base class for comparators. Used in
sorting and in sorted data structures. Subclass this class and
override the operators for your data type. |
|
virtual bool equal(T &a,T &b)=0; | a==b? |
virtual bool greater(T &a,T &b)=0; | a>b? |
virtual bool less(T &a,T &b)=0; | a<b? |
|
|
|
|
A comparator for type T that compares T objects using
the native <, >, and == operators. |
|
virtual bool equal(T &a,T &b); | a==b? |
virtual bool greater(T &a,T &b); | a>b? |
virtual bool less(T &a,T &b); | a<b? |
|
|
Complex number having a real part and an imaginary part |
|
TigrComplexNum(double real=0.0,double imag=0.0); | constructor |
TigrComplexNum operator+(const TigrComplexNum &); | complex addition |
TigrComplexNum operator*(const TigrComplexNum &); | complex multiplication |
TigrComplexNum getConjugate(); | returns (r,-i) |
double &getImag(); | access to imaginary part |
double &getReal(); | access to real part |
double getImag() const; | returns imaginary part |
double getModulus() const; | sqrt(r*r + i*i) |
double getReal() const; | returns real part |
|
|
Parses a configuration file consisting of lines of the
form X=Y. # starts a comment line. X and Y may be
surrounded by spaces but may not contain spaces within them. X is
the "attribute" and Y is the "value". This class stores
(attribute,value) pairs and supports queries on attribute values. |
|
TigrConfigFile(TigrString fname); | constructor - loads
configuration
file |
virtual TigrString lookup(TigrString attr); | returns the value associated
with
the given attribute, or the empty string if not defined in the config
file |
virtual TigrString lookupOrDie(TigrString attr); | returns value of given attribute, or throws
exception if
not found in config file |
virtual double getDoubleOrDie(TigrString attr); | looks up attribute and
converts
value to double, or throws exception if undefined |
virtual float getFloatOrDie(TigrString attr); | looks up attribute and
converts
value to float, or throws exception if undefined |
virtual int getIntOrDie(TigrString attr); | looks up attribute and
converts
value to int, or throws exception if undefined |
virtual long getLongOrDie(TigrString attr); | looks up attribute and
converts to
long, or throws exception if undefined |
|
|
A contingency table of counts for use with
TigrChi2IndepTest (chi-squared test of independence) or TigrMutInfo
(mutual information) |
|
TigrContingencyTbl(int width,int height); | constructor |
int getColumnTotal(int column); | Returns sum of a column (call
computeTotals() first!) |
int getGrandTotal(); | Returns grand total (call
computeTotals() first!) |
int getRowTotal(int row); | Returns sum of a row (call
computeTotals() first!) |
void computeTotals(); | Computes all totals |
|
|
A matrix of doubles. Provides many matrix
operations for linear algebra. Used by the regression package. |
|
TigrDblMatrix(int rows,int columns); | constructor |
TigrDblMatrix(const TigrDblMatrix &other); | copy constructor |
virtual double operator()(int row,int col) const; | access const element |
virtual double &operator()(int row,int col); | access element |
TigrDblMatrix &operator=(TigrDblMatrix &); | copy assignment operator |
bool invert(TigrDblMatrix &resultingMatrix) const; | compute inverse of this matrix
and
store it in the given matrix -- returns false if noninvertible |
virtual int getNumColumns() const; | returns number of columns in
matrix |
virtual int getNumRows() const; | returns number of rows in matrx |
void addRowMultiple(int sourceRow,int destinationRow,double factor); | add a multiple of one row to
another row (used by TigrGaussJordan) |
void getColumn(int column,TigrDblArray1D &into) const; | copy a column into an array |
void getRow(int row,TigrDblArray1D &into) const; | copy a row into an array |
void multiplyRowBy(int whichRow,double factor); | multiply a row by some factor
and
store the resulting row back in its place |
void printOn(ostream &); | used by operator << |
void setAllTo(double d); | store the given value at all
locations |
void swapRows(int r1,int r2); | swap to rows in this matrix |
void times(const TigrDblMatrix &,TigrDblMatrix &resultMatrix) const; | matrix multiplication |
void transpose(TigrDblMatrix &resultMatrix) const; | matrix transposition (original
matrix is not modified) |
|
|
|
|
A wrapper for TigrVector that allows you to index into
undefined parts of the vector safely. Any nonnegative index which
was previous undefined will be automatically defined and the vector
extended to include this index. |
|
TigrElasVector(const T &nullInitializer); | constructor - initializer is
for
initializing the intervening elements when an undefined index is
specified |
T &operator[](int); | access element at given index |
int size(); | return current size of vector |
|
|
shorthand for TigrElasVector<double> |
|
TigrElasDblVect(); | constructor |
|
|
shorthand for TigrElasVector<float> |
|
TigrElasFloatVect(); | constructor |
|
|
shorthand for TigrElasVector<int> |
|
TigrElasIntVect(); | constructor |
|
|
shorthand for TigrElasVector<char> |
|
TigrElasCharVect(); | constructor |
|
|
shorthand for TigrElasVector<long> |
|
TigrElasLongVect(); | constructor |
|
|
Provides computation of entropy, cross entropy, and
relative entropy |
|
static double crossEntropy(TigrVector<double> &P,TigrVector<double> &Q); | -sum(P*log(Q)) = uncertainty
about
next symbol from source Q, given that our understanding of Q is
actually based on P |
static double entropy(TigrVector<double> &); | -sum(P*log(P)) = expected
number of
bits per symbol to encode data source P |
static double relativeEntropy(TigrVector<double> &,TigrVector<double> &); | -sum(P*log(P/Q)) = uncertainty
about P after discounting for cross entropy between P and Q |
|
|
An exception with a string message. |
|
RootException(const char *); | constructor |
RootException(const TigrString &); | constructor |
const TigrString &getMessage() const; | get message |
|
|
Exception to indicate a file error has occurred |
|
FileErrorException(TigrString filename,TigrString message) | constructor |
|
|
Exception to indicate an out-of-bounds error |
|
ArrayIndexException(long index,const TigrString &message); | constructor |
|
|
Reads sequences from a multi-FASTA file |
|
TigrFastaReader(const TigrString &filename, Alphabet & =DnaAlphabet::global); | constructor - default alphabet
is
DNA |
TigrVector< pair<TigrString,TigrString> > *readAll(); | Reads all sequences from
multi-FASTA file and returns a vector of pairs: (defline, sequence) |
bool nextSequence(TigrString &defline,TigrString &sequence); | Read the next sequence and
store
the defline and sequence in the given strings, or return false if
end-of-file |
static void parseDefline(const TigrString &defline,TigrString &id, TigrString &remainder); | Parse a defline to extract the
identifier (id) occurring immediately after the '>'.
Everything after that is stored in remainder |
static TigrString getId(const TigrString &defline); | like parseDefline, but ignores
the
remainder |
|
|
Writes sequences into a multi-FASTA file with a
fixed-with format (default 60 chars) |
|
TigrFastaWriter(int width=60); | constructor |
void writeFasta(const TigrString &defline,const TigrString &sequence, const TigrString &filename); | Create a file, write the given
sequence & defline into it, and close the file |
void writeFastaFromCharPtr(const TigrString &defline,const char *sequence, const TigrString &filename); | same as writeFasta() but with
char* |
void addToFasta(const TigrString &defline,const char *sequence, ostream &); | Append a sequence (char*) to
an
already-open multi-FASTA file |
void addToFasta(const TigrString &defline,const TigrString &sequence, ostream &); | Append a sequence (TigrString) to an already-open multi-FASTA file |
|
|
|
|
A subclass of TigrBinaryTree that has faster parent
lookup, because each node has a pointer to its parent (don't have to
search down from the root when searching for parent or
successor/predecessor). Also allows duplicate elements (if
desired). |
|
TigrFastBinTree(TigrComparator<T>& = *new DirectComparator<T>()); | constructor |
virtual bool insert(T); | insert element |
void enableDuplicates(); | enable the insertion of
duplicate
elements |
|
|
A convenient wrapper for native FILE*, fopen, fclose,
fread, fwrite, etc. |
|
TigrFile(const TigrString &filename,const TigrString &mode="r"); | constructor - mode "r" is for
reading, "w" is for writing |
TigrFile(FILE *fp); | constructor |
TigrFile(); | constructor |
virtual ~TigrFile(); | destructor |
operator FILE*(); | get underlying FILE* |
long countLines(); | count lines in a file that is
open
for reading; does not rewind first |
static TigrString getFilenameNoPath(const TigrString &filename); | gets the part of a filename
after
the path specification |
static bool copy(const TigrString &from,const TigrString &to); | UNIX cp command |
static bool exists(const TigrString &filename); | true iff file exists |
TigrString getline(); | read next line |
inline TigrString readLine(); | read next line |
bool eof(); | true iff end-of-file |
bool isOpen() const; | true iff this file is
currently open |
bool open(); | open this file |
bool open(const TigrString &filename,const TigrString &mode="r"); | open a file with a given name;
mode
"r" is for reading, "w" is for writing |
long read(long bytes,void *buffer); | fread the given number of
bytes
into the given buffer |
bool seek(long offset); | fseek to the given absolute
file
offset (i.e., bytes from the beginning of the file) |
bool write(long bytes,const void *buffer); | write a given number of bytes
from
the given buffer into this file |
long getPosition(); | return current file position;
ftell() |
long getSize(); | returns size of file, as of
the
time it was opened or the last time updateStats() was called |
time_t lastAccessTime(); | returns last access time as of last call to
updateStats()
or file open |
time_t lastChangeTime(); | returns last change time as of
last
call to updateStats() or file open |
time_t lastModifyTime(); | returns last modify time as of last call to
updateStats()
or file open |
virtual void close(); | close this file |
void print(const TigrString &); | write a string into a file |
void rewind(); | rewind file to beginning |
void updateStats(); | update stats (size, last
access
time, last change time, last modify time) |
void write(const int &); | write int into binary file |
void write(const short &); | write short into binary file |
void write(const long &); | write long into binary file |
void write(char); | write char into binary file |
void write(const float &); | write float into binary file |
void write(const double &); | write double into binary file |
void write(const TigrString &); | write string into binary file,
preceded by length |
void write(const char *); | write string into binary file,
preceded by length |
int readInt(); | read int from binary file |
short readShort(); | read short from binary file |
long readLong(); | read long from binary file |
char readChar(); | read char from binary file |
float readFloat(); | read float from binary file |
double readDouble(); | read double from binary file |
TigrString readString(); | read string from binary file
(saved
previously with write(TigrString) |
char *readCharString(); | read string from binary file
(saved
previously with write(char*); caller should delete [] the returned char
array |
void readString(TigrString &); | like readString() but with
supplied
buffer |
TigrString *readStringPtr(); | .like readString, but
returning
pointer to string object (which caller should delete) |
|
|
Performs Gauss-Jordan elimination in order to invert a
square matrix |
|
static bool invert(TigrDblMatrix &thisMatrix,TigrDblMatrix &intoHere); | inverts the "thisMatrix" into
the
"intoHere" matrix, or returns false if noninvertible |
|
|
An exon read from a GFF file by TigrGffReader.
ExonType is {ET_EXON,
ET_INITIAL_EXON, ET_INTERNAL_EXON, ET_FINAL_EXON, ET_SINGLE_EXON}.
Note that while GFF coordanates are 1-based, within this software they
are automatically converted for you, so use zero-based coordinates. |
|
TigrGffExon(TigrGffFeature &,TigrGffTranscript &); | constructor - builds an exon
from a
generic TigrGffFeature object and inserts into the given transcript |
TigrGffExon(ExonType,int begin,int end,TigrGffTranscript &parent, bool hasScore,double score,bool hasFrame,int frame); | constructor - builds an exon
object
from the given attributes |
ExonType getExonType() const; | returns exon type |
void changeExonType(ExonType); | changes exon type |
TigrGffTranscript &getParent(); | returns transcript to which
exon
belongs |
char getStrand() const; | returns strand |
const TigrString &getSource() const; | returns name of organism or
program
which predicted this exon |
const TigrString &getSubstrate() const; | identifier of sequence to
which
this exon's coordinates refer |
int getBegin(); | zero-based coordinate of
leftmost
base in exon |
int getEnd(); | zero-based coordinate of the
base
immediately following the rightmost base of the exon |
void toGff(ostream &); | generate the GFF record for
this
exon and write it to the ostream |
|
|
A generic GFF feature. Produced by TigrGffReader. |
|
TigrGffFeature(const TigrString &rawLine,const TigrString &substrate, const TigrString &source,const TigrString &featureType, int begin,int end,double score,bool hasScore,char strand, int frame,bool hasFrame); | constructor |
TigrGffFeature(const TigrString &rawLine); | constructor - parses raw line
into
a TigrGffFeature object |
TigrString toGff() const; | generates GFF record for this
feature |
TigrVector<TigrString> &getExtraFields(); | returns "extra" fields at the
end
of the GFF record (usually separated by semi-colons) |
bool hasExtraFields() const; | true iff this feature has
"extra"
fields at the end |
bool isFramed() const; | true iff this feature has a
specified frame or phase |
bool isScored() const; | true iff this feature has a
score |
bool isStranded() const; | true iff this feature has a
specified strand |
char getStrand() const; | get strand; '+' or '-' |
const TigrString &getFeatureType() const; | get feature type as specified
in
the GFF file |
const TigrString &getRawField(int index); | get the raw text of any field
from
the original GFF record |
const TigrString &getRawLine() const; | get the original line for this
GFF
record |
const TigrString &getSource() const; | usu. organism or name of
program
which predicted this feature |
const TigrString &getSubstrate() const; | identifier of sequence to
which
this feature's coordinates refer |
double getScore() const; | feature's score |
int getBegin() const; | zero-based coordinate of leftmost base in feature |
int getEnd() const; | zero-based coordinate of the
base
immediately following the rightmost base of the feature |
int getFrame() const; | get phase or frame of the
feature |
|
|
Compares transcripts, to allow sorting by begin
coordinate. |
|
bool less(TigrGffTranscript *&,TigrGffTranscript *&); | a<b? |
bool greater(TigrGffTranscript *&,TigrGffTranscript *&); | a>b? |
bool equal(TigrGffTranscript *&,TigrGffTranscript *&); | a==b? |
|
|
Reads features from a GFF file. |
|
TigrGffReader(const TigrString &filename); | constructor - loads GFF file |
TigrGffFeature *nextFeature(); | loads next GFF record and
parses it
into a generic feature |
TigrVector<TigrGffTranscript*> *loadTranscripts(); | loads all transcripts from GFF
file |
TigrMap<TigrString, TigrVector<TigrGffTranscript*>*> *loadByContig(); | loads all transcripts from a
GFF
file and hashes them into a TigrMap<> by the substrate ID, so
those on the same substrate (i.e., contig) can be processed together |
|
|
A single transcript in a GFF file. These are
produced by TigrGffReader. The exons are sorted by translation
order (5' to 3'). |
|
TigrGffTranscript(const TigrString &transcriptId, const TigrString &substrate, char strand,const TigrString &source); | constructor - used by
TigrGffReader |
virtual ~TigrGffTranscript(); | destructor |
TigrGffExon &getIthExon(int); | returns exon at given index |
TigrGffFeature *getStartCodon(); | returns start codon object, if
one
has been previously set via setStartCodon(), or NULL otherwise |
TigrGffFeature *getStopCodon(); | returns stop codon object, if
one
has been previously set via setStopCodon(), or NULL otherwise |
char getStrand(); | returns strand ('+' or '-') |
const TigrString &getSource() const; | usu. organism name or name of
program which predicted this transcript |
const TigrString &getSubstrate() const; | identifier of sequence to
which
this transcript's exons' coordinates refer |
const TigrString &getTranscriptId() const; | transcript id (from the
transcript_id or transgrp field at the end of the GFF record) |
double getScore() const; | score, as previously set via
setScore() |
int getBegin() const; | zero-based coordinate of the
leftmost base of the leftmost exon in this transcript |
int getEnd() const; | zero-based coordinate of the
base
immediattely following the rightmost base of the rightmost exon in this
transcript |
int getNumExons() const; | number of exons in this
transcript |
void addExon(TigrGffExon *); | insert exon into this
transcript |
void printOn(ostream &) const; | used by operator << |
void setScore(double); | set transcript score |
void setStartCodon(TigrGffFeature *); | associate a start codon object
with
this transcript |
void setStopCodon(TigrGffFeature *); | associate a stop codon object
with
this transcript |
void setStrand(char); | set transcript strand (should
be +
or -) |
void sortExons(); | sort the exons by increasing
begin
coordinate |
void setExonTypes(); | resolve exon types into
{ET_INITIAL_EXON, ET_INTERNAL_EXON, ET_FINAL_EXON, ET_SINGLE_EXON} |
void toGff(ostream &); | generate GFF record and write
to
ostream |
TigrVector<TigrGffExon*>::iterator getExons(); | returns begin iterator for
exons |
TigrVector<TigrGffExon*>::iterator getExonsEnd(); | returns end iterator for exons |
|
|
Allows reading of truly immense FASTA files on a
computer with limited RAM by reading only one chunk at a time.
The chunks can overlap, which is useful if you want to slide a window
over the sequence and not miss regions around chunk boundaries. |
|
TigrHugeFastaReader(const TigrString &filename,int chunkSize, int overlapSize=0); | constructor |
virtual ~TigrHugeFastaReader(); | destructor |
const char *getBuffer(); | The first chunks read will be
here. If the overlapSize is zero, all subsequent chunks will also
be here. Otherwise, subsequent overlap regions will start here,
and the actual chunk will at getRemainder() |
const char *getRemainder(); | For use only when
chunkSize>0. Then, for all chunks after the first, getBuffer()
will return a pointer to the last overlapSize bases of the previous
chunk followed by the chunkSize-overlapSize bases of the next
chunk. getRemainder() returns a direct pointer to the latter, new
bases. |
bool loadNextChunk(); | loads the next chunk into
memory |
bool isMore(); | true iff loadNextChunk()
actually
read some data |
const TigrString &getDefline(); | returns defline |
|
|
Used by TigrGaussJordan to invert a square
matrix. Initialized to [I | M] for identity matrix I and matrix
M, and then subjected to GJ-elimination until the augmented matrix is
[Minv | I] for Minv the inverse of matrix M. |
|
TigrInversionMatrix(int rows); | constructor - builds a square
matrix of size RxR, with an identically-sized matrix conjoined with
this that is initialized to the identity matrix |
virtual double &operator()(int row,int col); | access element of matrix |
bool detectNonInvertible(); | returns true if there is a
complete
row of zeros -- a sign that the matrix is noninvertible |
virtual int getNumColumns(); | number of columns in
(unaugmented)
matrix |
void getInverted(TigrDblMatrix &); | Returns the inverse of the original matrix installed
via
install() |
void install(TigrDblMatrix &); | Copy a square matrix into |
|
|
|
|
Base iterator class |
|
virtual void operator++()=0; | advance to next element |
virtual void operator++(int)=0; | advance to next element
(post-increment) |
virtual T &operator*()=0; | access current element |
virtual bool operator==(const TigrIterator<T> &) const=0; | true iff these two iterators
point
to the same element |
virtual bool operator!=(const TigrIterator<T> &i) const | true iff these two iterators
do not
point to the same element |
virtual TigrIterator<T> &clone()=0; | clone this iterator |
|
|
A joint distribution. Derived from
TigrArray2D<double>, so use the [][] operator to access
individual joint probabilities. |
|
TigrJointDistr(int X,int Y); | constructor |
double getMarginalX(int x); | prior P[x==X] |
double getMarginalY(int y); | prior P[y==Y] |
void computeMarginals(); | compute marginal distributions |
|
|
A function of the form y=mx+b. Used in the
regression package. |
|
TigrLinearFunc(double slope,double intercept, double coefOfDeterm); | constructor - requires slope,
y-intercept, and coeffient of determination (or ignore the latter if
you won't be calling getCoefDeterm()) |
TigrLinearFunc(); | constructor |
double operator()(double x) const; | get the y for a given x |
TigrLinearFunc &operator=(const TigrLinearFunc &); | copy assignment operator |
double getCoefDeterm() const; | coefficient of determination (r2) |
|
|
Computes univariate linear regression of Y on X. |
|
TigrLinearFunc regress(TigrVector<pair<double,double>> &); | Perform regression on the
given set
of pairs |
TigrLinearFunc regress(TigrVector<double> &); | Regress the given set of Y
values
on the sequence of nonnegative integers 0..N (i.e., their indices in
the vector) |
|
|
|
|
Just a wrapper for the STL list<>. No
functionality added yet. |
|
TigrList(); | constructor |
|
|
|
|
A queue implemented as a linked list. |
|
TigrListQueue(); | constructor |
T &back(); | element at back of queue (most
recent) |
T &front(); | element at front of queue
(oldest) |
typename list<T>::iterator begin(); | begin iterator |
typename list<T>::iterator end(); | end iterator |
typename list<T>::reverse_iterator rbegin(); | begin reverse iterator |
typename list<T>::reverse_iterator rend(); | end reverse iterator |
void enqueue(const T &); | add an element at the back of
the
queue |
T dequeue(); | remove element from front of
queue |
void pop_back(); | remove element from back of
queue |
void pop_front(); | remove element from front of
queue |
int size(); | number of elements currently
in
queue |
void clear(); | make the queue empty |
bool isEmpty(); | true iff the queue is empty |
|
|
|
|
Wrapper for STL map<T> |
|
bool isDefined(const KeyType &key); | true iff key is defined in the
map |
void undefine(const KeyType &key); | remove key from the map |
inline int numElements(); | number of keys defined in the
map |
inline bool isEmpty(); | true iff the map is empty |
|
|
Allows reading of successive newline-delimited lines
from a string of text stored in memory. |
|
TigrMemStream(const char *data); | constructor |
TigrString readLine(); | returns next newline-delimited
line
(newlines are removed) |
bool eof(); | true iff end of the entire
string
has been reached |
|
|
Performs multiple regression (i.e., regression of
one variable on one or more others). |
|
bool regress(const TigrDblMatrix &Y,const TigrDblMatrix &X, TigrDblMatrix &coefficients); | given the matrix X of
observations
(rows) of several variables (columns) and the matrix Y of observed
y-values for those observations, compute a set of coefficients for X. |
|
|
Computes mutual information from a contingency table or joint distribution. Mutual information = sum Pxy * log[ Pxy / (Px*Py) ]. | |
static double compute(const TigrContingencyTbl &); | Compute mutual information
from a
contingency table of counts |
static double compute(const TigrJointDistr &); | Compute mutual information
from a
joint distribution |
|
|
UNIX pipe using a file interface |
|
TigrPipe(const TigrString &command,const TigrString &mode); | constructor -- executes the
given
command and then either pipes the output from that command into this
process through the file (when mode="r") or pipes this process' output
through the file into the command (when mode="w") |
virtual void close(); | close the pipe |
|
|
A priority queue implemented as a TigrFastBinTree
(binary tree). Allows rapid, repeated extraction of the minimum
value. |
|
TigrPriorityTree(); | constructor |
TigrFastBinNode *extractMin(); | remove smallest value from
queue |
TigrFastBinNode *peekMin(); | access smallest value without
returning it |
void insert(TigrFastBinNode *); | insert an element into the tree |
|
|
Computes progress based on time elapsed and amount of
work remaining to do. |
|
TigrProgress(); | constructor |
TigrString getProgress(unsigned long workDone); | Get a progress message to
display
to the user. |
void start(unsigned long totalWork); | Start the timer and register
how
much total work needs to be done |
|
|
Provides protein translation and DNA reverse
complementation functionality. |
|
static TigrString reverseComplement(const TigrString &); | compute Watson-Crick
reverse-complement of a string of DNA |
static TigrString translate(const TigrString &transcript); | translate DNA into protein
sequence |
static Sequence *translate(const Sequence &,Alphabet &dnaAlphabet, Alphabet &proteinAlphabet); | translate a DNA Sequence
object
into a protein Sequence object |
static void translate(const Sequence &source,Alphabet &dnaAlphabet, Alphabet &proteinAlphabet,Sequence &dest); | same as previous, but with
user-supplied buffer for output |
static char mapCodon(const char *codon); | map a single codon to an amino
acid |
|
|
A vector of real values, useful for linear algbra. |
|
TigrRealVector(int dimensions); | constructor |
double operator[](int index) const; | access ith dimension |
double &operator[](int index); | access ith dimension |
double distanceTo(const TigrRealVector &other); | Euclidean distance between
end-points of two vectors |
double dotProduct(const TigrRealVector &with); | vector dot product |
double getAngle(const TigrRealVector &from); | angle between two vectors |
double getMagnitude(); | vectr magnitude (also called
the
norm, and denoted ||V||) |
inline int getDimension(); | number of dimensions |
void scale(double factor); | multiply all dimensions by
given
factor |
void unitize(); | convert vector to a unit
vector
(i.e., having magnitude 1) |
|
|
Regular expressions. Very similar to Perl's
regular expressions. Wrapper for GNU regular expression library. |
|
TigrRegex(const TigrString ®ex); | constructor |
~TigrRegex(); | constructor |
TigrString operator[](int whichSubexpression); | like $1, $2, $3, etc. in perl |
TigrString getEntireMatch(); | returns entire subexpression
matched by regex |
TigrString substitute(const TigrString &substrate, const TigrString &replacement); | like s/// in perl |
TigrVector<TigrString*> *split(const TigrString &substrate); | like split//,$_ in perl |
bool match(const TigrString &); | try to match the regex to the
entire string, from beginning to end |
bool search(const TigrString &); | try to match the regex to any
part
of the string |
int getNumSubexpressions() const; | how many pairs of parentheses
are
there in the regex? |
static TigrString substitute(const TigrString ®ex, const TigrString &replacement, const TigrString &substrate); | static version of above
substitute() -- regex is given as a char string |
static TigrVector<TigrString*> *split(const TigrString ®ex, const TigrString &substrate); | static version of above
split() --
regex is given as a char string |
static bool match(const TigrString ®ex,const TigrString &substrate); | static version of above
match() --
regex is given as a char string |
static bool search(const TigrString ®ex,const TigrString &substrate); | static version of above
searc() --
regex is given as a char string |
void getMatchIndices(int regNum,int &start,int &end); | for a given matched
subexpression
(denoted by parentheses in the regex), get the indices within the
string of that match |
|
|
|
|
Wrapper for STL set<T> |
|
TigrSet(); | constructor |
bool operator+=(const TigrSet<T,C> &); | add all elements of other set
to
this set (UNION) |
bool operator+=(const T &); | as above but without const |
bool isMember(const T &); | true iff the given object is
an
element of this set |
void remove(const T &t); | remove the given element from
this
set |
TigrSet<T,C> *intersectWith(TigrSet<T,C> &); | set intersection; this set is
unmodified |
void intersectWith(TigrSet<T,C> &,TigrSet<T,C> &destination); | set intersection with
user-provided
result location; this set is unmodifed. |
inline bool isEmpty() const; | true iff this set is empty |
|
|
|
|
Replacement for pointers that keeps track of reference
counts to decide when to delete an object. Type T must be a class
having an int referenceCount member, and you *must* defined USE_SMART_POINTERS
before including TigrSmartPointer.H. If you do not defined USE_SMART_POINTERS,
no reference counting will occur. |
|
TigrSmartPointer(T *p=NULL) | constructor |
TigrSmartPointer(const TigrSmartPointer<T> &o) | copy constructor |
~TigrSmartPointer() | destructor |
TigrSmartPointer<T> &operator=(const TigrSmartPointer<T> &) | copy assignment operator |
TigrSmartPointer<T> &operator=(T *t) | assignment operator |
T *operator ->() | arrow operator |
|
|
An *undirected* graph having relatively few
edges. For each vertex (represented only by an integer index) it
maintains a set of adjacent vertices. VertexId is an unsigned int. |
|
TigrSparseGraph(int numVertices=0); | constructor |
TigrSet<VertexId> &getNeighborsOf(VertexId); | Returns vertices adjacent to
the
given one |
VertexId addVertex(); | add a vertex to the graph |
bool areAdjecent(VertexId,VertexId); | true iff the given vertices
are
connected by an edge |
int getDegree(VertexId); | number of neighbors of given
vertex |
int getNumEdges(); | number of edges in graph |
int getNumVertices(); | number of vertices in graph |
void addEdge(VertexId from,VertexId to); | add an undirected edge between
two
vertices |
void removeEdge(VertexId from,VertexId to); | remove edge from graph |
|
|
|
|
Wrapper class for STL stack<T> |
|
TigrStack(); | constructor |
void push(const T &); | push element onto stack |
const T &pop(); | pop top element & return
it
(differs from STL) |
const T &top(); | return top element |
int size() const; | number of elements in stack |
bool isEmpty() const; | true iff stack is empty |
|
|
Displays a message and then initiates a core dump so
that a debugger can be used to get a stack trace. |
|
TigrStacktrace(const char *message); | constructor |
TigrStacktrace(const TigrString &); | constructor |
|
|
Wrapper for STL string class. Makes it more
convenient to build strings using the + operator, as well as other
common tasks. |
|
TigrString(unsigned); | construct string
representation of
number |
TigrString(unsigned long); | construct string
representation of
number |
TigrString(long); | construct string
representation of
number |
TigrString(int); | construct string
representation of
number |
TigrString(float); | construct string
representation of
number |
TigrString(double); | construct string
representation of
number |
TigrString(const char *,unsigned len); | construct string from pointer
and
length |
TigrString(const char *); | construct string from
null-terminated char* |
TigrString(const TigrString &); | copy constructor |
TigrString(const string &); | copy constructor |
TigrString(char); | construct string consisting of
single char |
TigrString(); | constructor -- empty string |
virtual ~TigrString(); | destructor |
TigrString operator+(unsigned); | concatenate number and return
result |
TigrString operator+(unsigned long); | concatenate number and return result |
TigrString operator+(long); | concatenate number and return result |
TigrString operator+(int); | concatenate number and return result |
TigrString operator+(float); | concatenate number and return result |
TigrString operator+(double); | concatenate number and return result |
TigrString operator+(const char *p); | concatenate string and return
result |
TigrString operator+(const string &s); | concatenate string and return
result |
TigrString operator+(const TigrString &s); | concatenate string and return
result |
TigrString operator+(char c); | concatenate char and return
result |
operator float(); | interpret this string as a
number |
operator double(); | interpret this string as a number |
operator int(); | interpret this string as a number |
operator long(); | interpret this string as a number |
operator unsigned(); | interpret this string as a number |
TigrString &tolower(); | convert to lowercase and
return
result |
TigrString &toupper(); | convert to uppercase and
return
result |
TigrString substitute(const TigrString &changeThis, const TigrString &toThis) const; | substitute all instances of
changeThis with toThis |
TigrString substring(int start,int length) const; | extract substring beginning at
'start' and running for 'length' bytes (zero-based coordinates) |
TigrVector<TigrString> *getFields(const char *separators=" \t\n\r") const; | split this string at all
instances
of given separator chars and return vector of resulting substrings |
bool contains(const TigrString &searchString) const; | true iff this string contains
the
given search string |
bool containsWordChar(); | true iff this string contains
[a-zA-Z] |
inline bool isWordChar(char c); | true iff c matches /[a-zA-Z]/ |
bool stricmp(const TigrString &) const; | true iff a case-insensitive
comparison between this string and that string found a difference |
char lastChar() const; | returns the last char in this
string |
double asDouble(); | interpret this string as a
number |
float asFloat(); | interpret this string as a number |
int asInt(); | interpret this string as a number |
long asLong(); | interpret this string as a number |
unsigned asUnsigned(); | interpret this string as a number |
void chop(); | remove the last char from this
string |
void trimWhitespace(); | remove whitespace chars from
beginning and end of this string |
inline bool isEmpty(); | true iff this string is empty |
void getline(istream &is); | get a line of text from the
given
stream |
|
|
|
|
Element of a TigrStringMap. An (attribute,value)
pair. |
|
int len; | length of 'first' string |
char *first; |
string attribute |
T second; |
T value |
|
|
|
|
For iterating through the (attribute,value) pairs of a
TigrStringMap<T>. The pairs are StringMapElem<T>
structs. |
|
inline bool operator!=(const StringMapIterator<T> &); | true iff this iterator does
not
equal that iterator (are not pointing at same elements) |
bool operator==(const StringMapIterator<T> &); | true iff this iterator equals
that
iterator (pointing at same elements) |
StringMapIterator<T> &operator++(int); | advance to next
(attribute,value)
pair |
StringMapIterator<T> &operator++(); | advance to next
(attribute,value)
pair |
StringMapElem<T> &operator*(); | access current |
|
|
|
|
Provides a very fast and memory-efficient map for
large numbers of strings to an arbitrary data type T. For
efficiency reasons, native char* strings are used, not STL
strings. This eliminates all unnecessary initialization
overhead. Strings are specified with three parts: a char* to the
beginning of a buffer, an offset into that buffer where the interesting
substring begins, and the length of the interesting substring. |
|
typedef StringMapElem<T> ElemType; | ElemType type |
typedef StringMapIterator<T> iterator; | iterator type |
typedef StringMapIterator<T> const_iterator; | const_iterator type |
TigrStringMap(int tableSize); | constructor -- tableSize
should be
prime for best performance |
TigrStringMap(const TigrStringMap<T> &); | copy constructor |
virtual ~TigrStringMap(); | destructor |
T &lookup(const char *,int index,int len); | finds the value assocated with
the
given string attribute, given buffer beginning, offset into that
buffer, and length of substring which occurs there |
T &lookup(const char *,int len); | same as above, but for offset=0 |
bool isDefined(const char *,int index,int len); | true iff the given string
occurs in
the string map. parms are buffer pointer, offset within buffer
and length of substring which occurs there |
bool isDefined(const char *,int len); | as above, but for offset=0 |
int size(); | number of entries in the map |
iterator begin(); | begin iterator |
iterator end(); | end iterator |
const_iterator begin() const; | const begin iterator |
const_iterator end() const; | const end iterator |
void clear(); | remove all entries from the map |
void remove(const char *,int index,int len); | remove a given string from the map. parms are buffer pointer, offset within buffer and length of substring which occurs there |
void remove(const char *,int len); | as above, with offset=0 |
TigrStringMap<T> &operator=(const TigrStringMap &); | copy assignment operator |
|
|
For tokenizing strings into arrays of
substrings. DEFAULT_WHITESPACE is " \t\n\r"
(space, tab, newline, carriage return). |
|
TigrStrTokenizer(const char *wspace=DEFAULT_WHITESPACE); | constructor -- use
tokenizeThis() or getTokensAndSeparators() next |
TigrStrTokenizer(const char *source, const char *wspace=DEFAULT_WHITESPACE); | constructor -- will set up the
tokenizer to tokenize the given source string |
TigrStrTokenizer(const TigrString &source, const char *wspace=DEFAULT_WHITESPACE); | constructor -- will set up the tokenizer to tokenize the given source string |
TigrVector<TigrString*> *getAllTokens(); | performs tokenization and returns vector of tokens |
TigrVector<TigrString> *getTokenStrings(); | same as above, but returning
strings rather than pointers |
bool hasMoreTokens(); | true iff there are more tokens |
const char *nextToken(); | returns the next token (do not
delete) |
pair<TigrVector<TigrString>, TigrVetor<TigrString>> *getTokensAndSeparators(const TigrString &); | returns a vector of tokens and
a vector of separator regions between them |
static TigrVector<TigrString*> *tokenize(const char *source, const char *wspace=DEFAULT_WHITESPACE); | static version of
getAllTokens() |
void tokenizeThis(const TigrString &s); | change the source string
specified in the constructor |
void tokenizeThis(const char *p); | as above, but for char* |
|
|
Computes summary statistics (mean, min, max, standard
deviation) |
|
TigrSummaryStats(const TigrVector<int> &); | constructor |
TigrSummaryStats(const TigrVector<float> &); | constructor |
TigrSummaryStats(const TigrVector<double> &); | constructor |
double getMax(); | maximum |
double getMean(); | mean |
double getMin(); | minimum |
double getStdDev(); | standard deviation |
int getN(); | number of data elements |
|
|
For keeping track of elapsed time. |
|
TigrString elapsedTime(); | returns the elapsed time in a
user-readable message string |
float elapsedSeconds(); | elapsed seconds |
void startCounting(); | start counting |
void stopCounting(); | stop counting |
|
|
|
|
An upper-triangular matrix, in which only values above
or on the main diagonal are explicitly stored. Thus, the second
index must always be greater than or equal to the first index.
This saves space for large matrices. |
|
TigrTriangMatrix(int n); | constructor |
T &operator()(int i,int j); | requires i<=j |
int getN() const; | length of each dimension of
the matrix |
|
|
|
|
Subclass of STL vector<T>, with a few added
features for convenience. |
|
TigrVector(); | constructor |
TigrVector(int size); | constructor - allocate fixed
size |
TigrVector<T> *getSubrange(int from,int to); | return new vector containing
subrange of this vector |
void getSubrange(int from,int to,TigrVector<T> &); | get subrange of this vector
and store it in given vector |
bool isMember(const T &); | searches linearly along vector
for the specified datum |
void append(const TigrVector<T> &); | append the given vector's
elements to this vector |
void push_front(const T &); | push element onto front of
vector & shift everything to the right |
void removeFirst(const T &x); | remove the leftmost element
which equals x, and shift everything to the left to fill in the gap |
bool isEmpty() const; | true iff vector size is zero |
T getFirst(); | returns first datum |
T getLast(); | returns last datum |
void resize(int n); | delete and reallocate to given
size |
void cut(int index); | remove the element at the given index and slide
everything over to fill in the gap |
void cut(int startIndex,int howMany); | remove the elements in the
given subrange and slide everything over to fill in the gap |
|
|
|
|
For sorting a TigrVector<T> via quicksort. |
|
TigrVectorSorter(TigrVector<T> &,TigrComparator<T> &); | constructor |
TigrVector<T> *sortAscending(); | sorts out-of-place and returns
sorted vector |
TigrVector<T> *sortDescending(); | as above, but descending |
TigrVector<int> *sortAscendByIndex(); | sorts out-of-place, producing
an array of indices into the original array, which is unmodified |
TigrVector<int> *sortDescendByIndex(); | as above, but descending |
void sortAscendInPlace(); | sort ascending in place |
void sortDescendInPlace(); | sort descending in place |
|
|
|
|
A very specialized queue that separates the elements
into two subqueues, the "window" and the "reservoir". Elements
pushed into the queue actually go into the "window" until they are
shift()'ed into the "reservoir." |
|
TigrWindowedQueue(); | constructor |
bool isEmpty(); | true iff both queues are empty |
list<T> &getReservoir(); | returns reservervoir queue |
list<T> &getWindow(); | returns window queue |
void enqueue(T); | enqueues element in "window"
queue |
void shift(); | shifts front element from
"window" queue into "reservoir" queue |