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.

Tuesday, September 21, 2010

Thursday, September 16, 2010

Wednesday, September 8, 2010

New C/Python/Octave functions

tc_simulateODE
tc_simulateSSA
tc_scanSteadyState
tc_exportSBML
tc_screenshot
tc_screenWidth
tc_screenHeight
tc_savePlot