Mercurial > repos > timpalpant > java_genomics_toolkit
comparison src/edu/unc/genomics/IntervalFileConverter.java @ 2:e16016635b2a
Uploaded
| author | timpalpant |
|---|---|
| date | Mon, 13 Feb 2012 22:12:06 -0500 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:a54db233ee3d | 2:e16016635b2a |
|---|---|
| 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 } |
