bl_gff_index_seek_reverse(3)

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

SYNOPSIS

int bl_gff_index_seek_reverse(bl_gff_index_t *gi, FILE *stream, bl_gff_t *feature, uint64_t feature_count, uint64_t max_nt)

ARGUMENTS
gi              Pointer to the gff_index_t object used to search
feature         Feature from which search starts
feature_count   Number of indexed features to back up from feature
max_nt          Maximum number of nucleotides to back up

DESCRIPTION
The gff_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_gff_read(3), which records the file position of each GFF feature it reads. bl_gff_index_seek_reverse(3) moved the FILE pointer stream to feature_count indexed features upstream of feature, or to the most upstream feature within max_nt of feature. A max_nt of 0 indicates no maximum distance, i.e. the search will proceed to feature_count features behind feature or to the beginning of the file, whichever is encontered first. The max_nt parameter refers to the END of a feature, i.e. bl_gff_index_seek_reverse() will back up to a feature that overlaps the position of feature minus max_nt. The START position of the feature moved to could be more than max_nt nucleotides behind the START of feature. Note that this function counts only *indexed* features, i.e. those added to gi by bl_gff_index_add(3), not all features in the GFF file. An application may only add genes to the index, for example, ignoring exons, etc.

RETURN VALUES
The offset into stream of the feature moved to. This is only informative, since the fseek() operation has already been done.

EXAMPLES
bl_gff_index_t  gi;
bl_gff_t        feature;
long            new_pos;
new_pos = bl_gff_index_seek_reverse(&gi, &feature, 4, 200000);

SEE ALSO
bl_gff_index_add(3), fseek(3), bl_gff_read(3)