1 package driver;
2 
3 public class MakeTestScript {
4 
5 
main(String[] args)6 	public static void main(String[] args){
7 
8 		assert(args.length>=1) : "Please enter number of reads.";
9 		numReads=Integer.parseInt(args[0]);
10 		readlen=Integer.parseInt(args[1]);
11 
12 		String mode=args[2];
13 		String extra=(args.length>3 ? args[3] : "EXTRA");
14 
15 		String printtime="java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime ";
16 		String gradesam="java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.GradeSamFile ";
17 		String time=mode+"Time.txt";
18 
19 		String[] strings=null;
20 
21 //		strings=new String[] {
22 //				"/house/homedirs/b/bushnell/ssaha2/ssaha2 -solexa -outfile #S.sam -best -1 -output sam_soft -save hg37 " +
23 //				"reads_B1_#Rx#Lbp_#S.fastq",
24 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime defaultTime.txt",
25 //				gradesam+"#S.sam #R ssaha2",
26 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime defaultTime.txt"
27 //		};
28 
29 		if(mode.equalsIgnoreCase("bwa")){
30 			strings=new String[] {
31 //				printtime+time+" false",
32 //				"memtime /house/homedirs/b/bushnell/bwa/bwa aln -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fastq 1>temp_bwa.sai",
33 //				"memtime /house/homedirs/b/bushnell/bwa/bwa samse "+extra+" temp_bwa.sai reads_B1_#Rx#Lbp_#S.fastq 1>bwa_#S_r#Rx#L.sam",
34 //				printtime+time,
35 //				gradesam+"bwa_#S_r#Rx#L.sam #R",
36 
37 				printtime+time+" false",
38 				"/house/homedirs/b/bushnell/bwa/bwa aln -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fastq 1>bwa_#S_r#Rx#L.sai",
39 				"/house/homedirs/b/bushnell/bwa/bwa samse "+extra+" bwa_#S_r#Rx#L.sai reads_B1_#Rx#Lbp_#S.fastq 1>bwa_#S_r#Rx#L.sam",
40 				printtime+time,
41 				gradesam+"bwa_#S_r#Rx#L.sam #R",
42 			};
43 		}
44 
45 		if(mode.equalsIgnoreCase("bwamem")){
46 			strings=new String[] {
47 //				printtime+time+" false",
48 //				"memtime /house/homedirs/b/bushnell/bwa/bwa aln -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fastq 1>temp_bwa.sai",
49 //				"memtime /house/homedirs/b/bushnell/bwa/bwa samse "+extra+" temp_bwa.sai reads_B1_#Rx#Lbp_#S.fastq 1>bwa_#S_r#Rx#L.sam",
50 //				printtime+time,
51 //				gradesam+"bwa_#S_r#Rx#L.sam #R",
52 
53 				printtime+time+" false",
54 				"/house/homedirs/b/bushnell/bwa74/bwa mem -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fastq 1>bwamem_#S_r#Rx#L.sam",
55 				printtime+time,
56 				gradesam+"bwamem_#S_r#Rx#L.sam #R",
57 			};
58 		}
59 
60 		if(mode.equalsIgnoreCase("bwasw")){
61 			strings=new String[] {
62 //				printtime+time+" false",
63 //				"memtime /house/homedirs/b/bushnell/bwa/bwa aln -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fastq 1>temp_bwa.sai",
64 //				"memtime /house/homedirs/b/bushnell/bwa/bwa samse "+extra+" temp_bwa.sai reads_B1_#Rx#Lbp_#S.fastq 1>bwa_#S_r#Rx#L.sam",
65 //				printtime+time,
66 //				gradesam+"bwa_#S_r#Rx#L.sam #R",
67 
68 				printtime+time+" false",
69 				"/house/homedirs/b/bushnell/bwa/bwa bwasw -b5 -q2 -r1 -z10 -t 32 "+extra+" reads_B1_#Rx#Lbp_#S.fasta 1>bwa_#S_r#Rx#L.sam",
70 				printtime+time,
71 				gradesam+"bwa_#S_r#Rx#L.sam #R",
72 			};
73 		}
74 
75 		if(mode.startsWith("bbmap")){
76 			int k=13;
77 			String s2=mode.replaceFirst("bbmap", "");
78 			if(s2.length()>0){
79 				k=Integer.parseInt(s2);
80 			}
81 			strings=new String[] {
82 					printtime+time+" false",
83 				"memtime java -ea -Xmx106g -cp /house/homedirs/b/bushnell/beta18/ " +
84 				"align2.BBMap in=reads_B1_#Rx#Lbp_#S.fastq out=bbmap"+k+"_#S_r#Rx#L.sam overwrite k="+k+" printtoerr",
85 				printtime+time,
86 				gradesam+"bbmap"+k+"_#S_r#Rx#L.sam #R",
87 			};
88 		}
89 
90 		if(mode.equalsIgnoreCase("bowtie2")){
91 			strings=new String[] {
92 					printtime+time+" false",
93 				"memtime bowtie2 -x bow2ref -U reads_B1_#Rx#Lbp_#S.fastq -S bowtie2_#S_r#Rx#L.sam --phred33 -p 32",
94 				printtime+time,
95 				gradesam+"bowtie2_#S_r#Rx#L.sam #R",
96 			};
97 		}
98 
99 		if(mode.equalsIgnoreCase("gsnap")){
100 			strings=new String[] {
101 					printtime+time+" false",
102 				"memtime /house/homedirs/b/bushnell/gsnap/bin/gsnap -t 32 -d "+extra+" -A sam reads_B1_#Rx#Lbp_#S.fastq > gsnap_#S_r#Rx#L.sam",
103 				printtime+time,
104 				gradesam+"gsnap_#S_r#Rx#L.sam #R",
105 			};
106 		}
107 
108 
109 //		strings=new String[] {
110 //				"bowtie --best -y --chunkmbs 1024 --strata -m 1 -k 2 -v 3 -p 24 -t -q -S HG37" +
111 //				" reads_B1_#Rx#Lbp_#S.fastq #S_bowtie.sam",
112 //
113 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime bowtieTime.txt",
114 //				gradesam+"#S_bowtie.sam #R",
115 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime bowtieTime.txt"
116 //		};
117 
118 
119 //		strings=new String[] {
120 //				"bfast match -T $TMPDIR/ -n 16 -f hg19.fa -r reads_B1_#Rx#Lbp_#S.fastq > $TMPDIR/#S.bmf",
121 //				"bfast localalign -n 16 -f hg19.fa -m $TMPDIR/#S.bmf > $TMPDIR/#S.baf",
122 ////				"bfast postprocess -n 16 -a 3 -f hg19.fa -i $TMPDIR/#S.baf > #S.sam",
123 ////				"bfast postprocess -n 16 -a 3 -m 20 -f hg19.fa -i $TMPDIR/#S.baf > #S_r#Rx#L.sam",
124 //				"bfast postprocess -n 16 -M 20 -f hg19.fa -i $TMPDIR/#S.baf > #S_r#Rx#L.sam",
125 //
126 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime bfastTime.txt",
127 //				gradesam+"#S_r#Rx#L.sam #R",
128 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime bfastTime.txt"
129 //		};
130 
131 		if(mode.equalsIgnoreCase("smalt")){
132 			strings=new String[] {
133 					printtime+time+" false",
134 				"memtime /house/homedirs/b/bushnell/smalt/smalt_x86_64 map -n 32 -f sam -o smalt_#S_r#Rx#L.sam smaltindex reads_B1_#Rx#Lbp_#S.fastq",
135 				printtime+time,
136 				gradesam+"smalt_#S_r#Rx#L.sam #R ssaha2",
137 			};
138 		}
139 
140 		if(mode.equalsIgnoreCase("snap")){
141 			strings=new String[] {
142 					printtime+time+" false",
143 				"memtime /house/homedirs/b/bushnell/snap/snap single snapref reads_B1_#Rx#Lbp_#S.fastq -o snap_#S_r#Rx#L.sam -t 32 -b",
144 				printtime+time,
145 				gradesam+"snap_#S_r#Rx#L.sam #R",
146 			};
147 		}
148 
149 		if(mode.equalsIgnoreCase("masai")){
150 			strings=new String[] {
151 					printtime+time+" false",
152 				"memtime /house/homedirs/b/bushnell/masai/masai_mapper --output-format sam "+extra+" reads_B1_#Rx#Lbp_#S.fastq",
153 				printtime+time,
154 				gradesam+"reads_B1_#Rx#Lbp_#S.sam #R",
155 			};
156 		}
157 
158 		if(mode.equalsIgnoreCase("blasr")){
159 			System.out.println("source /house/sdm/pacbio/smrtanalysis-installs/smrtanalysis-2.0.0/etc/setup.sh\n");
160 			strings=new String[] {
161 					printtime+time+" false",
162 				"memtime blasr reads_B1_#Rx#Lbp_#S.fastq "+extra+" -sam -out blasr_#S_r#Rx#L.sam -bestn 1 -nproc 32",
163 				printtime+time,
164 				gradesam+"blasr_#S_r#Rx#L.sam #R blasr",
165 			};
166 		}
167 
168 //		strings=new String[] {
169 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
170 //				"./soap -p 24 -a reads_B1_#Rx#Lbp_#S.fastq -D hg37.fa.index -o #S_r#Rx#L.soap",
171 //				"perl soap2sam.pl -p #S_r#Rx#L.soap > #S_r#Rx#L.sam",
172 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
173 //				gradesam+"#S_r#Rx#L.sam #R",
174 //		};
175 
176 //		strings=new String[] {
177 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
178 //				"./bin/gmapper-ls reads_B1_#Rx#Lbp_#S.fastq --single-best-mapping --qv-offset 33 -L hg37 -N 24 -o 5 -h 80% > #S_r#Rx#L.sam",
179 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
180 //				gradesam+"#S_r#Rx#L.sam #R",
181 //		};
182 
183 //		strings=new String[] {
184 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
185 //				"./bin/MosaikBuild -q reads_B1_#Rx#Lbp_#S.fastq -out $TMPDIR/reads_B1_#Rx100bp_#S_chr1-25.dat -st illumina",
186 //				"./bin/MosaikAligner -in $TMPDIR/reads_B1_#Rx100bp_#S_chr1-25.dat -out $TMPDIR/reads_B1_#Rx100bp_#S_chr1-25_aligned.dat -ia hg37_ref.dat -hs 15 -bw=29 -j hg37_jumpdb -act 20 -mm 32 -mhp 100 -p 32 -m unique",
187 //				"./bin/MosaikText -in $TMPDIR/reads_B1_#Rx100bp_#S_chr1-25_aligned.dat -sam #S_r#Rx#L.sam",
188 //				"java -ea -Xmx96m -cp /house/homedirs/b/bushnell/beta18/ align2.PrintTime mapTime.txt",
189 //				gradesam+"#S_r#Rx#L.sam #R",
190 //		};
191 
192 		int[] blank=new int[] {0, 0, 0, 0, 0};
193 
194 		int preload=100;
195 		if(mode.equalsIgnoreCase("masai")){
196 			preload=1000;
197 		}
198 		print(strings, blank, preload);
199 		print(strings, blank, preload);
200 		print(strings, blank, preload);
201 		print(strings, blank, preload);
202 		for(int[] array : sets){
203 			print(strings, array, numReads);
204 		}
205 
206 	}
207 
print(String[] array, int[] blank, int x)208 	private static void print(String[] array, int[] blank, int x) {
209 
210 		int rl=readlen;
211 		if(blank.length>5){rl=blank[5];}
212 
213 		String counts=(blank[0]+"S_"+blank[1]+"I_"+blank[2]+"D_"+blank[3]+"U_"+blank[4]+"N");
214 		String reads=""+x;
215 		String len=""+rl;
216 
217 		for(String s : array){
218 			String s2=s.replaceAll("#S", counts).replaceAll("#R", reads).replaceAll("#L", len);
219 			System.out.println(s2);
220 		}
221 		System.out.println();
222 
223 	}
224 
225 	public static int numReads=400000;
226 	public static int readlen=150;
227 
228 	public static final int[][] sets=new int[][] {
229 		{0, 0, 0, 0, 0},
230 		{1, 0, 0, 0, 0},
231 		{2, 0, 0, 0, 0},
232 		{3, 0, 0, 0, 0},
233 		{4, 0, 0, 0, 0},
234 		{5, 0, 0, 0, 0},
235 		{6, 0, 0, 0, 0},
236 		{7, 0, 0, 0, 0},
237 		{8, 0, 0, 0, 0},
238 		{10, 0, 0, 0, 0},
239 		{12, 0, 0, 0, 0},
240 		{14, 0, 0, 0, 0},
241 		{16, 0, 0, 0, 0},
242 		{18, 0, 0, 0, 0},
243 		{20, 0, 0, 0, 0},
244 		{24, 0, 0, 0, 0},
245 		{28, 0, 0, 0, 0},
246 		{32, 0, 0, 0, 0},
247 		{36, 0, 0, 0, 0},
248 		{40, 0, 0, 0, 0},
249 
250 		{0, 1, 0, 0, 0},
251 		{0, 2, 0, 0, 0},
252 		{0, 3, 0, 0, 0},
253 		{0, 4, 0, 0, 0},
254 		{0, 5, 0, 0, 0},
255 		{0, 6, 0, 0, 0},
256 		{0, 7, 0, 0, 0},
257 		{0, 8, 0, 0, 0},
258 		{0, 10, 0, 0, 0},
259 		{0, 12, 0, 0, 0},
260 		{0, 14, 0, 0, 0},
261 		{0, 16, 0, 0, 0},
262 		{0, 18, 0, 0, 0},
263 		{0, 20, 0, 0, 0},
264 		{0, 24, 0, 0, 0},
265 		{0, 28, 0, 0, 0},
266 		{0, 32, 0, 0, 0},
267 		{0, 36, 0, 0, 0},
268 		{0, 40, 0, 0, 0},
269 
270 		{0, 0, 1, 0, 0},
271 		{0, 0, 2, 0, 0},
272 		{0, 0, 3, 0, 0},
273 		{0, 0, 4, 0, 0},
274 		{0, 0, 5, 0, 0},
275 		{0, 0, 6, 0, 0},
276 		{0, 0, 7, 0, 0},
277 		{0, 0, 8, 0, 0},
278 		{0, 0, 10, 0, 0},
279 		{0, 0, 12, 0, 0},
280 		{0, 0, 14, 0, 0},
281 		{0, 0, 16, 0, 0},
282 		{0, 0, 18, 0, 0},
283 		{0, 0, 20, 0, 0},
284 		{0, 0, 24, 0, 0},
285 		{0, 0, 28, 0, 0},
286 		{0, 0, 32, 0, 0},
287 		{0, 0, 36, 0, 0},
288 		{0, 0, 40, 0, 0},
289 		{0, 0, 48, 0, 0},
290 		{0, 0, 56, 0, 0},
291 		{0, 0, 64, 0, 0},
292 		{0, 0, 96, 0, 0},
293 		{0, 0, 128, 0, 0},
294 		{0, 0, 192, 0, 0},
295 		{0, 0, 256, 0, 0},
296 		{0, 0, 384, 0, 0},
297 		{0, 0, 512, 0, 0},
298 		{0, 0, 768, 0, 0},
299 		{0, 0, 1000, 0, 0},
300 		{0, 0, 1500, 0, 0},
301 		{0, 0, 2000, 0, 0},
302 		{0, 0, 3000, 0, 0},
303 		{0, 0, 4000, 0, 0},
304 		{0, 0, 6000, 0, 0},
305 		{0, 0, 8000, 0, 0},
306 		{0, 0, 12000, 0, 0},
307 		{0, 0, 16000, 0, 0},
308 		{0, 0, 24000, 0, 0},
309 		{0, 0, 32000, 0, 0},
310 		{0, 0, 48000, 0, 0},
311 		{0, 0, 64000, 0, 0},
312 		{0, 0, 96000, 0, 0},
313 		{0, 0, 128000, 0, 0},
314 
315 		{0, 0, 0, 1, 0},
316 		{0, 0, 0, 2, 0},
317 		{0, 0, 0, 3, 0},
318 		{0, 0, 0, 4, 0},
319 		{0, 0, 0, 5, 0},
320 		{0, 0, 0, 6, 0},
321 		{0, 0, 0, 7, 0},
322 		{0, 0, 0, 8, 0},
323 		{0, 0, 0, 10, 0},
324 		{0, 0, 0, 12, 0},
325 		{0, 0, 0, 14, 0},
326 		{0, 0, 0, 16, 0},
327 		{0, 0, 0, 18, 0},
328 		{0, 0, 0, 20, 0},
329 		{0, 0, 0, 24, 0},
330 		{0, 0, 0, 28, 0},
331 		{0, 0, 0, 32, 0},
332 		{0, 0, 0, 36, 0},
333 		{0, 0, 0, 40, 0},
334 
335 		{0, 0, 0, 0, 1},
336 		{0, 0, 0, 0, 2},
337 		{0, 0, 0, 0, 3},
338 		{0, 0, 0, 0, 4},
339 		{0, 0, 0, 0, 5},
340 		{0, 0, 0, 0, 6},
341 		{0, 0, 0, 0, 7},
342 		{0, 0, 0, 0, 8},
343 		{0, 0, 0, 0, 10},
344 		{0, 0, 0, 0, 12},
345 		{0, 0, 0, 0, 14},
346 		{0, 0, 0, 0, 16},
347 		{0, 0, 0, 0, 18},
348 		{0, 0, 0, 0, 20},
349 		{0, 0, 0, 0, 24},
350 		{0, 0, 0, 0, 28},
351 		{0, 0, 0, 0, 32},
352 		{0, 0, 0, 0, 36},
353 		{0, 0, 0, 0, 40},
354 
355 		{0, 0, 0, 0, 0, 400},
356 		{2, 2, 2, 2, 0, 400},
357 		{4, 2, 2, 2, 0, 400},
358 		{6, 3, 3, 3, 0, 400},
359 		{8, 4, 4, 4, 0, 400},
360 		{10, 4, 4, 4, 0, 400},
361 		{12, 4, 4, 4, 0, 400},
362 		{14, 4, 4, 4, 0, 400},
363 		{16, 4, 4, 4, 0, 400},
364 		{18, 4, 4, 4, 0, 400},
365 		{20, 5, 5, 5, 0, 400},
366 	};
367 
368 }
369