Documentation‎ > ‎

Python functions

zoom
   zoom by a factor.
   example:
       zoom(1.2);

showProgress
   show progress in percent (0-100).
   example:
       showProgress(50);

clear
   clear all text.
   example:
       clear();

write
   print text.
   example:
       write("hello world")

writeFile
   print text contents of a file.
   example:
       write("myfile.txt")

errorReport
   print error report.
   example:
       errorReport("error here")

createInputWindow
   create an input window for running another library.
   example:
       createInputWindow(("model","type","time","dt"),(0,0,100,0.1),"dlls/mydll","main","My Program");

addInputWindowOptions
   create an input window for running another library.
   example:
       addInputWindowOptions("My Program",0,0,("all","selected");

openNewWindow
   open a new window or tab.
   example:
       openNewWindow();

outputOn
   turn on all outputs from Python to console.
   example:
       outputOn()

outputOff
   turn off all outputs from Python to console.
   example:
       outputOff()

errorOn
   turn on all error messages from Python to console.
   example:
       errorOn()

errorOff
   turn off all error messages from Python to console.
   example:
       errorOff()

getString
   display a dialog and get a string from the user.
   example:
       getString("please enter text");

getFilename
   display a dialog and get a file name from the user.
   example:
       s = getFilename();

getNumber
   display a dialog and get a number from the user.
   example:
       getNumber("please enter number");

getNumbers
   display a dialog and get a set of numbers from the user.
   example:
       l = getNumbers(('A','B','C'));

getFromList
   display a dialog and ask the user to make a selection.
   example:
       i = getFromList("please select one:",["option 1","option 1","option 1"]);

askQuestion
   display a dialog that asks the user a question.
   example:
       p = askQuestion('are you sure?');

messageDialog
   display a message dialog.
   example:
       messageDialog('the model has been updated');

allItems
   get addresses for all items.
   example:
       Array = allItems();

selectedItems
   get addresses for selected items.
   example:
       Array = selectedItems();

itemsOfFamily
   get addresses of all items belonging to a family.
   example:
       Array = itemsOfFamily("Protein");

find
   get the address of an item using its full name.
   example:
       A = find("A") or B = find("Cell1.A");

selectItem
   select an item.
   example:
       A = find("A"); selectItem(A);

removeItem
   remove the given item.
   example:
       A = find("A"); removeItem(A);

deselect
   deselect all selected items.
   example:
       deselectItems();

getName
   get the name of an item.
   example:
       Array = selectedItems(); s = getName(Array[0]);

rename
   set the name of an item.
   example:
       Array = selectedItems(); rename(Array[0],"S");

getNames
   get the names of given items.
   example:
       Array = selectedItems(); names = getNames(Array[0]);

family
   get the family of an item.
   example:
       A = find("A"); s = getFamily(A);

isA
   checks whether the given item belongs in the given family.
   example:
       Array = find("A"); i = isA(A,"Receptor");

getX
   get the X coordinate of an item.
   example:
       A = find("A"); x = getX(A);

getY
   get the Y coordinate of an item.
   example:
       A = find("A"); y = getY(A);

getPos
   get the X and Y coordinates of a set of items.
   example:
       A = (find("A"),find("B")); xy = getPos(A); print xy;

setPos
   set and X and Y coordinate of a given item.
   example:
       A = find("A"); setPos(A,100,200);

setPosMulti
   set and X and Y coordinate of severak items.
   example:
       A = (find("A"),find("B")); setPosMulti(A, ((100,200),(150,500)));

moveSelected
   move all selected items by the given amount in the x and y direction.
   example:
       moveSelected(100,200);

isWindows
   returns 1 is this is a Windows operating system.
   example:
       i = isWindows();

isMac
   returns 1 is this is a Mac operating system.
   example:
       i = isMac();

isLinux
   returns 1 is this is a Linux operating system.
   example:
       i = isLinux();

appDir
   returns the application directory.
   example:
       s = appDir()

annotation
   get the annotation for an item, e.g. author, etc..
   example:
       A = find("A"); print annotation(A);

setAnnotation
   set the annotation for an item, e.g. author, etc..
   example:
       A = find("A"); setAnnotation(A,("Mickey Mouse","Apr. 27, 2009","my device","more about my device","www.tinkercell.com","ref#12345"));

getNumericalDataNames
   get the names of all the numerical data for an item.
   example:
       A = find("A"); t = getNumericalDataNames(A);

getTextDataNames
   get the names of all the text data for an item.
   example:
       A = find("A"); t = getTextDataNames(A);

getNumericalData
   get a numerical data.
   example:
       A = find("A"); t = getNumericalData(A,"Stoichiometry","J0","A");

getTextData
   get a text data.
   example:
       A = find("A"); t = getTextData(A,"Assignments","f","function");

setNumericalData
   set a numerical data.
   example:
       A = find("A"); setNumericalData(A,"Stoichiometry","J0","A",-4);

setTextData
   set a text data.
   example:
       A = find("A"); t = setTextData(A,"Assignments","f","function","sin(time)");

getChildren
   get child items.
   example:
       A = find("A"); children = getChildren(A);");

getParent
   get child items.
   example:
       A = find("A"); p = getParent(A);");

getNumericalDataRowNames
   get the row names of a numerical data matrix.
   example:
       A = find("J0"); getNumericalDataRowNames(A,"Stoichiometry");

getNumericalDataColNames
   get the column names of a numerical data matrix.
   example:
       A = find("J0"); getNumericalDataColNames(A,"Stoichiometry");

getTextDataRowNames
   get the row names of a text data matrix.
   example:
       A = find("J0"); getTextDataRowNames(A,"Rates");

getTextDataColNames
   get the column names of a text data matrix.
   example:
       A = find("J0"); getTextDataColNames(A,"Rates");

getNumericalDataMatrix
   get an enitre numerical data matrix. Use 0 as the first argument for global matrices.
   example:
       A = find("J0"); getNumericalDataMatrix(A,"Stoichiometry");

setNumericalDataMatrix
   set an enitre numerical data matrix. Use 0 as the first argument for global matrices
   example:
       A = find("J0"); setNumericalDataMatrix("My Data",("col1","col2"),("row1","row2","row3"),((1,2,3),(4,5,6)),A); print getNumericalDataMatrix(A,"My Data");

getTextDataRow
   get the values in a particular row of a text data matrix.
   example:
       A = find("J0"); getTextDataRow(A,"Stoichiometry","A");

getTextDataCol
   get the values in a particular column of a text data matrix.
   example:
       A = find("J0"); getTextDataCol(A,"Stoichiometry","J0");

insertNode
   insert a new node with the given name and family.
   example:
       insertNode("A") or insertNode("A","Receptor");

insertConnection
   insert a connection that connects one set of items to another and has the given name and family.
   example:
       Array1 = [find("A"), find("B")]; Array2 = [find("C")]; insertConnection(Array1,Array2,"name","Reaction");

getConnectedNodes
   get all the parts in the given connections.
   example:
       J = find("J0"); Array = getConnectedParts(J);

getConnectedNodesIn
   get all the parts in the given connections that are in-nodes, such as reactants.
   example:
       J = find("J0"); Array = getConnectedPartsIn(J);

getConnectedNodessOut
   get all the parts in the given connections that are out-nodes, such as products.
   example:
       J = find("J0"); Array = getConnectedPartsOut(J);

getConnectedNodesOther
   get all the parts in the given connections that are not in- or out-nodes.
   example:
       J = find("J0"); Array = getConnectedPartsOther(J);

getConnections
   get all the connections for the given part.
   example:
       A = find("A"); Array = getConnections(A);

getConnectionsIn
   get all the connections for the given part where the part is an in-node.
   example:
       A = find("A"); Array = getConnectionsIn(A);

getConnectionsOut
   get all the connections for the given part where the part is an out-node.
   example:
       A = find("A"); Array = getConnectionsOut(A);

getConnectionsOther
   get all the connections for the given part where the part is not an in- or out-node.
   example:
       A = find("A"); Array = getConnectionsOther(A);

allParameters
   get all the parameters [ [name1,name2..], [value1,value2..] ]for the given items, whether or not they are used in the model.
   example:
       items = allItems(); Array = allParameters(items); write(Array[0][0] + " = " + str(Array[1][0]));

parameters
   get all the parameters [ [name1,name2..], [value1,value2..] ] for the given items that are in use.
   example:
       items = allItems(); Array = parameters(items); write(Array[0][0] + " = " + str(Array[1][0]));

initialValues
   get initial values for floating variables [ [name1,name2..], [value1,value2..] ] for the given items.
   example:
       items = allItems(); Array = initialValues(items); write(Array[0][0] + " = " + str(Array[1][0]));

setInitialValues
   set initial values for floating variables [ [name1,name2..], [value1,value2..] ] in the given items.
   example:
       items = find(("A","B")); setInitialValues(items,[0.1, 0.2]);

parametersAndFixedVariables
   get all the parameters and fixed variables [ [name1,name2..], [value1,value2..] ] in the given items.
   example:
       items = allItems(); Array = getParametersAndFixedVariables(items); write(Array[0][0] + " = " + str(Array[1][0]));

fixedVariables
   get all the fixed variables [ [name1,name2..], [value1,value2..] ] for the given items.
   example:
       items = allItems(); Array = fixedVariables(items); write(Array[0] [0]+ " = " + str(Array[1][0]));

getParameter
   get a specific parameter for the given items.
   example:
       A = find("A"); getParameter(A,"concentration");

getTextAttribute
   get a specific text attribute for the given items.
   example:
       A = find("A"); getTextAttribute(A,"sequence");

getParametersNamed
   get the specified parameters for the given items.
   example:
       items = allItems(); Array = getParametersNamed(items,["concentration","copy"]); write(Array[0][0] + " = " + str(Array[1][0]));

getParametersExcept
   get all parameters EXCEPT the ones specified for the given items.
   example:
       items = allItems(); Array = getParametersExcept(items,["concentration","copy"]); write(Array[0][0] + " = " + str(Array[1][0]));

getAllTextNamed
   get the specified text attributes for the given items.
   example:
       items = allItems(); Array = getAllTextNamed(items,["concentration","copy"]); write(Array[0]);

setParameter
   set a parameter value for the given items.
   example:
       A = find("A"); setParameter(A,"Ka",1.2E5);

setTextAttribute
   set a text attribute for the given items.
   example:
       A = find("A"); setTextAttribute(A,"sequence","AACGCTGAG");

getControlPointX
   get the X co-ordinate of a control point in a connection.
   example:
       J = find("J0"); Array = getConnectedParts(J); A = Array[0]; x = getControlPointX(J,A,1);

getControlPointY
   get the Y co-ordinate of a control point in a connection.
   example:
       J = find("J0"); Array = getConnectedParts(J); A = Array[0]; y = getControlPointY(J,A,1);

setControlPoint
   set the x,y co-ordinate of a control point in a connection.
   example:
       J = find("J0"); Array = getConnectedParts(J); A = Array[0]; y = setControlPoint(J,A,1,100,100);

setCenterPoint
   set the x,y co-ordinate of the center point of a connection.
   example:
       J = find("J0"); setCenterPoint(J,100,100);

getCenterPointX
   get the X co-ordinate of the center point of a connection.
   example:
       J = find("J0"); x = getCenterPointX(J);

getCenterPointY
   get the Y co-ordinate of the center point of a connection.
   example:
       J = find("J0"); y = getCenterPointY(J);

compileAndRun
   compile and execute a C program.
   example:
       compileAndRun("mycode.c -lm","arg1 arg2"); #will make the executable for mycode.c and run it using arg1 and arg2

compileBuildLoad
   build a C program as a dynamic library and load into TinkerCell.
   example:
       compileBuildLoad("mycode.c -lm","main"); #will call the main function in mycode.c

callFunction
   execute a program that is listed in the functions menu.
   example:
       callFunction("Deterministic simulation");

loadLibrary
   load a dynamic C library.
   example:
       loadLibrary("mycode.dll");

getColorR
   get the Red value of the color of the given object.
   example:
       A = find("A"); r = getColorR(A);

getColorG
   get the Green value of the color of the given object.
   example:
       A = find("A"); r = getColorG(A);

getColorB
   get the Blue value of the color of the given object.
   example:
       A = find("A"); r = getColorB(A);

setColor
   set the Red,Green,Blue values for the color of the given object. The last argument indicated whether the color is permanent or termporary.
   example:
       A = find("A"); setColor(A,250,100,100,1);

setStraight
   toggle between straight of curved lines for drawing a connector.
   example:
       J = find("J"); setStraight(J,1);

setAllStraight
   toggle between straight of curved lines for drawing all connectors.
   example:
       setAllStraight(1);

setLineWidth
   set the line width of a connector. The last argument indicated whether the change is permanent or termporary.
   example:
       J = find("J0"); setLineWidth(J,5.0,1);

changeNodeImage
   change the image for a node by specifying the arrowhead graphics file.
   example:
       A = find("A"); changeNodeImage(A, "NodeItems/Molecule.xml");

changeArrowHead
   change the arrowhead for a connection by specifying the arrowhead graphics file.
   example:
       J = find("J0"); changeArrowHead(J, "ArrowItems/Binding.xml");

plot
   Plot the given set of values (2D array) with the given headers and x-axis.
   example:
       data = [[0,0] , [1,1] , [2,4] , [3,9] , [4,16] ]; where each pair is a row. plot(["x","y"],data,0,"my plot");

scatterplot
   Plot the given set of values (2-column array) with the given headers.
   example:
       data = [[0,0] , [1,1] , [2,4] , [3,9] , [4,16] ]; where each pair is a row. scatterplot(["x","y"],data,"my plot");

surface
   Plot 3D surface, given a matrix with 3 columns (x,y,z).
   example:
       data = [ [0,1,2,3,4] , [1,2,3,4,5] , [2,3,4,5,6] ]; surface(["x","y","z"],data,"my plot");

getPlotData
   Get the values and headers of the data that is displayed in the plot window.
   example:
       data = plotData(); print data;

histogram
   plot a histogram of each column in the data.
   example:
       p = plotData(); histogram(p[0],p[1]);

multiplot
   setup plot layout for multiple plot.
   example:
       multiplot(2,2);

writeModel
   Write the differential equations and propentity functions to a file (do not include .py suffix).
   example:
       writeModel("ode",selectedItems()); or writeModel("ode2"); defaults to all items

stoichiometry
   get the column names and the linearized stoichiometry matrix for given item(s).
   example:
       items = selectedItems(); N = stoichiometry(items); N1 = stoichiometry(items[0]);

rates
   get the rates for multiple items.
   example:
       items = selectedItems(); v = rates(items);

getRate
   get the rate for a given item.
   example:
       item = find('J0'); v = getRate(item);

setRates
   set the rates for multiple items.
   example:
       items = ( find('J0'), find('J1') ); setRates(items,('rate1','rate2')); setRates(items[0],'rate1');

setRate
   set the rate for a given item.
   example:
       item = find('J0'); setRate(item,'rate1');

eventTriggers
   get all the event triggers.
   example:
       print eventTriggers();

eventResponses
   get all the event responses corresponding to triggers.
   example:
       print eventResponses();

addEvent
   set an event defined by a trigger and a response.
   example:
       addEvent("time > 10","a = 0");

forcingFunctionNames
   get all forcing function name for given items.
   example:
       A = allItems(); forcingFunctionNames(A);

forcingFunctionAssignments
   get all forcing function assignment rules for given items.
   example:
       A = allItems(); forcingFunctionAssignments(A);

setForcingFunction
   add or modify a function for the given item.
   example:
       a = find("A"); setForcingFunction(a,"func","sin(time)*a");

highlight
   display a circle around the given item temporarily.
   example:
       a = find("A"); highlight(a); or highlight(a,255,0,0); for color

displayText
   display the given text on top of the given item.
   example:
       a = find("A"); displayText(a,"Hello World");

displayNumber
   display the given number on top of the given item.
   example:
       a = find("A"); displayNumber(a,3.14159);

merge
   Merge a list of items.
   example:
       a = find("A"); a = find("B"); merge((a,b));

separate
   Separate an item.
   example:
       a = find("A"); separate(a);

partsIn
   get all the DNA parts inside a Module or Compartment.
   example:
       a = find("A"); A = partsIn(a); prints getNames(A);

partsUpstream
   get all the DNA parts upstream of this part.
   example:
       a = find("A"); A = partsUpstream(a); prints getNames(A);

partsDownstream
   get all the DNA parts downstream of this part.
   example:
       a = find("A"); A = partsDownstream(a); prints getNames(A);

loadSBMLString
   load SBML model using the XML string as input.
   example:
       loadSBMLString(sbml_text)

loadAntimonyString
   load Antimony model using the model string as input.
   example:
       loadAntimonyString(sbml_text)

loadSBMLFile
   load SBML model using the file name as input.
   example:
       loadSBMLString("myfile.sbml")

loadAntimonyFile
   load Antimony model using the file name as input.
   example:
       loadAntimonyFile("myfile.txt");

getSBMLString
   get SBML as a string from either a subset of items or all items.
   example:
       A = selectedItems(); s1 = getSBMLString(A); s2 = getSBMLString();

getAntimonyString
   get Antimony model string from either a subset of items or all items.
   example:
       A = selectedItems(); s1 = getAntimonyString(A); s2 = getAntimonyString();

writeSBMLFile
   write the SBML to an xml file.
   example:
       writeSBMLFile("myfile.sbml")

writeAntimonyFile
   write the Antimony model to a text file.
   example:
       writeAntimonyFile("myfile.txt")

Comments