ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/gclib/tophat_cpp/map2gtf.h
Revision: 165
Committed: Fri Feb 10 01:04:05 2012 UTC (8 years, 1 month ago) by gpertea
File size: 1991 byte(s)
Log Message:
sync back with Daehwan. Test bam_merge for memory leaks!

Line File contents
1 /*
2 * Author: Harold Pimentel
3 * Contact: http://cs.berkeley.edu/~pimentel
4 * Date: June 10, 2011
5 */
6
7 #ifndef _MAP2GTF_H_
8 #define _MAP2GTF_H_
9
10 #ifdef HAVE_CONFIG_H
11 #include <config.h>
12 #endif
13
14 #include <cassert>
15 #include <cstdlib>
16 #include <cstring>
17 #include <fstream>
18 #include <iostream>
19 #include <string>
20 #include <sstream>
21 #include <vector>
22
23 #include <bam/bam.h>
24 #include <bam/sam.h>
25
26 #include <seqan/sequence.h>
27
28 #include <getopt.h>
29 #include <unistd.h>
30
31 #include "bwt_map.h"
32 #include "common.h"
33 #include "gff.h"
34
35 #define MAX_READ_NAME_LEN 2048
36
37 /*
38 * XXX: This class currently assumes someone used the script in TopHat to map
39 * the reads already. It also depends on that same format.
40 */
41 class Map2GTF
42 {
43 public:
44 Map2GTF(std::string gtf_fname, std::string sam_fname);
45 ~Map2GTF();
46 // Write out to a BAM file
47 void convert_coords(std::string out_fname, std::string sam_header);
48
49 private:
50 GffReader gtfReader_;
51
52 std::string gtf_fname_;
53 std::string reads_fname_;
54
55 FILE* gtf_fhandle_;
56 FILE* reads_fhandle_;
57 FZPipe reads_pipe_;
58
59 ReadTable readTable_;
60 RefSequenceTable refSeqTable_;
61
62 HitFactory* hitFactory_;
63 HitStream* hitStream_;
64
65 Map2GTF(); // Don't want anyone calling the constructor w/o options
66 };
67
68 class TranscriptomeHit {
69 public:
70 BowtieHit hit;
71 GffObj* trans;
72 vector<string> aux_fields;
73 TranscriptomeHit(GffObj* t=NULL):hit() {
74 trans=t;
75 }
76 bool operator==(const TranscriptomeHit& th) const {
77 return (th.hit == hit);
78 }
79 bool operator<(const TranscriptomeHit& th) const {
80 return (th.hit < hit);
81 }
82
83 };
84
85
86 void trans_to_genomic_coords(const char* read_name, HitFactory* hitFactory,
87 const BowtieHit& in, TranscriptomeHit& out);
88
89 bool get_read_start(GList<GffExon>* exon_list, size_t gtf_start,
90 size_t& genome_start, int& exon_idx);
91
92 void print_trans(GffObj* trans, const BowtieHit& in, size_t rem_len,
93 size_t match_len, size_t cur_pos, size_t start_pos);
94
95 #endif /* _MAP2GTF_H_ */

Properties

Name Value
svn:executable *