-
Notifications
You must be signed in to change notification settings - Fork 0
/
dna.hpp
56 lines (48 loc) · 1.2 KB
/
dna.hpp
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
50
51
52
53
54
55
56
//
// dna.hpp
// APOBECXP
//
// Created by Marat Kazanov on 01/12/2018.
// Copyright © 2018 Marat Kazanov. All rights reserved.
//
#ifndef dna_hpp
#define dna_hpp
#include <string>
#include <algorithm>
using namespace std;
class CDNA{
public:
static string cDNA(string dna)
{
string ret;
ret = dna;
transform(ret.begin(),ret.end(),ret.begin(),::toupper);
reverse(ret.begin(),ret.end());
replace(ret.begin(),ret.end(),'A','Y');
replace(ret.begin(),ret.end(),'T','Z');
replace(ret.begin(),ret.end(),'Z','A');
replace(ret.begin(),ret.end(),'Y','T');
replace(ret.begin(),ret.end(),'C','Y');
replace(ret.begin(),ret.end(),'G','Z');
replace(ret.begin(),ret.end(),'Z','C');
replace(ret.begin(),ret.end(),'Y','G');
return(ret);
}
static bool inACGT(char base)
{
if(base == 'A' || base == 'C' || base == 'G' || base == 'T')
return(true);
else
return(false);
}
};
class CDNAPos{
public:
int chrNum;
unsigned long pos;
int strand;
CDNAPos(){};
CDNAPos(int chrNum_, unsigned long pos_);
int isNull();
};
#endif /* dna_hpp */