| 1 | #include "../src/ref_seq.h" |
| 2 | |
| 3 | int check_failure(char n1, char n2, char n3, char *codon, int pos) { |
| 4 | if (codon[0] != n1 || codon[1] != n2 || codon[2] != n3) { |
| 5 | std::cout << "Pos: " << pos << " " |
| 6 | << "Codon: " << n1 << n2 << n3 << " Res: " << codon << std::endl; |
| 7 | return -1; |
| 8 | } |
| 9 | return 0; |
| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | int num_success = 0; |
| 14 | ref_antd refantd("../data/db/test_ref.fa", "../data/test.gff"); |
| 15 | std::vector<gff3_feature> g = refantd.get_gff_features(); |
| 16 | char *codon = new char[3]; |
| 17 | codon = refantd.get_codon(30, "test", g.at(2)); |
| 18 | num_success = check_failure('C', 'A', 'T', codon, 30); |
| 19 | codon = refantd.get_codon(30, "test", g.at(3)); |
| 20 | num_success = check_failure('T', 'C', 'A', codon, 30); |
| 21 | codon = refantd.get_codon(29, "test", g.at(2)); |
| 22 | num_success = check_failure('C', 'A', 'T', codon, 29); |
| 23 | // After edit_pos |
| 24 | codon = refantd.get_codon(107, "test", g.at(4)); |
| 25 | num_success = check_failure('C', 'A', 'A', codon, 107); |
| 26 | codon = refantd.get_codon(105, "test", g.at(4)); |
| 27 | num_success = check_failure('C', 'A', 'T', codon, 105); |
| 28 | codon = refantd.get_codon(101, "test", g.at(4)); |
| 29 | num_success = check_failure('T', 'C', 'T', codon, 101); |
| 30 | codon = refantd.get_codon(100, "test", g.at(4)); |
| 31 | num_success = check_failure('G', 'G', 'A', codon, 100); |
| 32 | // 2 AA insertion |
| 33 | codon = refantd.get_codon(100, "test", g.at(5)); |
| 34 | num_success = check_failure('G', 'G', 'T', codon, 100); |
| 35 | codon = refantd.get_codon(101, "test", g.at(5)); |
| 36 | num_success = check_failure('C', 'A', 'A', codon, 101); |
| 37 | codon = refantd.get_codon(140, "test", g.at(5)); |
| 38 | num_success = check_failure('C', 'T', 'A', codon, 140); |
| 39 | std::cout << num_success; |
| 40 | if (num_success == 0) return 0; |
| 41 | return -1; |
| 42 | } |