-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSam.h
More file actions
executable file
·49 lines (37 loc) · 1.17 KB
/
Copy pathSam.h
File metadata and controls
executable file
·49 lines (37 loc) · 1.17 KB
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
#ifndef SAM_H
#define SAM_H
#define JUNCTION_COORD_TOL 5 // bp around the splicing junction for a spanning read
#define MIN_INTRON_SPAN 3 // min bp in the intron for an unspliced read to be considered non-spanning
#include "samtools/sam.h"
#include "common.h"
typedef std::pair <size_t, size_t> junction; // donor start (0-based) ; acceptor end (0-based, past-the-end)
#include <iostream>
#include <string>
class Sam {
public:
const size_t FLAG_UNMAP = 4;
Sam ();
Sam (const std::string & s);
~Sam();
void open (const std::string & s);
bool is_open () { return _is_open; }
bool is_sam () { return _is_sam; }
bool read ();
std::string id ();
std::string sequence (bool strand);
bool is_first ();
bool is_reverse ();
// bool is_strand_ok (bool pair_end); // reverse complement if the sequence is not compatible with a paired read
std::string ref () const;
size_t start () const; // 0-based
size_t length () const;
size_t end () const; // 0-based, past-the-end
bool is_mapped () const;
std::vector<junction> junctions () const;
std::string tag_value (const char tag[2]) const;
private:
samfile_t * _filesam;
bam1_t * _b;
unsigned _is_open: 1, _is_sam: 1;
};
#endif