-
Notifications
You must be signed in to change notification settings - Fork 24
Genome Handlers
Genome handlers provide a standardized method to interact with different types of genomes.
A genome handler can be though of as a read head on a tape recorder. A genome handler points to a site in a genome. If you ask a genome handler to write data, it will write to that location and advance to the next site. The same is true if you ask the genome handler to read a value.
In addition to pointing to a site in a genome, a genome handler has 3 additional properties which make up the genome handlers state.
- read direction - the genome handler can be set to read forward or backwards. The read direction can be changed by calling setReadDirection().
- EOG - End of Genome. If the genome handler passes the end of the Genome, the EOG flag will be set to true.
- EOC - End of Choromosome. If the genome handler passes the end of a chromosome, the EOC flag will be set to true. (Note that what exactly a chromosome is, is defined by a genome).
auto genomeHandler = genome->newHandler(genome, true);
assuming that we have <shared_ptr> genome, this will create a handler pointing to the first site in genome (note: unfortunately we must pass genome into the function so that the handler can have a shared pointer to its genome)
void resetEOG()
reset End of Genome flag.
void resetEOC()
reset End of Chromosome flag.
void setReadDirection(bool _readDirection)
set the read direction where true = forward, false = backwards.
void toggleReadDirection()
reverse the read direction.
void resetHandler()
if read direction is forward, point handler at first site in genome. If read direction is backwards, point genome handler at last site in genome.
void resetHandlerOnChromosome()
if read direction is forward, point handler at first site in current chromosome. If read direction is backwards, point genome handler at last site in current chromosome.
readInt(int valueMin, int valueMax, int code = -1, int CodingRegionIndex = 0)
read one integer from the genome between valueMin and valueMax. Lets say you wanted to get a gate input value from the genome. Lets say that the number of bits per input was set to 8. This would mean that you need an 8 bit number (0 to 255). If you were reading from a genome with alphabet size 2 (bits), you would need 8 sites to generate value. for more about this click here.
readDouble(double valueMin, double valueMax, int code = -1, int CodingRegionIndex = 0)
read one double (continuous value) from the genome. This will read one site from the genome and "scale it" to it to fit in (valueMin,valueMax). for more about this click here.
void writeInt(int value, int valueMin, int valueMax)
write a value to the genome. in addition to the value you wish to write, you must also provide the possible range of that value. valueMin and valueMax are used to determine the number of sites in the genome needed to hold the value. for more about this click here.
vector<vector<int>> readTable(pair<int,int> tableSize, pair<int,int> tableMaxSize, pair<int,int> valueRange, int code = -1, int CodingRegionIndex = 0)
use readInt() to read values from the genome and assemble a table. The table will have size determined by table size, but will "reserve" space for a table of tableMaxSize so that if the table grows in the future, the values associated with the cells of the smaller table will stay constant. valueRange determines the range of the values to be placed in each cell.
void advanceIndex(int distance = 1)
advance index moves the handler distance positions (default 1 position). The direction is determined by read direction.
void copyTo(shared_ptr to)
copy this genome handler to "to"
bool atEOG()
return the state of the EOG flag.
bool atEOC()
return the state of the EOC flag.
void printIndex()
print the state of this genome handler
bool inTelomere(int length)
return true if genome handler is within length distance of the end of the chromosome (or beginning if read direction is backwards.)
void randomize()
move the handler to a random location
home
welcome
MABE Parameter Widget
Installation and quick start
license
citations
release notes
developer contributions
consistency testing
Using MABE
Using Settings Files
Output Files
Creating Graphs with python
MABE framework
Defining Update
Brains
Markov Brain
Neuron Gate
Wire Brain
Human Brain
ConstantValues Brain
CGP Brain
Genetic Programing Brain
Artificial Neural Networks
Brains Structure and Connectome
Genomes
Circular Genome
Multi Genome
Genome Handlers
Genome Value Conversions
Organisms
Groups
Archivists
popFileColumns
Optimizers
Lexicase Optimizer
Worlds
Berry World
ComplexiPhi World
MultiThreadTemplate World
Utilities
DataMap
Parameters
Parameters Name Space
Adding Parameters to Code
ParametersTable
MTree
sequence function
Population Loading
PythonTools
MBuild
MGraph
MQ
findRelatedness
generatePhylogeny
Information Theory Tools
Brain States and Life Times
TimeSeries
Entropy Functions
Smearing
Fragmentation
State to State
Brain Infomation Tools
ProcessingTools