This script allows people to explore and modify custom attributes. Two forms are used. The Main Form allows the user to display and modify data for attribute keys. The Group Form allows the user to display selected attribute keys.
Activity on this form that modifies the attributes requires specification of a user name so that it can be properly logged.
It uses the following CGI form parameters.
Name of the custom attribute, in the form of an entity name, a slash, and an attribute name. For a new attribute, it contains just the entity name.
Data type of the field.
Descriptive text about the field.
New field name. For a new field, this is the name it will be given. For an old field, this will be a new name to give to it. If this parameter is blank for an old field, then the field will not be renamed.
A file from which the new attribute values should be uploaded.
Name of the user making the request. This is put into the output log.
If specified, indicates the field is to be deleted.
If specified, indicates the field is to be created/updated/uploaded.
If specified, indicates the field is to be displayed.
Name of the group to display.
If specified, indicates the group's attribute keys should be displayed on a control form.
Name of a new group to add.
If specified, indicates we are to add a new group to the group list.
If specified, indicates attribute data is to be uploaded from the upload file.
If specified, indicates the current attribute is to have its values erased.
Each attribute key is divided into two parts: the real key and the sub key, each separated by a
double colon (::). This web page allows the user to manipulate real keys. The real portion of an
attribute key must be defined in advance. If it is not found in the database, any attempt to use the
key will fail.
To create a key, you must specify the key name, its data type, and a text description of what the key does. The data type and text description function only as comments, but they are important tools for users who wish to understand the attribute data.
This page also allows the user to create and delete groups. An attribute key can belong to many groups or no groups at all. Some groups are used by the NMPDR when constructing its search database. Others may indicate the type of object to which an attribute can be attached. These are used to implement some of the legacy methods from the old attribute system.
The number of attribute keys may potentially run into the thousands, so when the page initially comes up,
no attribute keys are displayed except for (new) (which is used to add new attributes). To display attributes,
use the group form at the bottom to either specify a group to display (SHOW) or to find all attribute keys that
begin with a certain string (FIND). If you press the FIND button without entering a character string
in the text box next to it, all attributes will be displayed.
All updates from this page are logged in the attribute log. If you attempt an update operation, you will get an error unless you've entered your name at the top of the page.
In addition, any file you upload will be saved on the attribute server. This saved file can be used
later to resubmit the operation from the command line using the AttrDBRefresh script.
To update an attribute key, select the attribute key in the top form, update its description, and click STORE.
To add a new attribute key, select the (new) entry in the top form, specify the key name in the
New Field Name box, specify a description of at least 10 words and a type, and click STORE.
To delete an attribute key, select the attribute key in the top form and click DELETE.
To erase all the values of an attribute key, select the attribute key in the top form and click ERASE.
To display all the values of an attribute key, select the attribute key in the top form and click SHOW.
You can upload new attribute values via the UPLOAD button. The file you upload must exist on the same
machine that is running the web browser. If you wish to upload from a file on the attribute server, you
need to go to the attribute server itself and execute the AttrDBRefresh command.
The file being uploaded must be in tab-delimited format with three or more fields on each line. The
first field is the ID of the object that has the attribute, the second field is the attribute key
(either the real key or a real key attached to a sub key), and all remaining fields are concatenated
together to form the value. Blank lines in the file, as well as lines beginning with a pound sign (#),
are treated as comments.
With the exception of genome numbers, feature IDs, and subsystem names, the object IDs must have a type
indication. So, while a genome can be specified as 100226.1, a family must be specified as
Family:aclame|cluster10. If all of the keys in an upload file are of the same type and the type is
not specified in the file, then you can specify the object type in the Object Type box. So, if your
file contains family IDs like
aclame|cluster10
aclame|cluster12
and so forth, you can specify an object type of Family, and the IDs will be corrected before being
put into the attribute database.
The default process for uploading data automatically erases the values currently attached to any real
keys encountered in the upload file. This behavior can be changed using the Upload Type box. Set
it to insert to add the new values to existing values in the database. Set it to replace for
normal operation.
my $html = DeleteGroup($ca, $cgi, $groupName);
Delete the specified attribute group.
CustomAttribute object for the attribute data.
CGI query object for generating the HTML.
Name of the group to delete.
Returns HTML describing the results of the deletion.
my $html = DisplayForm($ca, $cgi, \%keys, $mode, $filter, $user);
Display a form for modifying or updating the specified list of attribute keys.
Current CustomAttributes object.
CGI query object containing the active form parameters.
Reference to a hash of attribute keys. Each key is mapped to an n-tuple consisting of the data type, description, and parent groups.
Retrieval mode used to get the current list of attributes.
Filter string used to get the current list of attributes.
Name of the current user.
Returns the HTML for the display form, which includes a section for attribute control and a section for group management and searching.
my $html = UploadAttribute($ca, $cgi);
Upload attribute data from a tab-delimited file.
CustomAttributes object used to connect to the attribute database.
CGI object containing the query parameters.
Returns HTML text describing the upload operation.
my $html = EraseAttribute($ca, $cgi, $fieldName);
Erase all values for the specified attribute key. The key specified is a real key, without an attached subkey.
CustomAttributes object used to access the attribute database.
CGI query object containing the form parameters.
Name of the attribute key to erase.
Returns html text describing the operation.
my $html = DeleteAttribute($ca, $cgi, $fieldName);
Delete the specified attribute and return HTML describing the results.
CustomAttributes object used to access the attribute data.
CGI query object containing the parameters.
Name of the attribute key to delete.
Returns HTML describing the results of the deletion.
my $html = ShowAttribute($ca, $cgi, $fieldName);
Return HTML to display the values of the specified attributes.
CustomAttributes object used to access the attribute data.
CGI query object containing the parameters.
Name of the attribute key to display.
Returns HTML displaying the values of the specified attribute for each object to which it is attached.
my $html = StoreAttribute($ca, $cgi, $fieldName);
Update or create an attribute using information from a form.
CustomAttributes object used to access the attribute data.
CGI query object describing the attribute and the actions to be taken.
Name of the attribute key to update, or "(new)" for a new attribute key.
Returns HTML text describing the results of the update.
my $html = AddGroup($ca, $cgi);
Add a new group to the attribute database.
CustomAttributes object.
CGI query object containing the form data.
Returns HTML describing the results of the update.
my $okFlag = CheckUser($user);
Returns TRUE if the specified user can update attributes, otherwise it dies with an error message. In the current implementation, any nonblank user name will work.
Name of the user who is proposing to update
TRUE if the user can update attributes.