-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathHardMask.cpp
51 lines (39 loc) · 975 Bytes
/
HardMask.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
47
48
49
50
51
#include <cinttypes>
#include <assert.h>
#include <sstream>
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[]) {
if (argc == 1) {
cout << "usage: upper input.fasta output.fasta" << endl;
exit(1);
}
string inFileName = argv[1];
string outFileName = argv[2];
ifstream testFile(outFileName.c_str());
if (testFile.good()) {
cout << "ERROR, output file " << outFileName << " already exists." << endl;
exit(1);
}
ofstream outFile(outFileName.c_str());
ifstream fastaFile(inFileName.c_str());
vector<string> nameOrder;
string line;
while (getline(fastaFile, line)) {
if (line.size() > 0 and line[0] == '>') {
outFile << line << endl;
}
else {
for (int i=0; i < line.size(); i++) {
char c=line[i];
if (c == 'a' || c == 'c' || c == 'g' || c=='t') {
line[i] = 'N';
}
}
outFile << line << endl;
}
}
}