Writing Macros
Contents
Overview
One simple way to write
macros is to look at an already existing macros or at the Command
History and write a new macro in a similar fassion. Here are some rules
one should follow when writing macros:
- Know the difference
between Server and Client commands
- All Client commands begin with "@"; for example:
"@Exit"
- All commands are case insensitive (except when
specifying the file name and a path to a file)
- Blank lines are allowed in the macros for easy
readability
- Comment lines start with "#" ('pound sign') and
continue until the end of the line
Server macro commands
- Execute (Initialize, < file name> )
- Execute (Create Ladders)
- Execute (Match Unambiguous)
- Execute (Match Degenerate)
- Execute (Extend Segments, < minMatchScore >, <
minNumberOfMatches >, < gsGroup > )
- Execute (Match Weaker GSs)
- Execute (Match Inconsistent)
- Execute (Reason By Elimination)
- Execute (Finish Assignments)
- Execute (Match Cycle, CACBHA, 0.99, 10, 0.005)
- Execute (Incremental Match, CACBHA, 0.99, 10, 0.005)
- Execute (Constrain Segments, < typeFlag >, < linkFlag
> )
- Execute (Update Probabilities)
- Examine (List, Chemical Shifts Publish Format)
- Examine (List, Chemical Shifts BMRB Format)
- Examine (GS, F4, Chemical Shifts, Peaks, Possible Links, Linked
Segment, Possible Assignments, Probabilities, History)
- Examine (SS, Arg1, Prototype, Possible Assignments, Adjacent
Residues,
Degenerate Sites)
- Examine (Spectrum, HSQC, Parameters, Relations, Peaklist)
- Examine (List, All GSs)
- Examine (List, Unassigned GSs)
- Examine (List, Assigned GSs)
- Examine (List, Weak GSs)
- Examine (List, Unassigned Segments)
- Examine (List, Assigned Segments)
- Examine (List, Side Chain Roots)
- Examine (List, Overlapped GS Roots)
- Examine (List, Unassigned Residues)
- Save (List, Chemical Shifts Publish Format, path_filename)
- Save (List, Chemical Shifts BMRB Format, path_filename)
- Save (GS, F4, Chemical Shifts, Peaks, Possible Links, Linked
Segment, Possible
Assignments, Probabilities, History, path_filename)
- Save (SS, Arg1, Prototype, Possible Assignments, Adjacent
Residues, Degenerate Sites, path_filename)
- Save (Spectrum, HSQC, Parameters, Relations, Peaklist,
path_filename)
- Save (List, All GSs, path_filename)
- Save (List, Unassigned GSs, path_filename)
- Save (List, Assigned GSs, path_filename)
- Save (List, Weak GSs, path_filename)
- Save (List, Unassigned Segments, path_filename)
- Save (List, Assigned Segments, path_filename)
- Save (List, Side Chain Roots, path_filename)
- Save (List, Overlapped GS Roots, path_filename)
- Save (List, Unassigned Residues, path_filename)
- Analyze (Sequence)
- Analyze (Link Discrepancies, < selected value > )
- Analyze (Type Discrepancies, < selected value > )
- Analyze (Unexplained Peaks)
- Analyze (Assignments)
- GetData (Graph, Scatter, Validate, HN, N15, HSQC, HNcoHA)
- GetData (Graph, Histogram, Validate, HN, HSQC, HNcoCA)
- GetData (Graph, WishartPlot, CO)
- GetData (Graph, WishartPlot, CA)
- GetData (Graph, WishartPlot, HA)
- GetData (Graph, WishartPlot, Consensus)
Client macro commands
- @Connect (<Host>, <Port>) -
connects to the specified Host on a specified Port. Host must be a
string and Port must be a number. For example, after executing the
following command: @Disconnect - disconnects
from the host.
- @Exit - exits AutoClient, i.e. closes down all
the windows, if any are open.
-
@Save_Feedback_Window(<Directory +
File>) - saves the text in the panel of the main window of
AutoClient in the specified file located in the specified directory. If
directory does not exist, an error
message comes up. If the file already exists, it will be overwritten
with
the new information. The path of the file can be either absolute or
relative. Please see path specification
below for more
information.
-
@Save_Command_History(<Directory +
File>) - saves the current Command History in the specified file
located in the
specified directory. If directory does not exist, an error message
comes up.
If the file already exists, it will be overwritten with the new
information. The path of the file can be either absolute or relative.
Please see path specification
below for more information.
-
@Save_Last_Text_Window(<Directory + File>) - saves the text
from the most recently opened text window in the specified
file located in the specified directory. If directory does not exist,
an
error message comes up. If the file already exists, it will be
overwritten
with the new information. The path of the file can be either absolute
or
relative. Please see path specification
below for more information. If the GUI is set to "Off", then the text
window
will not be opened (shown), but its text can still be saved to a file.
The
text will be saved when either type of editor (JavaEditor or any system
text
editor) is selected.
- @Save_Last_Image(<Directory +
File>) - saves the image from the most recently opened graph
window or Connectivity
Map (CMap) (whichever was later) in the specified file located in the
specified
directory. If directory does not exist, an error message comes up. If
the
file already exists, it will be overwritten with the new information.
The
path of the file can be either absolute or relative. Please see path specification
below for more information. The
image is saved as a gif. If the GUI is set to "Off", then the graph
window or CMap will not be opened (shown), but the image can still be
saved to a file.
- @Set_Working_Dir(<Directory>)
- sets the working directory to the one specified by "Directory". If
directory
does not exist, an error message comes up.
- @Debug( True/False ) - sets the debug mode
to either True or False. The debug mode specifies
whether the transaction information (communication between Server and
Client)
is being printed to the console (if set to True), or if transaction
information
is NOT being printed to the console (if set to False; the default).
Note:
one can change the default debug mode using the command line option:
"-debug",
which sets the default debug mode to True.
- @Gui( On/Off ) - sets the GUI mode either to
"On" or "Off". When the GUI mode is On, all
the windows that usually open are visible. On the other hand, if the
GUI
mode is Off, none of the windows come up.
- @Open_Window(<WindowTitle>) -
opens a window specified by the WindowTitle. The windows that can be
opened are: Connectivity Map (specified by "CMap"), Command History
(specified
by "CommandHistory"), Empty Text Editor (specified by
"EmptyTextEditor") and
Preferences (specified by "Preferences").
- @Close_Window(<WindowTitle>) -
closes a window specified by the WindowTitle. The windows that can be
closed are: Connectivity Map (specified by "CMap") and Command History
(specified
by "CommandHistory").
- @Run_Macro(<Directory + MacroFile>) -
opens and runs a macro. If the macro file does not exist, an error
message
comes up. By convension, all macro files end with .mac extension,
but one can set
new convension and create different extensions based on needs. The path
of the macro file can be either absolute or relative. Please see path specification below for more
information. When specifying a relative path for the macro files, the
path is NOT relative
to the working directory. The macro files are searched first in the
directory
specified by the user in the Preferences
Dialog
as "User's Macros Directory". If the macro is in this
directory, then
it is executed. If, the macro is not found in this directory or if the
user
didn't specify this directory in the Preferences Dialog, then the macro
is searched in the AutoDir/Macros/ directory. If the macro is not found
at all, an error message comes up. The user can create their own
Default/Refined
Execution macros (and other macros as well) and save them in their own
Macros/
directory (even save macros with the same name as in AutoDir/Macros/
directory).
Then, if the "User's Macros Directory" is specified in the Preferences
Dialog,
then the macros located in the user specified directory are executed
(if
exist). If the "User's Macro Directory" is NOT specified, then the
macros
located in AutoDir/Macros/ directory are executed. When calling macros
within
macros, please be careful not to create 'an infinite loop', where the
macros
continuously call each other. In the future release of AutoAssign,
there
will be a check to see if there is a possibility of an infinite loop.
Please
note that java is platform independent and will accept two types of
file
seperators: "/" or "\", depending on the platform.
- @Open_CMap_Image_Window( <Directory
+ File>) - opens a window where the user can modify the image of
CMap. An Image
Input File is read in and the image of CMap is created. The path of the
Image Input File can be either absolute or relative. Please see path specification below for more
information. A
blank CMap Image Window can be opened using @Open_CMap_Image_Window( ).
- @Close_CMap_Image_Window( ) -
closes a CMapImage window that was opened most recently.
- @Load_CMap_Image_File( <Directory +
inputFile>) - opens the image input file specified in the
command in the CMapImage window
that was most recently opened. The path of the Image Input File can be
either
absolute or relative. Please see path
specification
below for more information.
- @Set_CMap_Image_Residue_Lines(
over/under/none
) - sets the option to draw the lines between the residues to be
drawn over
or under the resonance and NOESY links and Wishart Histograms, or not
drawn
at all. Only one option can be specified at a time.
- @Set_CMap_Image_Scale( [50,1000] )
- sets the scale of an image in the CMapImage Window. The scale can
range
from 50 to 1000. Only integer values are accepted as a scale.
- @Set_CMap_Image_Font( [5, ?] )
- sets the font size of the text in the image in the CMapImage Window.
The font can range from 5 to a very large number. Only integer values
are
accepted as a font.
- @Set_CMap_Image_Color( colorname,
<Red>, <Green>, <Blue>) / @Set_CMap_Image_Color( colorname,
<Gray>) - sets the color of the specified option (intra,
seq, phase, etc.) in the
image in the CMapImage Window. Only one option can be specified at a
time.
The color is specified using the RGB Color Model, where each color is
represented
as a combination of Red, Green abd Blue. 'Red', 'Green' and 'Blue' are
integers
ranging from 1 to 256. Or, the color can be specified using the gray
value
also ranging from 1 to 256. The valid colornames
are: intra, seq, phase, reslines, noesyweak, noesymed, noesystrong,
histfill,
histoutline, jdeterm, jindeterm, graphica, graphicb, graphicc,
graphicd,
helix, sheet, turn, coil, text, background.
- @Set_CMap_Image_Color_Scheme(scheme_name)
- sets the color scheme for the image in the CMapImage
Window. Valid
color schemes are "bw", "color", and "inverse".
- @Set_CMap_Image_Row_Order( rowname)
- sets the order that the row will appear in the image in the
CMapImage
Window. The rownames given are brought to the top, in the
specified
order. All other rows keep their respective order starting after
the
given rows.
- @Set_CMap_Image_Size( rowtype,
<integer> ) - sets the size of the specified option
(resonance, noesy, etc.) in the
image in CMapImage Window. Only one option can be specified at a time.
When
"resonance", "noesy" or "wishart" options are specified, the height of
each
one is set. When "width" is specified, the width of all rows is set.
The
height/width are specified in pixels. The label length is in
characters.
The valid rowtypes are: resonance, noesy, j, ss,
bargraph, graphic, width, label.
- @Set_CMap_Image_Visible_Rows(
resonance/noesy/wishart/misc/rowname ) - sets which set(s)
of rows is visible in the image in CMapImage Window.
More than one option can be specified, seperated by commas. Any set of
rows
not specified in the command will not be visible. Specific rownames
used will cause those rows not to be shown.
- @Save_CMap_Image( <Directory +
outputFileName>
) - saves the current image in CMapImage Window as a GIF to the
output file
specified in the command. The path of the output GIF file can be either
absolute or relative. Please see path
specification below for more information.
- @Save_Wishart( <Directory +
outputFile>
) - saves the data calculated for the Wishart Histograms to a text
file specified
by the output file in the command. The input file used for the
calculation
is from the most recently opened CMapImage Window. Note that if no file
was
read in inside the most recently opened CMapImage Window,
@Save_Wishart(<Directory
+ outputFile>) command will generate an error that no input file was
specified.
In the second version of the command, an Image Input File can be
specified
along with the output file (CMap Image Window doesn't have to be
opened).
The path of the input or output files can be either absolute or
relative.
Please see path specification
below for more
information.
Path
Specification
There are two ways to specify the
location of the file: (1) absolute,
or (2) relative. The absolute path specifies the full path of the file.
The relative path specifies the path relative to the current working
directory. An example of the absolute path is:
/home/user/saves/myFile.txt
An example of a relative path is:
../macros/newMacroFile.txt
If the working directory was set to:
"/home/user/saves/", then specifying
"../macros/newMacroFile.txt" saves the file "newMacroFile.txt" in the
following
directory: "/home/user/macros/". ".." imply that one has to go one
directory
up from the working directory. If the path was "../../user2/", then one
will go up 2 directories.
Here is another example of a relative
path:
help/newHelpFile.txt
If the working directory was set to:
"/home/user/saves/", then specifying
"help/newHelpFile.txt" saves the file "newHelpFile.txt" in the
following
directory: "/home/user/saves/help/". Since the path does not have a
file
seperator ("/" or "\" depending on the operating system) at the
beginning,
the path must be relative to the working directory.