-
Notifications
You must be signed in to change notification settings - Fork 0
/
read.cpp
46 lines (39 loc) · 908 Bytes
/
read.cpp
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
// $Author: benine $
// $Date$
// $Log$
// This contains the read class for afin
#include "read.hpp"
#include <cstdlib>
#include <unistd.h>
using namespace std;
//////// READ FUNCTIONS //////////////
// constructor.. default revcomp will be false
Read::Read( string read, int match, bool rev ){
this->read = read;
start = match;
misses = 0;
this->rev = rev;
}
Read::Read( string read, int match ){
this->read = read;
start = match;
misses = 0;
rev = false;
}
// returns character at pos where pos is the nth postion of the match
char Read::get_pos( int pos, bool back ){
if( back ){
int read_pos = pos - start;
if( read_pos >=0 && read_pos < read.length() ){
return read[ read_pos ];
}
}
else{
int len = read.length();
int read_pos = len - start + pos;
if( read_pos >= 0 && read_pos < len ){
return read[ read_pos ];
}
}
return -1;
}