annotate src/edu/unc/genomics/wigmath/WigSummary.java @ 2:e16016635b2a

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