Meta Scripts

Overview



As well as scripts for single experiments and workflows, GeneLinker™ has the ability to combine scripts into powerful, flexible workflows.

Ordinary GeneLinker™ scripts are saved in a binary file format that can be read and written only by GeneLinker™ itself. MetaScripts are ASCII files that can be created using any text editor such as WordPad or NotePad.

GeneLinker's MetaScript language has three basic commands:

A combination of these commands can control the execution of a series of GeneLinker™ scripts to run a wide variety of standard analyses. Several pre-defined scripts and metascripts are included with GeneLinker as part of the tutorials on other features. Each tutorial now has a metascript associated with it that demonstrates the scriptable aspects of the tutorial workflow. Please note that automatic visualizations are turned off during meta-script execution.

A simple example of a metascript is as follows:

SERIAL
{
     scriptFileName1.gls
     scriptFileName2.gls
}

This meta-script applies the two scripts in serial fashion: that is, the output of the first script is used as the input to the next, so that they result in a single series of nodes being added to the Experiments navigator, as shown here from a script that applies value removal, missing value estimation and log normalization in SERIAL mode:

In contrast, a PARALLEL meta-script applies the scripts to the currently selected table, so their results are added to the Experiments navigator side-by-side, as shown here from a script that applies missing value removal, standardization and linear regression in PARALLEL mode:

The key to writing effective meta-scripts is keeping careful track of what the currently selected table is. When scripts are being run in SERIAL mode, the currently selected table is always the output of the script that has just completed. When scripts are being run in PARALLEL mode, the currently selected table is always the table that was the input to the previously run script.

The third mode is META, which just means that the filenames are to be interpreted as meta-script files rather than script files. This allows meta-scripts to be combined in a general and powerful way. META scripts are read in PARALLEL mode by default (that is, they all apply to the currently selected node, one after the other.) But by nesting META directives inside SERIAL or PARALLEL directives you can control the way META scripts are applied. For example:

SERIAL
{
	script1.gls	// comments start with "//" and go to end of line
	META
	{
		metascript1.glm  // applies to output of script1.gls
		metascript2.glm  // applies to output of metascript1.glm 
	}
	PARALLEL
	{
		script2.gls	// applies to output of script1.gls (see text)
		META
		{
			metascript3.glm // applies to output of script1.gls
		}
	}
}

The above example also illustrates the use of comments in meta-script files, which begin with // and continue to the end of the line. Blank lines in meta-script files are ignored.

META mode is designed so that scripts in meta-script files called via META mode are run exactly as if their text was embedded in the file that called them, with the exception that they are enclosed in curly braces, "{}", which has the side-effect of saving and restoring the currently selected table, as described below.

An opening curly brace, "{", can be thought of as saving the currently selected table, and a closing curly brace, "}", can be thought of as restoring the currently selected table to the saved value. This allows complete control over the table that each script is run on. For example, to change the previous illustration so that the last two scripts are run on the output of metascript2.glm:

SERIAL
{
	script1.gls
	META
	{
		metascript1.glm  // applies to output of script1.gls
		metascript2.glm  // applies to output of metascript1.glm 
		PARALLEL
		{
			script2.gls		// applies to output of metascript2.glm
			META
			{
				metascript3.glm // applies to output of metascript2.glm
			}
		}
	}
}

SERIAL and PARALLEL modes turn off META mode. META mode runs in parallel by default, but will "take over" whatever other mode is explicitly set. Thus, we can control how nested meta-scripts are run by wrapping them in different SERIAL or PARALLEL blocks:

SERIAL
{
	META
	{
		metascript1.glm  // applies to currently selected table
		metascript2.glm  // applies to output of metascript1.glm 
		PARALLEL		// turns off META mode
		{
			META
			{
				metascript3.glm // applies to output of metascript2.glm
				metascript4.glm // applies to output of metascript2.glm
			}
		}
	}
}

As well as the tutorial scripts there are several pre-defined scripts in the Tutorials directory that is installed with GeneLinker™. These are:

LogNormalize.gls
A workflow script that removes values less than or equal to zero and replaces them with median estimates, then takes log10.
RemoveNegatives.gls
A single step script that removes values less than or equal to zero
MedianEstimate.gls
A single step script that estimates missing values with the median. Genes with more than 10 percent missing values will be removed.
Log10.gls
A single step script that takes the base-10 log of the gene expression value.
LogNormalize.glm
A metascript that combines the previous three single step scripts into a workflow that is identical to the LogNormalize workflow script.

Working with these examples and trying some of your own is the best way to become familiar with GeneLinker's meta-scripting capability.

Error Messages

Every attempt has been made to provide useful and informative error messages from meta-scripts. The syntax requires that on the line following a META, SERIAL or PARALLEL directive there is an open curly brace, "{". If this is not the case there will be an error message displayed that includes the text of the line that was found. Commenting carefully can help identify the specific line causing the problem.

The most common error message results from the interpretation of a line as a file when in fact it is intended as meta-script syntax. Mis-spellings of META, SERIAL or PARALLEL will generate "file-not-found" errors. Likewise, META, SERIAL and PARALLEL must be in capital letters or they will be interpeted as filenames.

Actions

1. Click an item in the Experiments navigator. The item is highlighted.

2. Select Generate Script or Generate Workflow Script from the Tools menu. The Save As dialog is displayed.

3. Navigate to the folder where the file is to be saved.

4. GeneLinker™ provides a default file name, based on the selected item’s name, with an extension of .gls. You may rename the default path and file name by typing over them.

5. Click Save. The report is saved as a GeneLinker™ Script (.gls) file in the specified folder.

Related Topics:

Generating Scripts

Running Scripts