-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCmdline.cpp
More file actions
221 lines (202 loc) · 6.71 KB
/
Copy pathCmdline.cpp
File metadata and controls
221 lines (202 loc) · 6.71 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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
#include <Cmdline.h>
#include "stdlib.h"
#include <stdio.h>
#include "string.h"
#include "const.h"
#include "qcalc.h"
#define FALSE 0
extern int THREAD;
extern int INIT_MIS_SCAN;
extern int RQFACTOR;
extern int MINX;
extern bool PRINT_NON_CANON;
extern bool PRE_MAP;
extern int QSUM_LIMIT;
extern int MIS_DENSITY;
extern bool SOFTCLIP;
option Long_Options[]=
{
{"help",0,NULL,'h'},
{"query",1,NULL,'q'},
{"residue",1,NULL,'R'},
{0,0,0,0}
};
void Parse_Command_line(int argc, char* argv[],Index_Info & Ind,Parameters & CL)
{
int Current_Option=0;
char Short_Options[] ="R:jM:bhq:t:g:G:n:N:o:w:m:prO::T:CPQ:S";//allowed options....
char* This_Program = argv[0];//Current program name....
char Help_String[]=
"Parameters:\n"
" --help | -h\t\t\t\t Print help\n"
" --query | -m \t\t map only\n"
" --query | -M \t\t Store <number> junctions..\n"
" --query | -p \t\t process only\n"
" --query | -q <filename>\t\t Query file(File of Tags)\n"
" --query | -r \t\t mark exons in refGene..\n"
" --query | -R \t\t size of residue..\n"
" --query | -o <filename>\t\t junction file...\n"
" --query | -w <filename>\t\t Wiggle file...\n"
" --query | -O <filename>\t\t log read mapping info...\n"
" --query | -G <number>\t\t maximum gap between two introns...\n"
" --query | -n <number>\t\t number of mismatches in Initial Scan...\n"
" --query | -N <number>\t\t number of mismatches in splices...\n"
" --query | -b \t\t build files from refgene\n"
" --query | -j \t\t output all junctions...\n"
;
if(argc == 1) {printf("%s \n",Help_String);exit(0);}
char *Source=(char*)malloc(sizeof(char)*6500);//create space for file names...
char *options, *value;
char* Name;int Last_Dash;char* Genome_Name;
char MARKEX=FALSE;
for(;;)
{
Current_Option=getopt_long(argc, argv, Short_Options, Long_Options, NULL);
if (Current_Option == -1 ) break;
switch(Current_Option)
{
case 'h':
printf("%s \n",Help_String);exit(0);
case 'T':
THREAD=atoi(optarg);
break;
case 't':
CL.MAX_TAGS_TO_PROCESS=atoi(optarg);
break;
case 'q':
if(!CL.Patternfile_Count){CL.PATTERNFILE=optarg;}
else CL.PATTERNFILE1=optarg;
CL.Patternfile_Count++;
break;
case 'Q':
QSUM_LIMIT=atoi(optarg);
break;
case 'S':
SOFTCLIP=false;
break;
case 'G':
CL.EXONGAP=atoi(optarg);
break;
case 'o':
CL.JUNCTIONFILE=optarg;
break;
case 'C':
PRINT_NON_CANON=true;
break;
case 'm':
MIS_DENSITY=atoi(optarg);
break;
case 'n':
INIT_MIS_SCAN=atoi(optarg);
break;
case 'P':
PRE_MAP=false;
break;
case 'R':
RQFACTOR=atoi(optarg);
MINX=RQFACTOR;
break;
/*case 'j':
DUMP_ALL_JUNC=TRUE;
break;
case'b':
MARKEX=TRUE;
break;
case 'm':
MAPMODE=TRUE;PROCESSMODE=FALSE;
break;
case 'M':
MAX_HITS_TO_STORE=atoi(optarg);
break;
case 'p':
MAPMODE=FALSE;PROCESSMODE=TRUE;
break;
case 'N':
COUNT=atoi(optarg);
break;
case 'r':
USEREFGENE=TRUE;
break;
case 'w':
WIGGLEFILE=optarg;
break;
case 'O':
WRITE_SPLITREAD=TRUE;
if (optarg) MAPFILE=optarg;
break;*/
case 'g':
Name=optarg;Last_Dash=0;Genome_Name=optarg;
for(;Name[0]!=0;Name++)
{
if (Name[0]=='/')
{
Last_Dash++;Genome_Name=Name;
}
}
Ind.REVBWTINDEX = (char*)Source;
if(Last_Dash) Last_Dash=Genome_Name-optarg+1; else Genome_Name--;
strncpy(Ind.REVBWTINDEX,optarg,Last_Dash);
Ind.REVBWTINDEX[Last_Dash+0]='r';Ind.REVBWTINDEX[Last_Dash+1]='e';Ind.REVBWTINDEX[Last_Dash+2]='v';
strcpy(Ind.REVBWTINDEX+Last_Dash+3,Genome_Name+1);
strcat(Ind.REVBWTINDEX+Last_Dash+3,".bwt");
Ind.BWTFILE=Ind.REVBWTINDEX+500;
strncpy(Ind.BWTFILE,optarg,Last_Dash);
strcpy(Ind.BWTFILE+Last_Dash,Genome_Name+1);
strcat(Ind.BWTFILE+Last_Dash,".bwt");
Ind.REVOCCFILE = Ind.BWTFILE+500;
strncpy(Ind.REVOCCFILE,optarg,Last_Dash);
Ind.REVOCCFILE[Last_Dash+0]='r';Ind.REVOCCFILE[Last_Dash+1]='e';Ind.REVOCCFILE[Last_Dash+2]='v';
strcpy(Ind.REVOCCFILE+Last_Dash+3,Genome_Name+1);
strcat(Ind.REVOCCFILE+Last_Dash+3,".fmv");
Ind.OCCFILE=Ind.REVOCCFILE+500;
strncpy(Ind.OCCFILE,optarg,Last_Dash);
strcpy(Ind.OCCFILE+Last_Dash,Genome_Name+1);
strcat(Ind.OCCFILE+Last_Dash,".fmv");
Ind.SAFILE=Ind.OCCFILE+500;
strncpy(Ind.SAFILE,optarg,Last_Dash);
strcpy(Ind.SAFILE+Last_Dash,Genome_Name+1);
strcat(Ind.SAFILE+Last_Dash,".sa");
Ind.REVSAFILE = Ind.SAFILE+500;
strncpy(Ind.REVSAFILE,optarg,Last_Dash);
Ind.REVSAFILE[Last_Dash+0]='r';Ind.REVSAFILE[Last_Dash+1]='e';Ind.REVSAFILE[Last_Dash+2]='v';
strcpy(Ind.REVSAFILE+Last_Dash+3,Genome_Name+1);
strcat(Ind.REVSAFILE+Last_Dash+3,".sa");
Ind.BINFILE=Ind.REVSAFILE+500;
strncpy(Ind.BINFILE,optarg,Last_Dash);
strcpy(Ind.BINFILE+Last_Dash,Genome_Name+1);
strcat(Ind.BINFILE+Last_Dash,".pac");
Ind.LOCATIONFILE=Ind.BINFILE+500;
strncpy(Ind.LOCATIONFILE,optarg,Last_Dash);
strcpy(Ind.LOCATIONFILE+Last_Dash,Genome_Name+1);
strcat(Ind.LOCATIONFILE+Last_Dash,".ann.location");
Ind.BLKFILE = Ind.LOCATIONFILE+500;
strncpy(Ind.BLKFILE,optarg,Last_Dash);
strcpy(Ind.BLKFILE+Last_Dash,Genome_Name+1);
strcat(Ind.BLKFILE+Last_Dash,".blk.");
sprintf(Ind.BLKFILE+strlen(Ind.BLKFILE),"%d",RQFACTOR);
Ind.INDFILE = Ind.BLKFILE+500;
strncpy(Ind.INDFILE,optarg,Last_Dash);
strcpy(Ind.INDFILE+Last_Dash,Genome_Name+1);
strcat(Ind.INDFILE+Last_Dash,".ind.");
sprintf(Ind.INDFILE+strlen(Ind.INDFILE),"%d",RQFACTOR);
Ind.RANGEFILE = Ind.INDFILE+500;
strncpy(Ind.RANGEFILE,optarg,Last_Dash);
strcpy(Ind.RANGEFILE+Last_Dash,Genome_Name+1);
strcat(Ind.RANGEFILE+Last_Dash,".range");
Ind.SORTEDRANGEFILE = Ind.RANGEFILE+500;
strncpy(Ind.SORTEDRANGEFILE,optarg,Last_Dash);
strcpy(Ind.SORTEDRANGEFILE+Last_Dash,Genome_Name+1);
strcat(Ind.SORTEDRANGEFILE+Last_Dash,".sort");
Ind.INFOFILE = Ind.SORTEDRANGEFILE+500;
strncpy(Ind.INFOFILE,optarg,Last_Dash);
strcpy(Ind.INFOFILE+Last_Dash,Genome_Name+1);
strcat(Ind.INFOFILE+Last_Dash,".info");
break;
default:
printf("%s \n",Help_String);
exit(0);
}
}
CL.Patternfile_Count--;
/*if (MARKEX) {Mark_Exons();exit(0);}*/
}