-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmappingFlankingVariants.h
More file actions
executable file
·143 lines (124 loc) · 3.21 KB
/
mappingFlankingVariants.h
File metadata and controls
executable file
·143 lines (124 loc) · 3.21 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include <cstdio>
#include <getopt.h>
#include <cstdlib>
#include <cstring>
struct parameters {
char* mapping_f;
char* pileup;
char* type;
char* writer;
char* unmapped;
char* arp;
char* breakpoint;
unsigned int readlength;
};
struct parameters* interface(struct parameters* param,int argc, char *argv[]);
void delete_param(struct parameters* param);
void usage(void);
const char* program_name;
struct parameters* interface(struct parameters* param, int argc, char *argv[]){
program_name = argv[0];
int c; // the next argument
int help = 0;
if (argc < 2){
usage();
exit(0);
}
param = new struct parameters;
param->pileup = new char;
param->mapping_f = new char;
param->type = new char;
param->writer = new char;
param->unmapped = new char;
param->arp = new char;
param->breakpoint = new char;
const struct option long_options[] ={
{"mapping",1,0,'m'},
{"pileup",1,0,'p'},
{"type",1,0,'t'},
{"writer",1,0,'w'},
{"unmapped",1,0,'u'},
{"arp",1,0,'a'},
{"breakpoint",1,0,'b'},
{"readlength",1,0,'l'},
{"help",0,0,'h'},
{0, 0, 0, 0}
};
while (1){
int option_index = 0;
c = getopt_long_only (argc, argv,"hm:t:p:w:u:a:b:l:",long_options, &option_index);
if (c == -1){
break;
}
switch(c) {
case 0:
break;
case 'm':
param->mapping_f = optarg;
break;
case 't':
param->type = optarg;
break;
case 'p':
param->pileup = optarg;
break;
case 'w':
param->writer = optarg;
break;
case 'u':
param->unmapped = optarg;
break;
case 'a':
param->arp = optarg;
break;
case 'b':
param->breakpoint = optarg;
break;
case 'l':
param->readlength = atoi(optarg);
break;
case 'h':
help = 1;
break;
case '?':
help = 1;
break;
default:
help = 1;
break;
}
}
if(help){
usage();
delete_param(param);
exit(0);
}
return param;
}
void usage()
{
fprintf(stdout, "\nRseq_bam_stats, Copyright (C) 2016 Sun Ruping <ruping@stanford.edu>\n");
fprintf(stdout, "\n");
fprintf(stdout, "Usage: %s options [inputfile] \n\n", program_name);
fprintf(stdout, "-h --help print the help message\n");
fprintf(stdout, "-m --mapping mapping_file (bam file)\n");
fprintf(stdout, "-p --pileup <forget it, currently it is no use> yes: allow pileup, no: skip redundant reads \n");
fprintf(stdout, "-w --writer the bam output name (for mapped ailgnments).\n");
fprintf(stdout, "-u --unmapped write the unmapped tag names into this file.\n");
fprintf(stdout, "-a --arp filename of the arp read name (for fusion assembly use, default not write).\n");
fprintf(stdout, "-b --breakpoint the file for output of potential breakpoint.\n");
fprintf(stdout, "-l --readlength the length of the reads.\n");
fprintf(stdout, "-t --type (p)aired-end or (s)ingle-end.\n");
fprintf(stdout, "\n");
}
void delete_param(struct parameters* param)
{
delete(param->mapping_f);
delete(param->type);
delete(param->pileup);
delete(param->writer);
delete(param->unmapped);
delete(param->arp);
delete(param->breakpoint);
delete(param);
}