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