Code Monkey home page Code Monkey logo

genetics-sim's Introduction

A Genetics Simulator

This was a semester project for a course on object-oriented programming. The task was to build program that could read in genetic information from two parent organisms and then create a variable number of offspring. Doing so required acquisition of domain knowledge (genetics) and an understanding of design patterns and the software development lifecycle.

Definition Files

The simulation creates an initial knowledge base from a definition file. That file contains descriptions of:

  • an organism
  • genes that organism can have
  • two parents and the gene configurations which they are made of

external/instructor_files/ contains two sample definition files that you can use when running the program. If building from source, these files are copied to the build directory using CMake.

The Reproduction Process

Reproduction mimics genetic processes closely, with a few simplifications. In src/core/, you will find models of components such as alleles, genes, chromosomes, and organisms. Organisms are composed of unpaired collections of chromosomes. This is slightly easier than the human case. From there, much is the same.

Chromosomes contain two strands on which genes are placed. During reproduction, the chromosomes of two parents are used to produce new chromosomes for an offspring organism. Much is left to chance. Certain complexities such as chromosomal crossover may occur. In that case, the alleles on a gene exchange during genetic recombination. The occurrence of crossover, as well as the variety of genes created, is printed in a final tally upon program exit.

Building The Code

Final development has been done using CMake 3.7 as the build system. There are two build targets of interest: genetics and tests. The former is the program itself and the latter builds the test suit. All tests were written using Google Test, which CMake will pull from the GitHub repository and build as part of the process.

cd into the cloned directory and run the following:

cmake .
make -j<# of threads to use>

This builds all projects. You can specify either genetics or tests to narrow compilation. E.g., make -j4 tests.

A new directory, build, should now exist in the root. It contains the target executables and two sample definition files.

Generating The Documentation

Class documentation can be generated using Doxygen--a free tool that allows you to create Javadoc-style documentation for C++ source code. You can read more about Doxygen here.

Once installed, cd into the root directory of this project and run the doxygen command on the doxyconfig file:

doxygen doxyconfig

This will generate html (and latex) files and place them in docs/. Navigate to docs/html/index.html to get started.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.