View on
Jason E. Stewart > Bio-Genex-2.6.0 > Bio::Genex::UserSequenceFeature



Annotate this POD

View/Report Bugs


Bio::Genex::UserSequenceFeature - Methods for processing data from the GeneX DB table: UserSequenceFeature


  use Bio::Genex::UserSequenceFeature;

  # instantiating an instance
  my $UserSequenceFeature = Bio::Genex::UserSequenceFeature->new(id=>47);

  # retrieve data from the DB for all columns

  # creating an instance, without pre-fetching all columns
  my $UserSequenceFeature = new Bio::Genex::UserSequenceFeature(id=>47);

  # creating an instance with pre-fetched data
  my $UserSequenceFeature = new Bio::Genex::UserSequenceFeature(id=>47, 'fetch_all'=>1);

  # retrieving multiple instances via primary keys
  my @objects = Bio::Genex::UserSequenceFeature->get_objects(23,57,98)

  # retrieving all instances from a table
  my @objects = Bio::Genex::UserSequenceFeature->get_all_objects();

  # retrieving the primary key for an object, generically
  my $primary_key = $UserSequenceFeature->id();

  # or specifically
  my $usf_pk_val = $UserSequenceFeature->usf_pk();

  # retreving other DB column attributes
  my $spc_fk_val = $UserSequenceFeature->spc_fk();

  my $provider_con_fk_val = $UserSequenceFeature->provider_con_fk();

  my $usf_name_val = $UserSequenceFeature->usf_name();

  my $usf_type_val = $UserSequenceFeature->usf_type();

  my $other_name_val = $UserSequenceFeature->other_name();

  my $other_type_val = $UserSequenceFeature->other_type();

  my $smp_fk_val = $UserSequenceFeature->smp_fk();

  my $owner_us_fk_val = $UserSequenceFeature->owner_us_fk();

  my $clone_name_val = $UserSequenceFeature->clone_name();

  my $con_fk_val = $UserSequenceFeature->con_fk();

  my $chromosome_val = $UserSequenceFeature->chromosome();

  my $start_position_val = $UserSequenceFeature->start_position();

  my $end_position_val = $UserSequenceFeature->end_position();

  my $sequence_val = $UserSequenceFeature->sequence();

  my $short_description_val = $UserSequenceFeature->short_description();


Each Genex class has a one to one correspondence with a GeneX DB table of the same name (i.e. the corresponding table for Bio::Genex::UserSequenceFeature is UserSequenceFeature).

Most applications will first create an instance of Bio::Genex::UserSequenceFeature and then fetch the data for the object from the DB by invoking fetch(). However, in cases where you may only be accessing a single value from an object the built-in delayed fetch mechanism can be used. All objects are created without pre-fetching any data from the DB. Whenever an attribute of the object is accessed via a getter method, the data for that attribute will be fetched from the DB if it has not already been. Delayed fetching happens transparently without the user needing to enable or disable any features.

Since data is not be fetched from the DB until it is accessed by the calling application, it could presumably save a lot of access time for large complicated objects when only a few attribute values are needed.


There are three different types of attributes which instances of Bio::Genex::UserSequenceFeature can access: raw foreign key attributes, Obect-Oriented foreign key attributes, and simple column attributes.

Raw Foreign Keys Attributes
Object Oriented Foreign Key Attributes

This mode presents foreign key attributes in a special way, with all non-foreign key attributes presented normally. Foreign keys are first retrieved from the DB, and then objects of the appropriate classes are created and stored in slots. This mode is useful for applications that want to process information from the DB because it automates looking up information.

Specifying the 'recursive_fetch' parameter when calling new(), modifies the behavior of this mode. The value given specifies the number of levels deep that fetch will be invoked on sub-objects created.

Simple Column Attributes


Class Bio::Genex::UserSequenceFeature defines the following utility variables for assisting programmers to access the UserSequenceFeature table.


If defined, $LIMIT will set a limit on any select statements that can return multiple instances of this class (for example get_objects() or any call to a ONE_TO_MANY or LOOKUP_TABLE foreign key accessor method).


This variable controls whether the class will cache any objects created in calls to new(). Objects are cached by primary key. The caching is very simple, and no effort is made to track whether different invocations of new() are being made for an object with the same primary key value, but with different options set. If you desire to reinstantiate an object with a different set of parameters, you would need to undefine $USE_CACHE first.

WARNING: variables other than those listed here are for internal use only and are subject to change without notice. Use them at your own risk.


