X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=bam2readdepth.cpp;h=d252e2e0f74a4fc84c5078bb1dbbeba54f48ec60;hp=c7f0adbcecc96bfaab0a24b5fa4764d27cd2e268;hb=8bc3c21a5168b1dd6e36a95c018013e6a7641fee;hpb=946f9a6adb2a82048c8453d44693cd3838d32939 diff --git a/bam2readdepth.cpp b/bam2readdepth.cpp index c7f0adb..d252e2e 100644 --- a/bam2readdepth.cpp +++ b/bam2readdepth.cpp @@ -1,13 +1,27 @@ -#include +#include +#include +#include +#include + +#include "my_assert.h" #include "wiggle.h" +using namespace std; + int main(int argc, char* argv[]) { - if (argc != 2) { - printf("Usage: rsem-bam2readdepth sorted_bam_input\n"); - std::exit(1); - } - ReadDepthWriter depth_writer(std::cout); - build_wiggles(argv[1], depth_writer); - - return 0; + if (argc != 3) { + printf("Usage: rsem-bam2readdepth sorted_bam_input readdepth_output\n"); + exit(-1); + } + + ofstream fout(argv[2]); + general_assert(fout.is_open(), "Cannot write to " + cstrtos(argv[2]) + "!"); + + ReadDepthWriter depth_writer(fout); + + build_wiggles(argv[1], depth_writer); + + fout.close(); + + return 0; }