forked from deweylab/RSEM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tbam2gbam.cpp
36 lines (27 loc) · 884 Bytes
/
tbam2gbam.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cassert>
#include "utils.h"
#include "Transcripts.h"
#include "BamConverter.h"
using namespace std;
int nThreads;
char tiF[STRLEN], chr_list[STRLEN];
Transcripts transcripts;
int main(int argc, char* argv[]) {
if (argc != 4 && argc != 6) {
printf("Usage: rsem-tbam2gbam reference_name unsorted_transcript_bam_input genome_bam_output [-p number_of_threads]\n");
exit(-1);
}
nThreads = 1; // default is 1
if (argc == 6) { assert(strcmp(argv[4], "-p") == 0); nThreads = atoi(argv[5]); }
sprintf(tiF, "%s.ti", argv[1]);
sprintf(chr_list, "%s.chrlist", argv[1]);
transcripts.readFrom(tiF);
printf("Start converting:\n");
BamConverter bc(argv[2], argv[3], chr_list, transcripts, nThreads, assemble_command(argc, argv));
bc.process();
printf("Genome bam file is generated!\n");
return 0;
}