diff src/edu/unc/genomics/IntervalFileConverter.java @ 2:e16016635b2a

Uploaded
author timpalpant
date Mon, 13 Feb 2012 22:12:06 -0500
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/edu/unc/genomics/IntervalFileConverter.java	Mon Feb 13 22:12:06 2012 -0500
@@ -0,0 +1,28 @@
+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.IntervalFile;
+
+/**
+ * @author timpalpant
+ *
+ */
+public class IntervalFileConverter implements IStringConverter<IntervalFile<? extends Interval>> {
+
+	@Override
+	public IntervalFile<? extends Interval> convert(String value) throws ParameterException {
+		PathConverter converter = new PathConverter();
+		Path p = converter.convert(value);
+		try {
+			return IntervalFile.autodetect(p);
+		} catch (IOException e) {
+			throw new ParameterException("IOException while attempting to autodetect interval file type");
+		}
+	}
+
+}