Table of Contents


Custom Attribute Control Panel

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.

fieldName

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.

dataType

Data type of the field.

notes

Descriptive text about the field.

newName

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.

newValueFile

A file from which the new attribute values should be uploaded.

user

Name of the user making the request. This is put into the output log.

Delete

If specified, indicates the field is to be deleted.

Store

If specified, indicates the field is to be created/updated/uploaded.

Show

If specified, indicates the field is to be displayed.

showGroup

Name of the group to display.

List

If specified, indicates the group's attribute keys should be displayed on a control form.

newGroup

Name of a new group to add.

Add

If specified, indicates we are to add a new group to the group list.

Upload

If specified, indicates attribute data is to be uploaded from the upload file.

Erase

If specified, indicates the current attribute is to have its values erased.

Notes on Using this Page

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.

Logging

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.

Common Tasks

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.

Uploading

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.

Script Methods

DeleteGroup

my $html = DeleteGroup($ca, $cgi, $groupName);

Delete the specified attribute group.

ca

CustomAttribute object for the attribute data.

cgi

CGI query object for generating the HTML.

groupName

Name of the group to delete.

RETURN

Returns HTML describing the results of the deletion.

DisplayForm

my $html = DisplayForm($ca, $cgi, \%keys, $mode, $filter, $user);

Display a form for modifying or updating the specified list of attribute keys.

varHash
ca

Current CustomAttributes object.

cgi

CGI query object containing the active form parameters.

keys

Reference to a hash of attribute keys. Each key is mapped to an n-tuple consisting of the data type, description, and parent groups.

mode

Retrieval mode used to get the current list of attributes.

filter

Filter string used to get the current list of attributes.

user (optional)

Name of the current user.

RETURN

Returns the HTML for the display form, which includes a section for attribute control and a section for group management and searching.

UploadAttribute

my $html = UploadAttribute($ca, $cgi);

Upload attribute data from a tab-delimited file.

ca

CustomAttributes object used to connect to the attribute database.

cgi

CGI object containing the query parameters.

RETURN

Returns HTML text describing the upload operation.

EraseAttribute

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.

ca

CustomAttributes object used to access the attribute database.

cgi

CGI query object containing the form parameters.

fieldName

Name of the attribute key to erase.

RETURN

Returns html text describing the operation.

DeleteAttribute

my $html = DeleteAttribute($ca, $cgi, $fieldName);

Delete the specified attribute and return HTML describing the results.

ca

CustomAttributes object used to access the attribute data.

cgi

CGI query object containing the parameters.

fieldName

Name of the attribute key to delete.

RETURN

Returns HTML describing the results of the deletion.

ShowAttribute

my $html = ShowAttribute($ca, $cgi, $fieldName);

Return HTML to display the values of the specified attributes.

ca

CustomAttributes object used to access the attribute data.

cgi

CGI query object containing the parameters.

fieldName

Name of the attribute key to display.

RETURN

Returns HTML displaying the values of the specified attribute for each object to which it is attached.

StoreAttribute

my $html = StoreAttribute($ca, $cgi, $fieldName);

Update or create an attribute using information from a form.

ca

CustomAttributes object used to access the attribute data.

cgi

CGI query object describing the attribute and the actions to be taken.

fieldName

Name of the attribute key to update, or "(new)" for a new attribute key.

RETURN

Returns HTML text describing the results of the update.

AddGroup

my $html = AddGroup($ca, $cgi);

Add a new group to the attribute database.

ca

CustomAttributes object.

cgi

CGI query object containing the form data.

RETURN

Returns HTML describing the results of the update.

CheckUser

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.

user

Name of the user who is proposing to update

RETURN

TRUE if the user can update attributes.