From 9d7579a623d76421e238661703879e63a8f71d92 Mon Sep 17 00:00:00 2001 From: LanderDC <75493579+LanderDC@users.noreply.github.com> Date: Mon, 6 Jan 2025 15:58:13 +0100 Subject: [PATCH 1/4] Add POS_AA to read_variant_file function --- src/get_common_variants.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/get_common_variants.cpp b/src/get_common_variants.cpp index 81248f37..0d1e6f4e 100644 --- a/src/get_common_variants.cpp +++ b/src/get_common_variants.cpp @@ -45,6 +45,7 @@ int read_variant_file( case 16: // REF_AA case 17: // ALT_CODON case 18: // ALT_AA + case 19: // POS_AA tab_delimited_key += cell + "\t"; break; case 4: From 1f9eb4f08b2bf112b4a073973d7ddc5a2f8507fd Mon Sep 17 00:00:00 2001 From: LanderDC <75493579+LanderDC@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:41:47 +0100 Subject: [PATCH 2/4] increase NUM_FIELDS and add POS_AA --- src/get_common_variants.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/get_common_variants.cpp b/src/get_common_variants.cpp index 0d1e6f4e..bf79d454 100644 --- a/src/get_common_variants.cpp +++ b/src/get_common_variants.cpp @@ -1,11 +1,11 @@ #include "get_common_variants.h" -const int NUM_FIELDS = 19; +const int NUM_FIELDS = 20; const std::string fields[NUM_FIELDS] = { "REGION", "POS", "REF", "ALT", "REF_DP", "REF_RV", "REF_QUAL", "ALT_DP", "ALT_RV", "ALT_QUAL", "ALT_FREQ", "TOTAL_DP", "PVAL", "PASS", "GFF_FEATURE", - "REF_CODON", "REF_AA", "ALT_CODON", "ALT_AA"}; + "REF_CODON", "REF_AA", "ALT_CODON", "ALT_AA", "POS_AA"}; const std::string na_tab_delimited_str = "NA\tNA\tNA\tNA\tNA\tNA\tNA\tNA\tNA\tNA"; From 755a8bcddddb092ff5d4c504f4e4fb6999f190c1 Mon Sep 17 00:00:00 2001 From: LanderDC <75493579+LanderDC@users.noreply.github.com> Date: Mon, 6 Jan 2025 16:54:24 +0100 Subject: [PATCH 3/4] Write POS_AA in header --- src/get_common_variants.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/get_common_variants.cpp b/src/get_common_variants.cpp index bf79d454..39368402 100644 --- a/src/get_common_variants.cpp +++ b/src/get_common_variants.cpp @@ -104,7 +104,7 @@ int common_variants(std::string out, double min_threshold, char *files[], for (i = 0; i < 4; ++i) { fout << fields[i] << "\t"; } - for (i = 14; i < 19; ++i) { + for (i = 14; i < 20; ++i) { fout << fields[i] << "\t"; } for (i = 0; i < nfiles; ++i) { From 114e76bf2163d4983d63f41b64c3f159b4a6515d Mon Sep 17 00:00:00 2001 From: LanderDC Date: Tue, 7 Jan 2025 11:22:32 +0100 Subject: [PATCH 4/4] Avoid adding tab at end of tsv header --- src/get_common_variants.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/get_common_variants.cpp b/src/get_common_variants.cpp index 39368402..83721980 100644 --- a/src/get_common_variants.cpp +++ b/src/get_common_variants.cpp @@ -109,7 +109,10 @@ int common_variants(std::string out, double min_threshold, char *files[], } for (i = 0; i < nfiles; ++i) { for (j = 4; j < 14; ++j) { - fout << fields[j] << "_" << files[i] << "\t"; + fout << fields[j] << "_" << files[i]; + if (!(i == nfiles - 1 && j == 13)) { // Avoid adding a tab at the end + fout << "\t"; + } } } fout << "\n";