GFF Perl Object Modules

GFF::HomolGeneFeature - Perl extension for GFF Homology Gene Features


use GFF ;  # performs an implicit 'use GFF::HomolGeneFeature;'


Copyright (c) 1999 Created by Tim Hubbard

Augmented by Richard Bruskiewich

Sanger Institute, Wellcome Trust Genome Campus, Cambs, UK All rights reserved.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation.


GFF::HomolGeneFeature (derived from GFF) is a class of Perl object, derived (subclassed) from the GFF::GeneFeature object class, that encapsulates a single "homology" gene feature record ("line") in the General Feature Format ("GFF"). A GFF::GeneFeatureSet Perl object is the container object for a set of GFF::HomolGeneFeature objects. One can now graphically represent GFF::HomolGeneFeature objects as 'P' layout objects in the GFF::GifGFF module.

How to Read Method Protocols

Normal Perl data type notations are used for argument declarations in the method protocols. A backslash denotes argument passing by reference. Class methods are invoked using the 'class->method(args)' or 'method class args' Perl call formats.

Source code

The most current release of the Perl source code for this module is available here.

GFF::HomolGeneFeature Construction Methods

For all construction methods, an optional "$version" argument may be given which sets the created object to a specified GFF specification version. If this argument is not given, then the GFF class (package) default version is used (see GFF->version()).

new( $version )
Class method to construct a new, empty GFF::HomolGeneFeature object.
new_from_line( $line, $version )
Class method to parse a "homology" gene feature $line string into a GFF::HomolGeneFeature object (creates and returns the object reference).
new_from_msp( $line, $source, \$name_parse, $version )
Class method to parse a line into a GFF::HomolGeneFeature from MSPcrunch format (creates and returns the object reference). The $source string argument is used to fill the GFF source field with a tag name. The optional &name_parser argument is user-defined function which takes two arguments $group and \@array, where @array is assumed to be the (delimiter split) remainder of a line of data beyond the group field.
new_from_parse( $line, \&parser, $version )
Class method to parse the $line string into the GFF::HomolGeneFeature object using a user defined &parser function (creates and returns the object reference). The &parser should expect the (empty) GFF::HomolGeneFeature object reference as its first argument and the input line (string) as its second argument. So given, the function should perform the appropriate parsing of the input $line to load the GFF::HomolGeneFeature object with data.
copy( $version )
Method to duplicate the invoking GFF::HomolGeneFeature object.
fromGeneFeature( $version (See below for other arguments) )
A "type cast" method to convert an GeneFeature object into a GFF::HomolGeneFeature object.
Version 1 GFF protocol
fromGeneFeature( 1, $target, $start2, $end2 ) where the $target string is the [group] field name of the homologous sequence. The start coordinate of the match ("$start2") and end coordinate of the match ("$end2") should also be given.
Version 2 GFF protocol or better
fromGeneFeature( 2, $group ) where if the (optional) $group string argument is given, it is parsed as a string containing a Version 2 style semicolon delimited tag-value pair [group] field description of the homology match. The recommended Version 2 format for such group fields is described in the GFF homology feature specification. If the $group argument is omitted or null, then the group() hash from the GeneFeature object is dereferenced for 'Target' and 'E_value' tags with associated GFF::HomolGeneFeature specific values.

GFF::HomolGeneFeature Output Methods

dump( \*OUTPUT, $tab, $flen )
Method uses dump_string() to write a formatted output of a GeneFeature object to a filehandle, OUTPUT. If \*OUTPUT is not given, \*STDOUT is used. The "$tab" argument is a boolean flag, where a non-null value directs the use tab as the field delimiter in the output line; otherwise, use blank space (flag is assumed null if not specified). The "$flen" argument is a boolean flag, where a non-null value stipulates that the length of the current output line should be printed as an extra field at the end of the output line (assumed null if not specified. Note: the extra length of this field is *not* added to the displayed line size, but the extra field is tab delimited, if $tab is set).
dump_string( $tab )
Method to return a formatted output of a GFF::HomolGeneFeature object to a string. The optional "$tab" argument is a boolean flag, where a non-null value directs the use tab as the field delimiter in the output line; otherwise, use blank space (flag is assumed null if not specified).

GFF::HomolGeneFeature Access Methods

The various GFF record fields may be set or queried by (inherited) GeneFeature access methods. Additional GFF::HomolGeneFeature fields are available by the following access methods. All the methods can take a single string argument to set the variable. With or without an argument, the methods return the current (or newly set) value, as a string, except as specifically noted below:

(Version 2) homology target (is simply [group] name in Version 1 GFF).
start coordinate of the homologous match sequence.
end coordinate of the homologous match sequence.
percentage identity between query and match sequence.
(Version 2) expectation value.

GFF::HomolGeneFeature Analysis Methods

gap( $HGF2, $warn )
Method to determine the gap between the invoking and a second ("$HGF2") GFF::HomolGeneFeature object. Note: The method assumes that the invoking GFF::HomolGeneFeature object lies upstream (to the left of) the other object. If the optional "$warn" flag is defined and set to non-null, then the method prints additional warning diagnostics onto STDOUT, e.g. possible frameshifts and indel's between the two GFF::HomolGeneFeature objects. Returns a reference to a newly created GFF::HomolGeneFeature object representing the gap.

Revision history

4/5/99 - rbsk
renamed =>
3/3/99 - rbsk
extensively revised and improved the documentation added Version 2 GFF code, especially group() field management methods
* quick link -