X-Git-Url: https://git.donarmstrong.com/?p=samtools.git;a=blobdiff_plain;f=faidx.h;h=1fb1b1fcfab22385f3463c2138fcf1bf6533fef8;hp=98c60e4cf1dfbc69e9d6014d96174ca2adaca2e8;hb=307c147168f7154e3755712797078c513e0b242a;hpb=f93dae0d03856955f9424e8b2aaf261304ca647e diff --git a/faidx.h b/faidx.h index 98c60e4..1fb1b1f 100644 --- a/faidx.h +++ b/faidx.h @@ -46,9 +46,10 @@ extern "C" { /*! @abstract Build index for a FASTA or razip compressed FASTA file. @param fn FASTA file name + @return 0 on success; or -1 on failure @discussion File "fn.fai" will be generated. */ - void fai_build(const char *fn); + int fai_build(const char *fn); /*! @abstract Distroy a faidx_t struct. @@ -74,6 +75,27 @@ extern "C" { */ char *fai_fetch(const faidx_t *fai, const char *reg, int *len); + /*! + @abstract Fetch the number of sequences. + @param fai Pointer to the faidx_t struct + @return The number of sequences + */ + int faidx_fetch_nseq(const faidx_t *fai); + + /*! + @abstract Fetch the sequence in a region. + @param fai Pointer to the faidx_t struct + @param c_name Region name + @param p_beg_i Beginning position number (zero-based) + @param p_end_i End position number (zero-based) + @param len Length of the region + @return Pointer to the sequence; null on failure + + @discussion The returned sequence is allocated by malloc family + and should be destroyed by end users by calling free() on it. + */ + char *faidx_fetch_seq(const faidx_t *fai, char *c_name, int p_beg_i, int p_end_i, int *len); + #ifdef __cplusplus } #endif