comparison java-genomics-toolkit/src/edu/unc/genomics/wigmath/WigSummary.java @ 0:1daf3026d231

Upload alpha version
author timpalpant
date Mon, 13 Feb 2012 21:55:55 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1daf3026d231
1 package edu.unc.genomics.wigmath;
2
3 import java.io.BufferedWriter;
4 import java.io.IOException;
5 import java.nio.charset.Charset;
6 import java.nio.file.Files;
7 import java.nio.file.Path;
8
9 import org.apache.log4j.Logger;
10
11 import com.beust.jcommander.Parameter;
12
13 import edu.unc.genomics.CommandLineTool;
14 import edu.unc.genomics.io.WigFile;
15 import edu.unc.genomics.io.WigFileException;
16 import edu.unc.genomics.ngs.Autocorrelation;
17
18 public class WigSummary extends CommandLineTool {
19
20 private static final Logger log = Logger.getLogger(Autocorrelation.class);
21
22 @Parameter(names = {"-i", "--input"}, description = "Input file", required = true)
23 public WigFile inputFile;
24 @Parameter(names = {"-o", "--output"}, description = "Output file")
25 public Path outputFile;
26
27 public void run() throws IOException {
28 String summary = inputFile.toString();
29
30 if (outputFile != null) {
31 log.debug("Writing to output file");
32 try (BufferedWriter writer = Files.newBufferedWriter(outputFile, Charset.defaultCharset())) {
33 writer.write(summary);
34 }
35 } else {
36 System.out.println(summary);
37 }
38 }
39
40 public static void main(String[] args) throws IOException, WigFileException {
41 new WigSummary().instanceMain(args);
42 }
43
44 }