It is possible to retrieve only the subset of attributes one chooses by simply creating an object instance and then calling the appropriate getter function. The object will automatically fetch the value from the DB when requested. This can potentially save time for large complicated objects. This triggers a separate DB query for each attribute that is accessed, whereas calling fetch() will retrieve all fields of the object with a single query.

For example:

  my $UserSequenceFeature = Bio::Genex::UserSequenceFeature->new(id=>47);
  my $val = $UserSequenceFeature->usf_pk();

The attribute's value is then cached in the object so any further calls to that attribute's getter method do not trigger a DB query.

NOTE: Methods may still return undef if their value in the DB is NULL.


The following methods can all be called without first having an instance of the class via the Bio::Genex::UserSequenceFeature->methodname() syntax.


new() accepts the following arguments:


Numeric or string value. The value of the primary key for looking up the object in the DB.


Used by generic functions to determine if a specified class is a linking table class. For Bio::Genex::UserSequenceFeature it returns 0, since it is not a linking table class.


This method returns the name of the column which is used as the primary key for this DB table. This method only exists for non-linking table classes, and for Bio::Genex::UserSequenceFeature it returns the value 'usf_pk';


Returns the name of the DB table represented by this class. For Bio::Genex::UserSequenceFeature it returns 'UserSequenceFeature';


This method returns a hashref that translates DB column names into human readable format.


