home | help
bl_fasta_read(3)	    Library Functions Manual		bl_fasta_read(3)

NAME
     bl_fasta_read() - Read a FASTA record

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

SYNOPSIS
     int     bl_fasta_read(bl_fasta_t *record, FILE *fasta_stream)

ARGUMENTS
     fasta_stream    FILE stream from which FASTA data are read
     record	     Pointer to a bl_fasta_t structure to receive data

DESCRIPTION
     Read  a FASTA record from a FILE stream.  Each record must begin with a de-
     scription line (beginning with '>'), which is then followed by one or  more
     lines  of	sequence  data.  The end of the sequence is marked either by the
     next description line or EOF.  If desc_len and  seq_len  are  0  (e.g.  the
     structure	is  initialized  with  BL_FASTA_INIT or bl_fasta_init(3), or has
     been freed with bl_fasta_free(3), then memory is allocated for the descrip-
     tion and sequence.

     Otherwise, the existing allocated buffers are reused.  Hence, when  reading
     many  FASTA  records of the same length, only one allocation is needed.  In
     any case, the buffers are automatically enlarged if they  become  full  and
     automatically trimmed to the actual data size after reading is complete.

     Buffer   memory   should	be   freed   as  soon  as  possible  by  calling
     bl_fasta_free(3).

RETURN VALUES
     BL_READ_OK   upon	 successful   read   of   description	 and	sequence
     BL_READ_BAD_DATA  if something is amiss with input format BL_READ_EOF if no
     more data are available

EXAMPLES
     bl_fasta_t  rec = BL_FASTA_INIT;

     while ( bl_fasta_read(stdin, &rec) != BL_READ_EOF )
	 bl_fasta_write(stdout, &rec, BL_FASTA_LINE_UNLIMITED);
     bl_fasta_free(&rec);

SEE ALSO
     bl_fasta_write(3), bl_fastq_read(3), bl_fastq_write(3), bl_fasta_free(3)

								bl_fasta_read(3)

home | help