Saturday, January 29, 2011

TinkerCell symbols

Doc with all the TinkerCell symbols:

PDF export finally works


Finally resolved the long postponed issue of PDF export. The solution involved changing the ConnectionGraphicsItem class from being a QGraphicsPathItem to a QGraphicsItemGroup. The group then contains path items with it. There are three path items -- one for the main connection itself, one for a white border around it (when lines overlap), and one for the red border when connections are selected. Why does this work? No idea. There is something about the way Qt renders graphics path items that I am unaware of, so its probably best to use their available classes (as in this new strategy).

The exported PDF (from "screenshot" button) is clearly using vector graphics and not pixels.



Friday, January 28, 2011

Small change to assignment rules


Small change to the way assignment rules are declared. If the "assignments" table contains a row called "self", then that row is assumed to be the assignment rule for that component. Before the row name was the component's name, but that was causing problems when sub-processes were merged with the host model, i.e. renaming issues.

And parts on plasmid look better now (side bars become invisible)


Tuesday, January 18, 2011

Automatically create and upload installer


In Windows and Mac, it is a bit time consuming to create the TinkerCell installer and upload it to Sourceforge.

As a solution, I created a simple CMake-generated script that does the work. Different scripts are generated based on the operating system. The Windows and Linux scripts build the program and upload it to sourceforge. Linux script can also upload the source code. The Mac script does not upload yet, but it does generate the image file (which is most of the work). For developers who want to build TinkerCell on their own machines, new instructions are available in the README.txt file included with the code. Here is a summary:

1. (windows) Install Inno setup, ISTools, and WinSCP.. and CMake of course
2. Download TinkerCell source code
3. Run CMake GUI (use the "grouped" view for convenience)
4. Set the TinkerCell source folder (/trunk) and the build folder (/trunk/BUILD)
5. Select TinkerCell lite versions if desired (under the TinkerCell group)
6. Run "Configure" and "Generate". Look for the message in red, which will tell you where the installation script is created
7. Run the installation script. It will create the program, the installer, and upload it!

Steps 1-6 only need to be run the first time when setting up CMake

For Mac...all the steps are the same, except for #7
7. Run the create_bundled_app.sh script in the BUILD/bin folder

For Linux, there is the additional option of selecting 64-bit or 32-bit OS. The is also the option of uploading the source along with the binaries...
7. Run upload.sh


Monday, January 17, 2011

TinkerCell "lite" revisited

Introducing TinkerCellScript, which is currently using Antimony scripts (but the scripting framework is open to other parsers...)




...
and TinkerCellLite, which is just for drawing DNA-based designs


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.