forked from Martinsos/edlib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathomicia_aligner.cpp
More file actions
57 lines (43 loc) · 1.24 KB
/
Copy pathomicia_aligner.cpp
File metadata and controls
57 lines (43 loc) · 1.24 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
50
51
52
53
54
55
56
/*
* omicia_aligner.cpp
* bases on aligner.cpp
* to run in the Fabric Genomics Inc. environment
*
* input sequences will be read over STDIN
* output (via STDOUT) of the alignment is in cigar format only
*
*/
#include <unistd.h>
#include <cstdio>
#include <string>
#include <sstream>
#include <iostream>
#include <queue>
#include <stdio.h>
#include "edlib.h"
using namespace std;
int main() {
string line;
string stdin_content;
string reference, query;
stdin_content = "";
int numBestSeqs = 0;
int kArg = -1;
while (getline(cin, line)) {
if (line.length() == 0)
break;
stdin_content += line;
}
istringstream iss(stdin_content);
iss >> reference;
iss >> query;
EdlibAlignResult result = edlibAlign(query.c_str(), query.length(), reference.c_str(), reference.length(),
edlibNewAlignConfig(-1, EDLIB_MODE_NW, EDLIB_TASK_PATH));
// printf("distance %d\n", result.editDistance);
char *cigar = edlibAlignmentToCigar(result.alignment, result.alignmentLength, EDLIB_CIGAR_EXTENDED);
// cout << reference << endl;
// cout << query << endl;
printf("%s\n", cigar);
free(cigar);
edlibFreeAlignResult(result);
}