|
These
functions are found in the Yup.Tools.misc module. The required import
statement is some variant of: from
Yup.Tools.misc import *.
The yuppath function returns the
absolute path to a subdirectory in the Yup package. (Actually, it works
for any package not just Yup.) The function takes one argument subpack
which has the default value of 'Yup'. The subdirectory must contain the
pseudo-module __init__ (i.e., a file named __init__.py). For example, in the
Harvey Lab at Georgia Tech., this is what we get from various uses of
this function:
>>> from Yup.Tools.misc import yuppath >>> yuppath() '/usr/freeware/lib/python2.1/site-packages/Yup' >>> yuppath( 'Yup.Taro' ) '/usr/freeware/lib/python2.1/site-packages/Yup/Taro' >>> yuppath( 'Yup.Models.TestTube' ) '/usr/freeware/lib/python2.1/site-packages/Yup/Models/TestTube' >>> yuppath( 'YUP' ) Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/freeware/lib/python2.1/site-packages/Yup/Tools/misc.py", line 17, in yuppath raise RuntimeError, subpack + ' does not exist' RuntimeError: YUP does not exist >>>
|
You will
get different results depending on where you install the Yup package.
The datasource function is used to locate
standard parameter libraries.
The Yup
package contains standard libraries of force constants. Each library is
contained in a sub-directory of Yup/Data/ and the name of the
sub-directory is the same as that of the library. The location of Yup/
varies from machine to machine. This function provides a portable way
of referencing standard libraries.
The
function takes two optional arguments, the name of the standard library
(which is always capitalized, default is None), and the root of the
package (default is 'Yup'). The output is a string containing the
absolute path to the directory containing the standard library. Yup
expects to find a number of files in this directory. See fpf.
The
second argument can be specified to reference a developmental package,
for example one rooted at 'devYup'.
This
function can be called without an argument; the return will be the full
pathname to the directory containing the Null library. This library
serves as a template for the parameter file. There are no constants.
Example:
>>> from Yup.Tools.misc import datasource >>> from Yup.Taro.AtomMap import * >>> Root = AtomMap( datasource( 'rrRNAv1' ) )
|
In this
example, the datasource() function is used to construct the absolute
pathname of the standard library named 'rrRNAv1' and this name is
supplied as the only argument to the AtomMap constructor. This creates
the top of an atom hierarchy (and saved to the variable Root) and the
Atom Map that is created is associated with the 'TestTube' library of
force constants.
Another
example, if the model 'Protein' is under development in a personal
package named 'devYup':
>>> from Yup.Tools.misc import datasource >>> datasource( 'Protein', 'devYup' )
|
The modelguipath function is used to locate
the standard plugin directory for individual models. This is:
Yup/YupSee/ModelGUIModules/. YupSee looks for the GUI code for each
model type in this sub-directory. This function has no parameters.
The containsAny function is used to
determine if the first argument contains any component from the set in
the second argument.
|