| 1 |
#include <fstream> |
| 2 |
#include <iostream> |
| 3 |
#include <string> |
| 4 |
|
| 5 |
#include "../src/allele_functions.h" |
| 6 |
#include "../src/call_variants.h" |
| 7 |
|
| 8 |
int call_var_check_outfile(std::string prefix, uint8_t min_qual, |
| 9 |
uint8_t min_depth, double min_threshold, |
| 10 |
std::string out[], int len) { |
| 11 |
std::string path = "../data/test.strand.pileup"; |
| 12 |
std::ifstream mplp(path); |
| 13 |
call_variants_from_plup(mplp, prefix, min_qual, min_threshold, min_depth, |
| 14 |
"../data/db/test_ref.fa", "../data/test_strand.gff", false); |
| 15 |
std::ifstream outFile(prefix + ".tsv"); |
| 16 |
std::string l; |
| 17 |
getline(outFile, l); // Ignore first line |
| 18 |
int comp = 0, ctr = 0; |
| 19 |
|
| 20 |
while (ctr < len) { |
| 21 |
getline(outFile, l); |
| 22 |
std::cout << l << std::endl; |
| 23 |
std::cout << out[ctr] << " -> CORRECT" << std::endl; |
| 24 |
comp += l.compare(out[ctr]); |
| 25 |
std::cout << l.compare(out[ctr]) << "\n"; |
| 26 |
ctr++; |
| 27 |
} |
| 28 |
return comp; |
| 29 |
} |
| 30 |
|
| 31 |
int main() { |
| 32 |
int num_success = 0; |
| 33 |
// Quality threshold 20. Frequency threshold: 0.03. Total_DP = 3. Indel passes |
| 34 |
// filters with total_depth 4. Has two lines. |
| 35 |
std::string expected_out[2] = { |
| 36 |
"test\t5\tC\tT\t10\t0\t30\t10\t0\t30\t0.5\t20\t0.000290613\tTRUE\tA:test1\tGCT\tA\tGTT\tV\t2", |
| 37 |
"test\t15\tG\tC\t10\t0\t30\t10\t0\t30\t0.5\t20\t0.000290613\tTRUE\tB:test2\tGTC\tV\tGTG\tV\t2" |
| 38 |
}; |
| 39 |
num_success = |
| 40 |
call_var_check_outfile("../data/test_strand", 20, 0, 0.03, expected_out, 2); |
| 41 |
std::cout << num_success << std::endl; |
| 42 |
|
| 43 |
if (num_success == 0) return 0; |
| 44 |
return -1; |
| 45 |
} |