Chapter 6. Programming with AJAX

Table of Contents

6.1. Demonstration Applications
6.2. Programming Guides
6.2.1. AJAX
6.2.2. NUCLEUS
6.3. Handling ACD Files
6.3.1. Introduction
6.3.2. Program Initialisation
6.3.3. Retrieving ACD Values
6.3.4. Alternative ACD Retrieval Functions
6.3.5. Exiting Cleanly
6.4. Handling "Simple" ACD Datatypes
6.4.1. Introduction
6.4.2. AJAX Library Files
6.4.3. ACD Datatypes
6.4.4. ACD Data Definition
6.4.4.1. integer
6.4.4.2. float
6.4.4.3. boolean
6.4.4.4. toggle
6.4.4.5. string
6.4.4.6. array
6.4.4.7. range
6.4.4.8. Parameter Name
6.4.4.9. Common Attributes
6.4.5. AJAX Datatypes
6.4.6. ACD File Handling
6.4.6.1. Retrieval of "Simple" ACD Datatypes
6.4.6.2. Processing Command line Options and ACD Attribute
6.4.6.3. Memory Management
6.4.7. Object Memory Management
6.4.7.1. Default Object Construction
6.4.7.2. Default Object Destruction
6.4.7.3. Alternative Object Construction and Loading
6.4.8. Getting Range Object Elements
6.4.9. Querying Range Object Properties
6.4.10. Sequence Manipulation Functions
6.4.11. String Manipulation Functions
6.5. Handling Strings
6.5.1. Introduction
6.5.2. AJAX Library Files
6.5.3. ACD Datatypes
6.5.4. ACD Data Definition
6.5.4.1. Parameter Name
6.5.4.2. Common Attributes
6.5.5. AJAX Datatypes
6.5.6. ACD File Handling
6.5.6.1. Input String Retrieval
6.5.6.2. Processing Command line Options and ACD Attribute
6.5.7. String Object Memory Management
6.5.7.1. Default Object Construction
6.5.7.2. Default Object Destruction
6.5.7.3. Alternative Object Construction and Loading
6.5.8. String Referencing and Dereferencing Functions
6.5.9. String Assignment Functions
6.5.10. String Combination Functions
6.5.10.1. String append functions
6.5.10.2. String Join Functions
6.5.10.3. String Insert Functions
6.5.10.4. String Paste Functions
6.5.11. String Cut Functions
6.5.11.1. Simple cut functions
6.5.11.2. Removing characters from a string
6.5.11.3. Retaining characters in a string
6.5.11.4. String trimming functions
6.5.12. String Substitution Functions
6.5.13. String Query Functions
6.5.14. String Properties and Character Retrieval Functions
6.5.15. String Conversion Functions
6.5.16. String Formatting Functions
6.5.17. String Comparison Functions
6.5.18. String Search Functions
6.5.19. String Parsing Functions
6.5.20. String Iteration
6.5.21. String Tokenisation
6.5.22. Handling C-type (char *) Strings
6.5.22.1. C-type string constructor and destructor functions
6.5.22.2. C-type string comparison functions
6.5.23. Handling String Formatting
6.6. Handling Sequence Patterns
6.6.1. Introduction
6.6.2. AJAX Library Files
6.6.3. ACD Datatypes
6.6.4. ACD Data Definition
6.6.4.1. regexp
6.6.4.2. pattern
6.6.4.3. Parameter Name
6.6.4.4. Common Attributes
6.6.5. AJAX Datatypes
6.6.6. ACD File Handling
6.6.6.1. Input Pattern Retrieval
6.6.6.2. Alternative ACD Retrieval Functions
6.6.6.3. Processing Command line Options and ACD Attributes
6.6.6.4. Memory Management
6.6.7. Pattern Object Memory Management
6.6.7.1. Default Object Construction
6.6.7.2. Default Object Destruction
6.6.7.3. Alternative Object Construction and Loading
6.6.8. Read Functions
6.6.9. Getting Elements of Objects
6.6.10. Setting Elements of Objects
6.6.11. Debugging Functions
6.6.12. Miscellaneous Functions
6.7. Handling Sequences
6.7.1. Introduction
6.7.2. AJAX Library Files
6.7.3. ACD Datatypes
6.7.4. ACD Data Definition
6.7.4.1. Parameter Name
6.7.4.2. Common Attributes
6.7.5. AJAX Datatypes
6.7.6. ACD File Handling
6.7.6.1. Input Sequence Retrieval
6.7.6.2. Output Sequence Stream Retrieval
6.7.6.3. Alternative ACD Retrieval Functions
6.7.6.4. Processing Command line Options and ACD Attributes
6.7.6.5. Writing Sequences
6.7.6.6. Memory and File Management
6.7.7. Sequence Object Memory Management
6.7.7.1. Default Object Construction
6.7.7.2. Default Object Destruction
6.7.7.3. Alternative Object Construction and Loading
6.7.8. Getting and Setting Elements
6.7.8.1. Setting Single Values
6.7.8.2. Other Assignment Functions
6.7.8.3. Getting Single Values
6.7.9. Testing Sequence Properties
6.7.10. Calculating Sequence Properties
6.7.11. Sequence String Functions
6.7.12. Processing Sequences
6.7.13. Sequence Type Validation
6.7.14. Sequence Conversion
6.7.15. Handling Sequence Translation
6.7.16. Handling IUB Base Codes
6.7.16.1. Unambiguous codes
6.7.16.2. Ambiguity codes
6.7.16.3. Processing an IUB Base Code
6.7.16.4. Conversion of Base and Amino Acid Codes
6.7.17. DNA Calculations
6.7.17.1. General Functions for DNA Melting
6.7.17.2. Calculating DNA Melting and Annealing Temperatures and Energies
6.8. Handling Sequence Translation
6.8.1. Introduction
6.8.2. AJAX Library Files
6.8.3. ACD Datatypes
6.8.4. ACD Data Definition
6.8.5. AJAX Datatypes
6.8.6. ACD File Handling
6.8.6.1. Sequence or Menu Selection Retrieval
6.8.6.2. Memory Management
6.8.7. Translation Object Memory Management
6.8.7.1. Default Object Construction
6.8.7.2. Default Object Destruction
6.8.8. Translation
6.8.9. Miscellaneous Functions
6.9. Handling Features
6.9.1. Introduction
6.9.2. AJAX Library Files
6.9.3. ACD Datatypes
6.9.4. ACD Data Definition
6.9.4.1. Parameter Name
6.9.4.2. Common Attributes
6.9.5. AJAX Datatypes
6.9.6. ACD File Handling
6.9.6.1. Input Feature Retrieval
6.9.6.2. Output Feature Retrieval
6.9.6.3. Processing Command line Options and ACD Attributes
6.9.6.4. Memory Management
6.9.7. Memory Management
6.9.7.1. Default Object Construction
6.9.7.2. Default Object Destruction
6.9.7.3. Example
6.9.7.4. Alternative Object Construction and Loading
6.9.8. Reading Features
6.9.9. Writing Features
6.9.10. Output Feature Table Functions
6.9.11. Retrieving Elements of a Feature Object
6.9.12. Retrieving Elements of a Feature Table Object
6.9.13. Setting Elements of a Feature Object
6.9.14. Setting Elements of a Feature Table Object
6.9.15. Functions for Handling Feature Tags
6.9.16. Querying Properties of Features
6.9.17. Querying Properties of Feature Tables
6.9.18. Processing Features
6.9.19. Processing Feature Tables
6.9.20. Miscellaneous Functions
6.10. Handling Comparison Matrices
6.10.1. Introduction
6.10.2. AJAX Library Files
6.10.3. ACD Datatypes
6.10.4. ACD Data Definition
6.10.4.1. Parameter Name
6.10.4.2. Common Attributes
6.10.5. AJAX Datatypes
6.10.6. ACD File Handling
6.10.6.1. Input Comparison Matrix Retrieval
6.10.6.2. Output Comparison Matrix Retrieval
6.10.6.3. Processing Command line Options and ACD Attributes
6.10.6.4. Memory and File Management
6.10.7. Matrix Object Memory Management
6.10.7.1. Default Object Construction
6.10.7.2. Default Object Destruction
6.10.7.3. Alternative Object Construction and Loading
6.10.8. Functions for Retrieving the Properties of a Matrix.
6.10.9. Functions for Indexing a Matrix
6.10.10. Sequence Conversion
6.11. Handling Alignments
6.11.1. Introduction
6.11.2. AJAX Library Files
6.11.3. ACD Datatypes
6.11.4. ACD Data Definition
6.11.4.1. Parameter Name
6.11.4.2. Common Attributes
6.11.5. AJAX Datatypes
6.11.6. ACD File Handling
6.11.6.1. Input Alignment Retrieval
6.11.6.2. Output Alignment Retrieval
6.11.6.3. Memory and File Management
6.11.7. Alignment Object Memory Management
6.11.7.1. Default Object Construction
6.11.7.2. Default Object Destruction
6.11.7.3. Alternative Object Construction and Loading
6.11.8. Writing Alignments
6.11.9. Retrieving Elements of an Alignment Object
6.11.10. Setting Elements of an Alignment Object
6.11.11. Miscellaneous Functions
6.12. Handling Phylogenetic Data
6.12.1. Introduction
6.12.2. AJAX Library Files
6.12.3. AJAX Datatypes
6.12.4. ACD Datatypes
6.12.5. ACD Data Definition
6.12.5.1. discretestates
6.12.5.2. distances
6.12.5.3. frequencies
6.12.5.4. properties
6.12.5.5. tree
6.12.5.6. outdiscrete
6.12.5.7. outdistance
6.12.5.8. outfreq
6.12.5.9. outproperties
6.12.5.10. outtree
6.12.5.11. Parameter Name
6.12.5.12. Common Attributes
6.12.6. ACD File Handling
6.12.6.1. Phylogenetic Data Retrieval
6.12.6.2. Processing Command line Options and ACD Attributes
6.12.6.3. Memory and File Management
6.12.7. Phylogenetic Object Memory Management
6.12.7.1. Default Object Construction
6.12.7.2. Default Object Destruction
6.12.7.3. Alternative Object Construction and Loading
6.12.8. Reading Phylogenetic Data from File
6.12.9. Getting Elements of Phylogenetic Objects
6.12.10. Debug Functions
6.13. Handling Codon Usage Tables
6.13.1. Introduction
6.13.2. AJAX Library Files
6.13.3. ACD Datatypes
6.13.4. ACD Data Definition
6.13.4.1. Parameter Name
6.13.4.2. Common Attributes
6.13.5. AJAX Datatypes
6.13.6. ACD File Handling
6.13.6.1. Input Codon Usage Table Retrieval
6.13.6.2. Output Codon Usage Table Retrieval
6.13.6.3. Processing Command line Options and ACD Attributes
6.13.6.4. Memory and File Management
6.13.7. Codon Usage Table Object Memory Management
6.13.7.1. Default Object Construction
6.13.7.2. Default Object Destruction
6.13.7.3. Alternative Object Construction and Loading
6.13.8. Reading and Writing Codon Usage Tables
6.13.8.1. Reading a codon usage table
6.13.8.2. Writing a codon usage table
6.13.9. Getting and Setting Elements
6.13.9.1. Clearing a codon usage table
6.13.10. Calculated Properties
6.13.11. Back Translation
6.13.12. Miscellaneous Functions
6.14. Handling Files
6.14.1. Introduction
6.14.2. AJAX Library Files
6.14.3. ACD Datatypes
6.14.4. ACD Data Definition
6.14.4.1. infile
6.14.4.2. filelist
6.14.4.3. datafile
6.14.4.4. dirlist
6.14.4.5. directory
6.14.4.6. outfile
6.14.4.7. outdata
6.14.4.8. outdir
6.14.4.9. directory
6.14.4.10. Parameter Names
6.14.4.11. Common Attributes
6.14.5. AJAX Datatypes
6.14.6. ACD File Handling
6.14.6.1. Input File Retrieval
6.14.6.2. Output File Retrieval
6.14.6.3. Alternative ACD Retrieval Functions
6.14.6.4. Processing Command line Options and ACD Attributes
6.14.6.5. Memory and File Management
6.14.7. File and Directory Object Memory Management
6.14.7.1. Default Object Construction
6.14.7.2. Default Object Destruction
6.14.7.3. Alternative Object Construction and Loading
6.14.8. Reading from File
6.14.8.1. Buffered files
6.14.9. Writing to Files
6.14.9.1. General files
6.14.9.2. Binary files
6.14.9.3. Buffered files
6.14.10. Manipulating Files
6.14.11. Querying Properties of Files
6.14.11.1. Basic Properties
6.14.11.2. Output files
6.14.11.3. Buffered files
6.14.11.4. Directories
6.14.12. Querying and Manipulating File and Directory Names
6.15. Handling Application Reports
6.15.1. Introduction
6.15.2. AJAX Library Files
6.15.3. AJAX Datatypes
6.15.4. ACD Datatypes
6.15.5. ACD Data Definition
6.15.5.1. Parameter Name
6.15.5.2. Common Attributes
6.15.6. ACD File Handling
6.15.6.1. Report Retrieval
6.15.6.2. Processing Command line Options and ACD Attributes
6.15.6.3. Memory and File Management
6.15.7. Report Object Memory Management
6.15.7.1. Default Object Construction
6.15.7.2. Default Object Destruction
6.15.7.3. Alternative Object Construction and Loading
6.15.8. Preparing a Report
6.15.9. Example Report Application
6.15.9.1. ACD File
6.15.9.2. C Source Code
6.15.10. Report File Management
6.15.11. Setting Elements of a Report Object
6.15.12. Getting Elements of a Report Object
6.15.13. Debugging Report Objects
6.16. Handling Lists
6.16.1. Introduction
6.16.2. AJAX Library Files
6.16.3. ACD Datatypes
6.16.4. AJAX Datatypes for Handling Lists
6.16.5. Types of List
6.16.6. List Object Memory Management
6.16.6.1. Default Object Construction
6.16.6.2. Default Object Destruction
6.16.6.3. Managing Node Data
6.16.6.4. Alternative Object Construction and Loading
6.16.7. List Node Retrieval
6.16.8. List Iteration
6.16.8.1. List iterator construction
6.16.8.2. List iteration
6.16.8.3. List iterator destruction
6.16.9. Querying a List
6.16.10. List Editing
6.16.10.1. Adding nodes to a List
6.16.10.2. Removing nodes from a list
6.16.10.3. Reversing the order of nodes in a list
6.16.10.4. Garbage collection
6.16.11. List Sorting
6.16.11.1. String comparison functions
6.16.12. List Conversion
6.16.13. List Node Functions
6.17. Handling Arrays
6.17.1. Introduction
6.17.2. AJAX Library Files
6.17.3. AJAX Datatypes
6.17.3.1. char arrays
6.17.3.2. short arrays
6.17.3.3. unsigned int arrays
6.17.3.4. int arrays
6.17.3.5. float arrays
6.17.3.6. long arrays
6.17.3.7. double arrays
6.17.4. ACD Datatypes
6.17.5. ACD Data Definition
6.17.5.1. Parameter Name
6.17.5.2. Common Attributes
6.17.6. ACD File Handling
6.17.6.1. Input Array Retrieval
6.17.6.2. Processing Command line Options and ACD Attributes
6.17.6.3. Memory Management
6.17.7. Names of Functions
6.17.8. Array Object Memory Management
6.17.8.1. Default Object Construction
6.17.8.2. Default Object Destruction
6.17.8.3. Alternative Object Construction and Loading
6.17.9. Getting and Setting Array Elements
6.17.10. Sorting Arrays
6.17.11. Retrieving a C-type Array
6.18. Handling Tables
6.18.1. Introduction
6.18.2. AJAX Library Files
6.18.3. ACD Datatypes
6.18.4. AJAX Datatypes
6.18.5. Table Object Memory Management
6.18.5.1. Default Object Construction
6.18.5.2. Default Object Destruction
6.18.5.3. Alternative Object Construction and Loading
6.18.6. Table Hash Functions
6.18.7. Table Comparison Functions
6.18.8. Table Edit Functions
6.18.9. Table Query Functions
6.18.10. Table Map Functions
6.18.11. Print Functions
6.19. Handling Menus
6.19.1. Introduction
6.19.2. AJAX Library Files
6.19.3. ACD Datatypes
6.19.4. ACD Data Definition
6.19.4.1. list menu
6.19.4.2. selection menu
6.19.4.3. Parameter Name
6.19.4.4. Common Attributes
6.19.5. AJAX Datatypes
6.19.6. ACD File Handling
6.19.6.1. Menu Retrieval
6.19.6.2. Alternative ACD Retrieval Functions
6.19.6.3. Processing Command line Options and ACD Attributes
6.19.6.4. Memory Management
6.20. Handling Graphical Output
6.20.1. Introduction
6.20.2. AJAX Library Files
6.20.3. ACD Datatypes
6.20.4. ACD Data Definition
6.20.4.1. Parameter Name
6.20.4.2. Common Attributes
6.20.5. Program Initialisation
6.20.6. AJAX Datatypes
6.20.7. ACD File Handling
6.20.7.1. Output Graphics Retrieval
6.20.7.2. Processing Command line Options and ACD Attributes
6.20.7.3. Memory and File Management
6.20.8. Graphics Object Memory Management
6.20.8.1. Default Object Construction
6.20.8.2. Default Object Destruction
6.20.9. Graphics File Management
6.20.10. Initialisation Functions
6.20.11. Creating Windows
6.20.12. Drawing Functions
6.20.13. Setting Graphical Elements to Render
6.20.14. Retrieving Properties of Graphs
6.20.15. Calculated Properties of Graphs
6.20.16. Graph Debug Functions
6.20.17. Histograms
6.21. Handling Maths
6.21.1. Introduction
6.21.2. AJAX Library Files
6.21.3. ACD Datatypes
6.21.4. AJAX Datatypes
6.21.5. Conversion Functions
6.21.6. Random Number Functions
6.21.7. Rounding
6.21.8. Miscellaneous Functions
6.22. Handling System Code
6.22.1. Introduction
6.22.2. AJAX Library Files
6.22.3. ACD Datatypes
6.22.4. AJAX Datatypes
6.22.5. System Calls
6.22.6. Application Arguments
6.22.7. Cast Functions
6.22.8. File Functions
6.22.9. C Function Wrappers
6.22.10. Functions from ajutil.c/h
6.23. Handling Exception Messages
6.23.1. Introduction
6.23.2. AJAX Library Files
6.23.3. ACD Datatypes
6.23.4. AJAX Datatypes for Handling Messages
6.23.5. Message Functions
6.23.6. Querying the Status of Message Handling
6.23.7. Interacting with the user
6.23.8. Miscellaneous functions