d2c55b698b048b631c94990332fe2bd130919394
[qpalma.git] / tools / data_tools / read.h
1 #ifndef __READ_H__
2 #define __READ_H__
3
4 typedef struct read {
5 int chr;
6 int pos;
7 unsigned long id;
8 char strand;
9 int mismatch;
10 int occurrence;
11 int size;
12 int cut;
13
14 char* seq;
15 char* prb;
16 char* cal_prb;
17 char* chastity;
18 } Read;
19
20 void init_read(struct read *r, int size) {
21 r->chr = 0;
22 r->pos = 0;
23 r->id = 0;
24 r-> strand = ' ';
25 r->mismatch = 0;
26 r->occurrence = 0;
27 r->size = size;
28 r->cut = 0;
29
30 r->seq = malloc(sizeof(char)*(r->size));
31 r->prb = malloc(sizeof(char)*(r->size));
32 r->cal_prb = malloc(sizeof(char)*(r->size));
33 r->chastity = malloc(sizeof(char)*(r->size));
34 }
35
36 void create_read(Read* newRead, int chr,int pos, char* seq, unsigned long id, char strand, int mismatch, int occurrence, int size, int cut, char* prb, char* cal_prb, char* chastity) {
37 newRead->chr = chr;
38 newRead->pos = pos;
39 newRead->id = id;
40 newRead-> strand = strand;
41 newRead->mismatch = mismatch;
42 newRead->occurrence = occurrence;
43 newRead->size = size;
44 newRead->cut = cut;
45
46 newRead->seq = malloc(sizeof(char)*(size));
47 newRead->prb = malloc(sizeof(char)*(size));
48 newRead->cal_prb = malloc(sizeof(char)*(size));
49 newRead->chastity = malloc(sizeof(char)*(size));
50
51 strncpy(newRead->seq,seq,size);
52 strncpy(newRead->prb,prb,size);
53 strncpy(newRead->cal_prb,cal_prb,size);
54 strncpy(newRead->chastity,chastity,size);
55 }
56
57
58
59 #endif // __READ_H__