Mercurial > repos > timpalpant > java_genomics_toolkit
comparison java-genomics-toolkit/src/edu/unc/genomics/IntervalFileConverter.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; | |
2 | |
3 import java.io.IOException; | |
4 import java.nio.file.Path; | |
5 | |
6 import com.beust.jcommander.IStringConverter; | |
7 import com.beust.jcommander.ParameterException; | |
8 | |
9 import edu.unc.genomics.io.IntervalFile; | |
10 | |
11 /** | |
12 * @author timpalpant | |
13 * | |
14 */ | |
15 public class IntervalFileConverter implements IStringConverter<IntervalFile<? extends Interval>> { | |
16 | |
17 @Override | |
18 public IntervalFile<? extends Interval> convert(String value) throws ParameterException { | |
19 PathConverter converter = new PathConverter(); | |
20 Path p = converter.convert(value); | |
21 try { | |
22 return IntervalFile.autodetect(p); | |
23 } catch (IOException e) { | |
24 throw new ParameterException("IOException while attempting to autodetect interval file type"); | |
25 } | |
26 } | |
27 | |
28 } |