diff java-genomics-toolkit/src/edu/unc/genomics/WigFileConverter.java @ 0:1daf3026d231

Upload alpha version
author timpalpant
date Mon, 13 Feb 2012 21:55:55 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/java-genomics-toolkit/src/edu/unc/genomics/WigFileConverter.java	Mon Feb 13 21:55:55 2012 -0500
@@ -0,0 +1,29 @@
+package edu.unc.genomics;
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+import com.beust.jcommander.IStringConverter;
+import com.beust.jcommander.ParameterException;
+
+import edu.unc.genomics.io.WigFile;
+import edu.unc.genomics.io.WigFileException;
+
+/**
+ * @author timpalpant
+ *
+ */
+public class WigFileConverter implements IStringConverter<WigFile> {
+
+	@Override
+	public WigFile convert(String value) throws ParameterException {
+		PathConverter converter = new PathConverter();
+		Path p = converter.convert(value);
+		try {
+			return WigFile.autodetect(p);
+		} catch (WigFileException | IOException e) {
+			throw new ParameterException("Error autodetecting and initializing BigWig/Wig file");
+		}
+	}
+
+}