Skip to content

Charles-Fieseler/The-Control-Structure-of-the-Nematode-C-Elegans

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Control Structure of the Nematode C Elegans

This repository contains two main code projects and several example data runs.

  • ./MatlabSupport has the visualization software, written in MATLAB, for individual data runs and an implementation of an interactive metadata visualizer for folders of many data runs.
  • ./Model has a parallelized C elegans simulator written in C++ using openMP.
  • ./Simdata_* are several folders that contain different data sets generated by the C++ simulation (run_trials_parallel.cpp) and meant to be visualized using the included MATLAB code (WormMetaDataObj.m).

Getting Started

Download or fork this repository, install the matlab fileexchange packages below, and install the Sundials ODE solver package.

Prerequisites

For simulation:

For visualization:

For reproducing the paper plots:

Installing

Note: my experience is with the full repository on Windows 10 64-bit through cygwin, as well as the simulations themselves on a Linux box.

First, Sundials version 2.6.0+. Full installation instructions are on their website, and for Linux systems they probably work fine. For a windows installation, I used cygwin and needed the following packages: apt-cyg (or your preferred way of getting packages) cmake (required) Note: there is a function "CLOCK_MONOTONIC_RAW" that caused the installation to crash on my machine. Changing these to "CLOCK_MONOTONIC" worked. (If this is a stupid thing to do, please someone contact me!)

Second, the MATLAB packages. I use the v2struct package for implementing defaults in my code. I use matlab2tikz for exporting some of my plots to the latex-friendly format, .tikz. This package is not necessary for the regular visualization component of the code. These can be directly installed if you have a mathworks account.

Sample Workflow

  1. Create or modify a version of run_trials_parallel.cpp. This means deciding and coding two things:
    • Which variables you want to loop over
    • What you want your output files to be names. Important: these should have unique names!
    • Note: the actual data files will have prefixes. "simdata_" for the actual data; "prams_" for the parameters; and "mdata_" for the metadata.
  2. Type 'make'. This should create a function called "program" (will be ".exe" on Windows)
  3. Type './program.exe > log.txt' (or the equivalent on your operating system)
    • Redirecting the output to a textfile isn't necessary of course, but there can be a large amount of output for parallel simulations.
  4. Wait for the simulation to finish
    • IMPORTANT: a good rule of thumb for how long this will take on my machine was ~30s per 10s simulation run. This depended on several things, most notably how much/how fast the worm is actually moving.
      • If you want to reproduce the data sets included using the included run_trials_parallel_*.cpp files, this will almost certaintly take DAYS OF COMPUTING TIME.
    • The current code writes all the .csv files to the same folder as "program"
    • I moved them to a folder labeled "Simdata_\something_descriptive"; hereafter referred to as FOLDERNAME
  5. Move to MATLAB, cd() to the "MatlabSupport" folder, and type 'WormMetaDataObj('../FOLDERNAME','independentVariable')'
    • e.g. WormMetaDataObj('../Simdata_N_SR_2nd','changeInAngle')
    • This object will try to visualize the metadata for all '.csv' files in the folder; this may take ~0.5s per data file
    • Depending on the files, options may be necessary for useful visualization; see the help for that file for more detailed explanation and more examples.
  6. Click on data points to see a video of the simulation data that produced it!

Running the tests

Not very much here, to be honest... the sample data sets are good benchmarks to see if something is very wrong though.

Authors

  • Charles Fieseler University of Washington PhD student in Physics.

See also the original paper and code upon which this code was based: Boyle, J.H., Bryden, J., and Cohen, N. 2008. An integrated neuro-mechanical model of C. elegans forward locomotion. Lect Notes Comput Sci, 4984, pp.37-47.

License

.......

Acknowledgments

  • Thanks to Nathan Kutz and James Kunert for much discussion on the interpretation of these results and useful things to do.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published