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