bl_gff3_index_add(3)

NAME
bl_gff3_index_add() - Add a GFF3 feature to an in-memory index

LIBRARY
#include <biolibc/gff3-index.h>
-lbiolibc -lxtend

SYNOPSIS
int     bl_gff3_index_add(bl_gff3_index_t *gi, bl_gff3_t *feature)

ARGUMENTS
gi      Pointer to gff3_index_t object to which a record will be added
feature Pointer to GFF feature to be indexed

DESCRIPTION
The gff3_index_t class maintains an in-memory index of GFF features, containing the GFF fields SEQ_ID, START, and END, and the offset into the file as reported by ftell(3), or by bl_gff3_read(3), which records the file position of each GFF feature it reads. bl_gff3_index_add_pos(3) adds a GFF feature with file position file_pos to the index. Features of interest, perhaps only genes or only exons, can be added to the index on-the fly while reading through a GFF file with bl_gff3_read(3). The index can later be searched or traversed forward or backward to quickly find the location of a feature and reposition a FILE pointer to it using fseek(3). This system eliminates the need to inhale large numbers of GFF features into memory.

RETURN VALUES
BL_GFF3_INDEX_OK on success, BL_GFF3_MALLOC_FAILED if memory could not be allocated

EXAMPLES
bl_gff3_index_t  gi;
bl_gff3_t        feature;
if ( bl_gff3_read(&feature, gff3_stream, BL_GFF3_FIELD_ALL) == BL_READ_OK )
{
    if ( bl_gff3_index_add(&gi, &feature) != BL_GFF3_INDEX_OK )
        fprintf(stderr, "Error addind to GFF index.n");
}

SEE ALSO
bl_gff3_index_seek_reverse(3), bl_gff3_read(3)