Simple C++ utility to merge bamFreq output TAB files into one outer-merged CSV file based on Chromosome and Position. Will include other utilities for working with the merged CSV file.
Self-contained cpp file for outer-merging binary alignment map (BAM) output files produced by the bamFreq tool (https://github.com/clwgg/bamfreq) based on some pre-selected chromosome and position pairs, currently with hard-coded file seperators for input files. (Will be changed in future versions, thus check usage if updating to newer version)
Compile via:
g++ -Ofast ./bamFreqOuterMerge.cpp -o ./bamFreqOuterMerge
Usage: ./bamFreqOuterMerge ./selectedPos.tab ./output.csv ./inputFile1.csv ./inputFile2.csv ...
selectedPos.tab : input file consisting of AT LEAST chromosome, position, and some arbitrary data (not processed):
CHROM POS POS
eg1 101 101
...
output.csv : will be a file containing the outer-merge results of only the selectedPos.tab inputs to reduce unnecessary data size. Will have the form:
CHROM POS ./inputFile1.csv_COV [./inputFile1_COUNTS (A,C,T,G,N,D in order of inputs] ./inputFile2.csv_COV ...
...
IMPORTANT: for now, the output header is hard-coded in the order of A,C,G,T,N,D , this does NOT change the order from the previous modified bamFreq files, thus order will be preserved from input. It is important that all input files stay in the same format and remain sorted, otherwise rows may be duplicated in the table.
inputFile#.csv : expected format: (pre-processed bamFreq output files)
CHROM,POS,COV,A,C,T,G,N,D
...