ecoPCR.h 2.61 KB
Newer Older
Celine Mercier committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#ifndef ECOPCR_H_
#define ECOPCR_H_

#include <stdio.h>
#include <inttypes.h>

#include "../obidmscolumn.h"
#include "../obiview.h"
#include "../obitypes.h"

#ifndef H_apat
#include "./libapat/apat.h"
#endif

/*****************************************************
 * 
 *  Data type declarations
 * 
 *****************************************************/

/*
 * 
 *  Sequence types
 * 
 */

typedef struct {
	
	int32_t  taxid;
	char     AC[20];
	int32_t  DE_length;
	int32_t  SQ_length;
	int32_t  CSQ_length;
	
	char     data[1];
	
} ecoseqformat_t;

typedef struct {
	int32_t taxid;
	int32_t SQ_length;
	char    *AC;
	char    *DE;
	char    *SQ;
} ecoseq_t;

 
/*****************************************************
 * 
 *  Function declarations
 * 
 *****************************************************/

/*
 * 
 * Low level system functions
 * 
 */

60
int32_t is_big_endian(void);
Celine Mercier committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
int32_t swap_int32_t(int32_t);

void   *eco_malloc(int32_t chunksize,
                   const char *error_message,
                   const char *filename,
                   int32_t    line);
                   
                   
void   *eco_realloc(void *chunk,
                    int32_t chunksize,
                    const char *error_message,
                    const char *filename,
                    int32_t    line);
                    
void    eco_free(void *chunk,
                 const char *error_message,
                 const char *filename,
                 int32_t    line);
                 
80 81
void    eco_trace_memory_allocation(void);
void    eco_untrace_memory_allocation(void);
Celine Mercier committed
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128

#define ECOMALLOC(size,error_message) \
	    eco_malloc((size),(error_message),__FILE__,__LINE__)
	   
#define ECOREALLOC(chunk,size,error_message) \
        eco_realloc((chunk),(size),(error_message),__FILE__,__LINE__)
        
#define ECOFREE(chunk,error_message) \
        eco_free((chunk),(error_message),__FILE__,__LINE__)
        

/*
 * 
 * Error management
 * 
 */
 
  
void ecoError(int32_t,const char*,const char *,int);

#define ECOERROR(code,message) ecoError((code),(message),__FILE__,__LINE__)

#define ECO_IO_ERROR       (1)
#define ECO_MEM_ERROR      (2)
#define ECO_ASSERT_ERROR   (3)
#define ECO_NOTFOUND_ERROR (4)


/*
 * 
 * Low level Disk access functions
 * 
 */


int32_t    delete_apatseq(SeqPtr pseq);
PatternPtr buildPattern(const char *pat, int32_t error_max);
PatternPtr complementPattern(PatternPtr pat);

SeqPtr ecoseq2apatseq(char* sequence, SeqPtr out, int32_t circular);

char *ecoComplementPattern(char *nucAcSeq);
char *ecoComplementSequence(char *nucAcSeq);
char *getSubSequence(char* nucAcSeq,int32_t begin,int32_t end);


#endif /*ECOPCR_H_*/