There are already some TCL scripts in the T-ACE modules folder, which are completely independent of the T-ACE.tcl. Some of them can serve as examples to create your own T-ACE module. The simplest one is the sample_module_tace.tcl; this module does nothing but opening a dialog which says "This is a sample module" and displaying the name of the selected database.
To add this sample module to T-ACE open the menu_tace.tcl and insert the following line to the 'Modules'-menu:
.menubar.module.menu add command -label "Sample Module" -command "sampleModule"
With the next start of T-ACE the 'Modules'-menu should contain the option 'Sample Module'.
There are three important points for adding a custom made TCL script into T-ACE:
The script has to be located in the modules folder of T-ACE.
Menu buttons which link to the new modules must be added to the menu_tace.tcl in the modules folder of T-ACE.
To load initial configurations for the new module, before T-ACE opens, methods can be added to the startup_tace file in the conf folder of T-ACE.
Database access
Depending on the T-ACE version that is used, the new module has to access the database in different ways.
If T-ACEpg is used the module requires pgtcl to access the database. The normal pgtcl commands are used, like:
pg_connect, pg_exec and pg_select
When using the normal T-ACE version the database is accessed through a php script to do this the module should use the T-ACE methods:
php_checkConnection, php_getSQLresults and php_getDBupload
To get code examples for accessing the database just, look into the files in the modules folder of T-ACE, like:
NCBI_blast_tace.tcl, phobos_tace.tcl or run_compare_tace.tcl
The php methods
php_checkConnection
This method just checks if a connection to the database is possible. It is used for the login procedure.
php_getSQLresults {sql}
This is most used method; it sends an SQL request to the database and returns the results.
php_getDBupload {table input}
This method is used to write big data sets into the database. It needs as input to parmeters:
table: The name of the table of the database into which the data shall be written.
input: The data that shall be written into the table. The data has to be in a tab-delimited, multi row string format.