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 package org.utgenome.shell;
26
27 import java.io.BufferedReader;
28 import java.io.BufferedWriter;
29 import java.io.FileReader;
30 import java.io.FileWriter;
31 import java.io.InputStreamReader;
32 import java.io.OutputStreamWriter;
33
34 import org.utgenome.format.illumina.Seq2Fastq;
35 import org.xerial.util.opt.Argument;
36
37 public class Illumina2Fastq extends UTGBShellCommand {
38
39
40
41
42 @Argument(index = 0)
43 private String in = "-";
44 @Argument(index = 1)
45 private String out = "-";
46
47 @Override
48 public void execute(String[] args) throws Exception {
49
50 BufferedReader input = null;
51 BufferedWriter output = null;
52 if ("-".equals(in)) {
53 input = new BufferedReader(new InputStreamReader(System.in));
54 }
55 else {
56 input = new BufferedReader(new FileReader(in));
57 }
58
59 if ("-".equals(out)) {
60 output = new BufferedWriter(new OutputStreamWriter(System.out));
61 }
62 else {
63 output = new BufferedWriter(new FileWriter(out));
64 }
65
66 Seq2Fastq.convert(input, output);
67
68 output.flush();
69
70 }
71
72 @Override
73 public String getOneLinerDescription() {
74 return "convert Illumina's raw read (*_sequence.txt) into fastq format";
75 }
76
77 @Override
78 public String name() {
79 return "illumina2fastq";
80 }
81
82 }