Files
annotate/src/sequtils/lxpack/include/libfasta.h
Eric Coissac d298385685 First commit - second part
Former-commit-id: 202296404e6a70f8ae96db99faffb456104c57e9
Former-commit-id: 118417735d2055683607df9809c9b721cc1b1bab
2015-10-02 21:13:16 +02:00

69 lines
2.3 KiB
C

/* ---------------------------------------------------------------- */
/* Copyright (c) Atelier de BioInformatique */
/* @file: libfasta.h */
/* @desc: sequence IO in fasta format / include file */
/* */
/* @history: */
/* @+ <Gloup> : Aug 92 : first version */
/* @+ <Gloup> : Nov 95 : last revised version */
/* ---------------------------------------------------------------- */
#ifndef _H_libfasta
#define _H_libfasta
/* ==================================================== */
/* Constantes */
/* ==================================================== */
#define FASTA_NAMLEN 64 /* max length of seq. name */
#define FASTA_COMLEN 512 /* max length of seq. comment */
#define FASTA_CHAR_PER_LINE 50 /* # of chars per line in output */
/* ==================================================== */
/* Macros standards */
/* ==================================================== */
#ifndef NEW
#define NEW(typ) (typ*)malloc(sizeof(typ))
#define NEWN(typ, dim) (typ*)malloc((unsigned)(dim) * sizeof(typ))
#define REALLOC(typ, ptr, dim) (typ*)realloc((void *) (ptr), (unsigned long)(dim) * sizeof(typ))
#define FREE(ptr) free(ptr)
#endif
/* ==================================================== */
/* Structures de donnees */
/* ==================================================== */
typedef struct { /* -- Sequence ---------------- */
int ok; /* error flag */
long length, /* longueur */
offset, /* offset */
bufsize; /* size of current seq buffer */
char name[FASTA_NAMLEN], /* nom */
comment[FASTA_COMLEN], /* commentaire */
*seq; /* sequence */
} FastaSequence, *FastaSequencePtr;
/* ==================================================== */
/* Prototypes (generated by mkproto) */
/* ==================================================== */
/* libfasta.c */
char *GetFastaName ( char *buffer );
char *GetFastaComment ( char *buffer );
FastaSequencePtr NewFastaSequence ( void );
FastaSequencePtr FreeFastaSequence ( FastaSequencePtr seq );
int ReadFastaSequence ( FILE *streamin, FastaSequencePtr seq );
int GetFastaSequence ( FILE *streamin, FastaSequencePtr seq );
void WriteFastaSequence ( FILE *streamou, FastaSequencePtr seq,
int char_per_line );
void RewindFastaDB ( FILE *streamin );
#endif