Sunday, January 16, 2011

Integrated COPASI and sliders




The COPASI C++ API has been integrated into TinkerCell. Simulation functions, MCA functions, and steady state analysis function have been added. The image above shows a plot of the Eigenvalues with sliders to visualize how the Eigenvalues change due to change in parameters.

A COPASI C API has been created. The API uses Hash tables for quick look-up, thus adding the convenience of name-based look-up. See copasi_api.h for the functions.

Wednesday, December 8, 2010

Circular Plasmids


The above picture was the old version (not good). Below is the "new" version (much better because the black bars are removed). The "upstream" and "downstream" calculations are performed by taking the starting node and walking along the circle in increments of 0.02 * PI degrees (i.e. 100 points on the circle). If any part is smaller than that (hope not), it might get skipped. The AutoGeneRegulatoryTool now has two functions -- allPartsLinear and allPartsCircular -- one is used for linear arrangement of parts and the other for circular.







Octave Interpreter issues in Windows

On Windows, there is an issue when passing Swig types into Octave functions. Since Octave works with matrices, converting tc_matrix to Octave matrix is most important. The "fromTC" function does the job in Linux, but in windows, the OctaveInterpreter does a regex-replace of fromTC and replaces it with a double-for-loop that converts the tc_matrix into Octave's matrix.

Also, setInterpreter method has been added to the ConsoleWindow class. Here is how to use it (taken from SimpleDesigner.cpp):

ConsoleWindow * console = mainWindow.console();
OctaveInterpreterThread * octaveInterpreter = new OctaveInterpreterThread("tinkercell.oct", "libtcoct", &mainWindow);
octaveInterpreter->initialize();
console->setInterpreter(octaveInterpreter);

Monday, November 22, 2010

Using the plot tool from plugins



In addition to normal line plots, the plot tool features scatter plots, surface plots, and histograms. It can also to multiple plots. All of these features can be accessed from C++, C, Python, or Octave. Here is some code:

In C:
tc_matrix m = tc_plotData(i); //get data in ith plot window

tc_multiplot(2,1); //plot 2 graphs
tc_plot(m, "title"); //plot normal plot
tc_scatterplot(m, "title"); //scatterplot
tc_hist(m, "title"); //histogram
tc_surfacePlot(m, "title"); //3D plot - m must have 3

In Python:

m = tc_plotData(i); //get data in ith plot window
m2 = fromTC(m); //convert to python array

m = toTC(m2); //convert to tinkercell matrix
tc_multiplot(2,1); //plot 2 graphs
tc_plot(m, "title"); //plot normal plot
tc_scatterplot(m, "title"); //scatterplot
tc_hist(m, "title"); //histogram
tc_surfacePlot(m, "title"); //3D plot - m must have 3

In Octave:

m = tc_plotData(i); //get data in ith plot window
m2 = fromTC(m); //convert to octave matrix

//currently there is no way to convert to tinkercell matrix
//you will have to use tc_setMatrixValue to set each i,j-th
//value, i.e. write a double for-loop
tc_multiplot(2,1); //plot 2 graphs
tc_plot(m, "title"); //plot normal plot
tc_scatterplot(m, "title"); //scatterplot
tc_hist(m, "title"); //histogram
tc_surfacePlot(m, "title"); //3D plot - m must have 3

C++ (more code and more flexibility)
//get the plot tool
PlotTool * plot = static_cast (mainWindow->tool("plot"));

//get list of all plot windows inside the plot tool
QList<> plotWidgets = plot->plotWidgets();

//get the data from the i-th plot window
NumericalDataTable data = plotWidgets[0]->data();

//plot multiple graphs or plot on top of existing plot
plot->hold(true);
plot->overplot(true);

//plot data
plot->plot(data, "title");

//plot specific type of graph
int xaxis = 0; //index to use for x-axis

//specify plot type: Plot2D, SurfacePlot, HistogramPlot, ScatterPlot, BarPlot, Text

plot->data(data, "title", xaxis, PlotTool::BarPlot);



Friday, November 12, 2010

TinkerCell "lite"

MainWindow now has a new static field called PROGRAM_MODE. This is an optional field used to indicate the "mode" of the program. Different plug-ins can choose to behave differently based on the program mode. For example, setting the mode to "lite" makes the CatalogTool load minimal tabs at the top and prevents some other tools from showing themselves.



Friday, October 29, 2010

"groupID" for graphics items and file formats

A new variable called groupID has been added to all the graphic item classes (i.e. NodeGraphicsItem, ConnectionGraphicsItem, and TextGraphicsItem).

The purpose of this new variable is to group graphics items together. Specifically, it is used to identify all the items that belong in the same scene. Since a single handle can contain multiple graphics items in different scenes, there was no other way to determine which item belongs in which scene. Further, ConnectionGraphicsReader was using position to identify nodes connected to a connection, which is faulty if two or more scenes have items of the same handle at the same position. The new variable is used by ConnectionGraphicsReader to identify the proper nodes. It is also used by ModuleTool to identify which items to load into a new scene.

By default, groupID is empty. This variable will not be made accessible through the C API since it is purely for graphics.

Auto-updates

The following site is home to TinkerCell's plugins.

http://tinkercellextra.svn.sourceforge.net/

If a machine as SVN installed, then TinkerCell automatically sets up an SVN repository in the TinkerCell home folder (i.e. usually Documents/TinkerCell). The files in the above repository are automatically updated each time TinkerCell starts. This is very simple. In the DynamicCodeMain.cpp.in file, a system call is made to svn -- simple.

Additionally, there is a file called updates.txt in this repository that is automatically updated by CMake. In the DynamicCodeTools/CMakeLists.txt file, the last line runs a perl script that updates the updates.txt file so that updates.txt has the current SVN revision number in it. When TinkerCell starts, it checks to see that the version number matches the number listed in this file. If not, a message is displayed notifying the user of a newer version.

Monday, October 11, 2010

Octave/Matlab export

OctaveExportTool adds a menu item in the File menu for exporting Matlab or Octave ODE functions along with a few other functions, such as setParameters for any sort of optimization routines.

Saturday, October 9, 2010

Thursday, September 23, 2010

Themes





TinkerCell now uses "Themes" to categorize graphics object. Each Theme is defined by a set of Nodes, Arrows, and Decorators. Each theme rests in a folder. There are three themes as of today:

Fancy1, Bio1, Blocks1

These themes are located inside the Graphics folder. In TinkerCell Options->"Select Theme" is used to switch between themes. TinkerCell searches the home folder (i.e. Documents/TinkerCell) first, which means that users can make new Themes and place them in the home folder.

Here is how to make a new Theme:

1. Create a folder in the Documents/TinkerCell folder called "Graphics"

2. Inside Graphics, create a folder with any name. The folder name is the name of your theme

3. Make three folders inside your theme folder: Nodes, Arrows, Decorators (case sensitive, I think)

4. Use the NodeGraphics program to make nodes, arrows, and decorators xml and PNG files, and put those files in the appropriate folders. Note that the NodeGraphics program creates an xml file (the vector graphics) and a PNG file (used to draw buttons).

5. Make sure that the names are correct. Eg. the .xml and .PNG file for drawing "Protein" types should be names Protein.xml, and the arrow for EnzymeCatalysis reactions should be names EnzymeCatalysis.xml. The Decorators should also use process family names, e.g. EnzymeCatalysis. You may want to look at the existing TinkerCell/Graphics folder.

6. Once you are done with your Theme, create a drawing in TinkerCell using your theme. Take a screenshot and save the "screenshot.png" file in your Theme folder. The Options->"Select Theme" dialog will display this file.