comparison rDiff/mex/read.h @ 0:0f80a5141704

version 0.3 uploaded
author vipints
date Thu, 14 Feb 2013 23:38:36 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:0f80a5141704
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 3 of the License, or
5 * (at your option) any later version.
6 *
7 * Written (W) 2010-2011 Jonas Behr, Regina Bohnert, Gunnar Raetsch
8 * Copyright (C) 2010-2011 Max Planck Society
9 */
10
11
12 #ifndef __READ_H__
13 #define __READ_H__
14
15 #include <stdint.h>
16 #include <cctype>
17 #include <stdio.h>
18 #include <vector>
19 using std::vector;
20
21
22 class CRead {
23 public:
24 /** constructor
25 */
26 CRead();
27 ~CRead();
28
29 vector<int> block_starts;
30 vector<int> block_lengths;
31 char* read_id;
32 char* sam_line;
33 int start_pos;
34 char * strand;
35 int matches;
36 int mismatches;
37 int multiple_alignment_index;
38 bool left;
39 bool right;
40 bool reverse;
41
42 void get_coverage(int p_start_pos, int p_end_pos, uint32_t* coverage);
43 int get_last_position();
44 void get_reads_sparse(int p_start_pos, int p_end_pos, double* reads, uint32_t & reads_c, uint32_t row_idx);
45 void get_introns(vector<int>* introns);
46 void get_introns(vector<uint32_t>* intron_starts, vector<uint32_t>* intron_ends, vector<uint32_t>* block_len1, vector<uint32_t>* block_len2);
47 void get_acc_splice_sites(vector<int>* acc_pos);
48 void get_don_splice_sites(vector<int>* acc_pos);
49 int max_intron_len();
50 int min_exon_len();
51 bool operator==(const CRead& read) const;
52 void print();
53 void set_strand(char s);
54 int get_mismatches();
55 static bool compare_by_read_id(const CRead* read1, const CRead* read2)
56 {
57 if (!read1->read_id)
58 return true;
59 if (!read2->read_id)
60 return false;
61
62 int cnt1=0;
63 while (read1->read_id[cnt1]!='\0')
64 cnt1++;
65 int cnt2 = 0;
66 while (read2->read_id[cnt2]!='\0')
67 cnt2++;
68
69 return std::lexicographical_compare(read1->read_id,read1->read_id+cnt1,read2->read_id,read2->read_id+cnt2);
70 };
71 };
72 #endif