Difference between revisions of "Dart Scheme Functions"
(Imported from TWiki)
m (Move page script moved page DartSchemeFunctions to Dart Scheme Functions: Rename from TWiki to MediaWiki style)
Latest revision as of 23:00, 1 January 2017
- 1 Functions of the DART Scheme interpreter
- 1.1 Small objects (smobs)
- 1.2 Built-in functions
- 1.2.1 Logging and miscellaneous
- 1.2.2 Newick trees
- 1.2.3 Stockholm alignments
- 1.2.4 Mathematical functions
- 1.2.5 Individual programs in dart
- 1.3 The standard library
Functions of the DART Scheme interpreter
Natively implemented functions of the Dart Scheme interpreter, darts.
Small objects (smobs)
Certain commonly-encountered bioinformatics objects, serializable via standard file formats and implemented as C++ classes within XRATE, are exposed using Guile's "small object" (smob) mechanism. Currently, these types include Newick format trees and Stockholm format alignments. API calls are provided to construct these "smobs" by parsing strings (or files) in the appropriate format. The smobs may then be passed directly as parameters to XRATE API calls, or may be "unpacked" into Scheme data structures for individual element access. Guile encourages sparing use of smobs; consequently, smobs are used exclusively to implement bioinformatic objects that already have a broadly-used file format (Stockholm format alignments and Newick format trees). In contrast, formats that are newly-introduced by dart (xrate format grammars, alphabets and so forth) are all based on S-expressions, and so may be represented directly as native Scheme data structures.
Logging and miscellaneous
Logging directive; equivalent to -log x at the command line
Create a tree-smob from a Newick format string x
Create a tree-smob from a file x
Create a tree-smob from the tree encoded within alignment-smob x
(newick-to-file x y)
Write tree-smob x to file y in Newick format
List of all ancestors in the tree-smob x
List of all leaves in the tree-smob x
List of all branches in the tree-smob x
Converts a tree-smob x into a Scheme data structure
Converts a tree-smob x into a Newick format string
Create an alignment-smob from a Stockholm format string x
Create an alignment-smob from a Stockholm format file x
(stockholm-to-file x y)
Write alignment-smob x to Stockholm format alignment file y
Return the number of columns in alignment-smob x
Converts an alignment-smob x into a Scheme data structure
Converts an alignment-smob x into a Stockholm format string
Calculates the gamma function,
(gamma-density x alpha beta)
Calculates the gamma probability density,
(incomplete-gamma x alpha beta)
Calculates the incomplete gamma function, i.e. the integral of the gamma density up to x
(incomplete-gamma-inverse p alpha beta)
Calculates the inverse of the incomplete gamma function
(discrete-gamma-medians alpha beta K)
Returns the median rates of K equal-probability bins of the gamma distribution, as per Fig 1 of Yang &: Maximum likelihood phylogenetic estimation from DNA sequences with variable rates over sites: approximate methods. J. Mol. Evol. 1994;39:306-14.
(discrete-gamma-means alpha beta K)
Returns the mean rates of K equal-probability bins of the gamma distribution, as per Fig 1 of Yang &: Maximum likelihood phylogenetic estimation from DNA sequences with variable rates over sites: approximate methods. J. Mol. Evol. 1994;39:306-14.
Individual programs in dart
Validate the syntax of xrate format grammar x
(xrate-validate-grammar-with-alignment x y)
Validate the syntax of xrate format grammar x, using alignment-smob y to expand macro constructs
(xrate-estimate-tree x y)
Use xrate format grammar y to estimate a tree for alignment-smob x
(xrate-annotate-alignment x y)
Use xrate format grammar y to annotate alignments-smob x
(xrate-train-grammar x y)
Train xrate format grammar y on the list of alignment-smobs y
The standard library
How to include the standard library
Include the file xrate-stdlib.scm e.g. with the following
(&scheme (load-from-path "xrate-stdlib.scm"))
xrate format DNA alphabet specification.
(Note: a simple
define'd symbol, rather than a function.)
Uses the current definition of codon-translation-table to generate an xrate format grammar implementing the Nielsen Yang model of codon selection: Nielsen & Yang: Likelihood models for detecting positively selected amino acid sites and applications to the HIV-1 envelope gene. Genetics 1998;148:929-36.
Wrapper for xrate-NY-grammar that also generates an xrate-dna-alphabet.
An association list mapping codons to amino acids. For example, (a a a) maps to K.
-- Ian Holmes - 26 Jan 2012