]> git.donarmstrong.com Git - rsem.git/blob - bam2wig.cpp
Updated WHAT_IS_NEW
[rsem.git] / bam2wig.cpp
1 #include <cstdio>
2 #include <cstdlib>
3 #include <cstring>
4
5 #include "wiggle.h"
6
7 using namespace std;
8
9 void printUsage() {
10   printf("Usage: rsem-bam2wig sorted_bam_input wig_output wiggle_name [--no-fractional-weight]\n");
11   printf("sorted_bam_input\t: Input BAM format file, must be sorted\n");
12   printf("wig_output\t\t: Output wiggle file's name, e.g. output.wig\n");
13   printf("wiggle_name\t\t: the name of this wiggle plot\n");
14   printf("--no-fractional-weight\t: If this is set, RSEM will not look for \"ZW\" tag and each alignment appeared in the BAM file has weight 1. Set this if your BAM file is not generated by RSEM. Please note that this option must be at the end of the command line.\n");
15   exit(-1);
16 }
17
18 int main(int argc, char* argv[]) {
19         if (argc < 4 || argc > 5) { printf("Number of arguments is not correct!\n"); printUsage(); }
20         if (argc == 5 && strcmp(argv[4], "--no-fractional-weight")) { printf("Cannot recognize option %s!\n", argv[4]); printUsage(); }
21
22         no_fractional_weight = (argc == 5 && !strcmp(argv[4], "--no-fractional-weight"));
23         UCSCWiggleTrackWriter track_writer(argv[2], argv[3]);
24         build_wiggles(argv[1], track_writer);
25
26         return 0;
27 }