This method returns a hashref that is a reverse lookup table to translate the human readable version of a DB column name back into the column_name. This is useful for preparing table output in CGI scripts:

    %column2name = %{$class->column2name()};
    if (exists $column2name{$_}) {
    # now that we've translated the names, we sort them
    @column_copy = sort @column_copy;
    # make a header element. 

This method returns a hashref that holds all the foreign key entries for the UserSequenceFeature table.


This method returns an array ref which holds the names of all the columns in table UserSequenceFeature.

    # first retrieve the data from the DB
    $object = $full_module_name->new(id=>$id);

    # now extract the data from the object
    foreach (@{$class->column_names}) {
    # we use this to temporarily relax the strict pragma
    # to use symbolic references
      no strict 'refs';
      $tmp_values{$_} = $object->$_;

    # back to our regularily scheduled strictness

This method inserts the data for the object into the database specified by the DB handle $dbh. To use this method, create a blank object with new(), set the attributes that you want, and then call insert_db().

  my $dbh = Bio::Genex::current_connection(USER=>$SU_USERNAME,
  my UserSequenceFeature = Bio::Genex::UserSequenceFeature->new();

NOTE: You must log into the DB with a user/password that has INSERT priveleges in the DB, otherwise you will get a DBI error.

WARNING: fetch() will not be called, so if you are using this method to insert a copy of an existing DB object, then it is up to you to call fetch(), otherwise, only the attributes that are currently set in the object will be inserted.


This method update the data for an object already in the database specified by the DB handle $dbh. To use this method, fetch an object from the DB, change the attributes that you want, and then call update_db().

  my $dbh = Bio::Genex::current_connection(USER=>$SU_USERNAME,
  my UserSequenceFeature = Bio::Genex::UserSequenceFeature->new(id=>43);

NOTE: You must log into the DB with a user/password that has INSERT priveleges in the DB, otherwise you will get a DBI error.

NOTE: Any modification of the primary key value will be discarded ('usf_pk' for module Bio::Genex::UserSequenceFeature).


This method is used to retrieve multiple instances of class Bio::Genex::UserSequenceFeature simultaneously. There are three different ways to invoke this method.

By passing in an @id_list, get_objects() uses each element of the list as a primary key for the UserSequenceFeature table and returns a single instance for each entry.

WARNING: Passing incorrect id values to get_objects() will cause a warning from Bio::Genex::UserSequenceFeature::initialize(). Objects will be created for other correct id values in the list.

get_all_objects() returns an instance for every entry in the table.

By passing an anonymous hash reference that contains the 'column' and 'name' keys, the method will return all objects from the DB whose that have the specified value in the specified column.

NOTE: All objects must have the 'id' parameter set before attempting to use fetch() or any of the objects getter functions.


The following methods can only be called by first having valid instance of class Bio::Genex::UserSequenceFeature.


This method triggers a DB query to retrieve ALL columns from the DB associated with this object.

WARNING: methods other than those listed here are for internal use only and are subject to change without notice. Use them at your own risk.


There are two major categories of foreign key accessor methods: Object Oriented foreign key methods, and raw foreign key methods.

Each foreign key column in the table is represented by two methods, one OO method and one raw method. The raw method enables fethcing the exact numeric or string values stored in the DB. The OO method creates objects of the class the fkey column refers to. The idea is that if only the numeric fkey value is desired, the raw fkey method can be used. If it is necessary to get attributes from the table referred to by the fkey column, then the OO method should be invoked, and the necessary methods on that object can be queried.

The names of the raw fkey methods is the same as the fkey columns in the DB table they represent (all fkey columns end in the suffix '_fk'). The OO methods have the same names as the column they represent, with the difference that they have the suffix '_obj' instead of '_fk'.

So for example, in class Bio::Genex::ArrayMeasurement the 'primary_es_fk' column is represented by two methods, the raw method primary_es_fk(), and the OO method primary_es_obj.

The following foreign key accessors are defined for class Bio::Genex::UserSequenceFeature:

@id_list = blasthits_fk()
@obj_list = blasthits_obj()

This is an attribute of type ONE_TO_MANY and refers to class Bio::Genex::BlastHits. The raw accessor method, blasthits_fk() returns a list of foreign key ids. The OO accessor method, blasthits_obj() returns a list of objects of class Bio::Genex::BlastHits.

@id_list = usf_externaldblink_fk()
@obj_list = usf_externaldblink_obj()

This is an attribute of type ONE_TO_MANY_LINK and refers to class Bio::Genex::USF_ExternalDBLink. The raw accessor method, usf_externaldblink_fk() returns a list of foreign key ids. The OO accessor method, usf_externaldblink_obj() returns a list of objects of class Bio::Genex::USF_ExternalDBLink.

@id_list = hotspots_fk()
@obj_list = hotspots_obj()

This is an attribute of type ONE_TO_MANY_LINK and refers to class Bio::Genex::HotSpots. The raw accessor method, hotspots_fk() returns a list of foreign key ids. The OO accessor method, hotspots_obj() returns a list of objects of class Bio::Genex::HotSpots.

Every foreign key in a DB table belongs to a certain class of foreign keys. Each type of foreign key confers a different behavior on the class that contains it. The classifications used in are:


These are the setter and getter methods for attributes in class Bio::Genex::UserSequenceFeature.

NOTE: To use the getter methods, you may either invoke the fetch() method to retrieve all the values for an object, or else rely on delayed fetching to retrieve the attributes as needed.


id() is a special attribute method that is common to all the Genex classes. This method returns the primary key of the given instance (and for class Bio::Genex::UserSequenceFeature it is synonomous with the usf_pk()method). The id() method can be useful in writing generic methods because it avoids having to know the name of the primary key column.


This is the primary key attribute for Bio::Genex::UserSequenceFeature. It has no setter method.

$value = spc_fk();

Methods for the spc_fk attribute.

$value = provider_con_fk();

Methods for the provider_con_fk attribute.

$value = usf_name();

Methods for the usf_name attribute.

$value = usf_type();

Methods for the usf_type attribute.

$value = other_name();

Methods for the other_name attribute.

$value = other_type();

Methods for the other_type attribute.

$value = smp_fk();

Methods for the smp_fk attribute.

$value = owner_us_fk();

Methods for the owner_us_fk attribute.

$value = clone_name();

Methods for the clone_name attribute.

$value = con_fk();

Methods for the con_fk attribute.

$value = chromosome();

Methods for the chromosome attribute.

$value = start_position();

Methods for the start_position attribute.

$value = end_position();

Methods for the end_position attribute.

$value = sequence();

Methods for the sequence attribute.

$value = short_description();

Methods for the short_description attribute.

WARNING: methods other than those listed here are for internal use only and are subject to change without notice. Use them at your own risk.


These classes are automatically generated by the script. Each class is a subclass of the Class::ObjectTemplate::DB class (which is in turn a subclass of Class::ObjectTemplate written by Sriram Srinivasan, described in Advanced Perl Programming, and modified by Jason Stewart). ObjectTemplate implements automatic class creation in perl (there exist other options such as Class::Struct and Class::MethodMaker by Damian Conway) via an attributes() method call at class creation time.


Please send bug reports to


on Mon Feb 5 21:23:54 2001 by /home/jasons/work/GeneX-Server/Genex/scripts/ --dir=/home/jasons/work/GeneX-Server/Genex --target=UserSequenceFeature --support=HotSpots --support=BlastHits --support=USF_ExternalDBLink


Jason E. Stewart (



syntax highlighting: