Implements a CCP4i def file based database. Requires that the CCP4 environment is set up in order to work. Usage example:
d = ccp4i.database("PROJECT","/home/pjx/PROJECTS/myProject") # Instantiate a database # object d.open() # Open the database and lock the source file d.open(force=True) # Open the database, overriding any lock d.save() # Save the database contents to the source file d.close() # Close the database, saving contents and releasing the lock
This is not the full range of methods.
Implements a general CCP4i-type lockfile, which can be associated with arbitrary file-based resources. Used by the directories class, and as the base class for the dblockfile class. Should not be required directly.
An extension of the lockfile class that provides the specific lockfile functionality for the database.def files of the database class. It is used by the database class. Should not be required directly.
Provides methods for reading and writing directories.def. Requires that the CCP4 environment is set up in order to work. Usage example:
d = ccp4i.directories() # Instantiate a directories object that will use # user's default directories.def fiel d = ccp4i.directories(filen="./directories.def") # As above but use the named file d.load() # Load the data and lock the file d.load(force=True) # Load the data and grab any existing lock d.listprojects() # Return a list of the project names % ['CSTAFF', 'JUNK', 'RCSB_DEMOS', 'CHOOCH', 'PROJECT', ... d.projectdir("PROJECT") # Return the directory path for a project % '/home/pjx/PROJECTS/myProject' d.save(filen="...") # Save data to the named file d.release() # Finish using the data; release the lock on the base file
These are not the whole range of methods. Also the save and release methods haven't been fully thought out yet so may not behave as expected. The directories class should probably also support a "read-only" mode, and a "refresh" operation (which would re-read the data from the source file).
Implements an interface to CCP4i .def files. This class is used in the database and directories classes to interface to the underlying def files. Should not be required directly at present.
Provides methods for generating "history links" between jobs in a CCP4i database object.
GetAbsolutePath: Return the absolute path - assume that relative paths are rooted at the current working directory.
MakeDir: Create a new directory.
DirExists: Check for the existence of a directory.
FileExists: Check for the existence of a file.
GetFileRootname: Return the rootname of a filename.
GetUserId: Return the username of the current user.
GetDate: Return the current date.
GetDefDate: Return the current date for a def file header.
GetPid: Return the current process id.
GetPlatform: Return the platform information.
GetOPSYS: Return 'WINDOWS' or 'UNIX', depending on the operating system.
GetOpsys: Return 'windows' or 'unix', depending on the operating system.
SearchPath: Return the full path name for a CCP4i code or data file.
GetDotCCP4: Return the location of the .CCP4 directory.
GetEnvVar: Return the value of an environment variable.
GetDbDir: Return the name of the CCP4i database directory for a project.
GetDbFile: Return the name of the database.def file.
MakeDbFile: Make a new CCP4i database.def file.
tokenise: Tokenise a string and return a list.