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