annotate src/edu/unc/genomics/WigFileConverter.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.WigFile;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
10 import edu.unc.genomics.io.WigFileException;
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
11
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
12 /**
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
13 * @author timpalpant
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
14 *
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
15 */
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
16 public class WigFileConverter implements IStringConverter<WigFile> {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
17
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
18 @Override
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
19 public WigFile convert(String value) throws ParameterException {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
20 PathConverter converter = new PathConverter();
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
21 Path p = converter.convert(value);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
22 try {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
23 return WigFile.autodetect(p);
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
24 } catch (WigFileException | IOException e) {
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
25 throw new ParameterException("Error autodetecting and initializing BigWig/Wig file");
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
26 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
27 }
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
28
e16016635b2a Uploaded
timpalpant
parents:
diff changeset
29 }