1 /* Copyright (c) 2011 Peter Troshin
\r
3 * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0
\r
5 * This library is free software; you can redistribute it and/or modify it under the terms of the
\r
6 * Apache License version 2 as published by the Apache Software Foundation
\r
8 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
\r
9 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Apache
\r
10 * License for more details.
\r
12 * A copy of the license is in apache_license.txt. It is also available here:
\r
13 * @see: http://www.apache.org/licenses/LICENSE-2.0.txt
\r
15 * Any republication or derived work distributed in source code form
\r
16 * must include this copyright and license notice.
\r
19 package compbio.runner.msa;
\r
21 import java.io.FileNotFoundException;
\r
22 import java.io.IOException;
\r
23 import java.util.Arrays;
\r
24 import java.util.List;
\r
26 import org.apache.log4j.Logger;
\r
28 import compbio.data.sequence.Alignment;
\r
29 import compbio.data.sequence.UnknownFileFormatException;
\r
30 import compbio.engine.client.PipedExecutable;
\r
31 import compbio.engine.client.SkeletalExecutable;
\r
32 import compbio.metadata.ResultNotAvailableException;
\r
33 import compbio.runner.RunnerUtil;
\r
35 public class GLprobs extends SkeletalExecutable<GLprobs>
\r
37 PipedExecutable<GLprobs> {
\r
39 private static Logger log = Logger.getLogger(GLprobs.class);
\r
41 private final static String ANNOTATION = "annotation.txt";
\r
43 public static final String KEY_VALUE_SEPARATOR = " ";
\r
48 addParameters(Arrays.asList("-v", "-clustalw", "-annot", ANNOTATION));
\r
50 * Could either have probabilities or the alignment, but not both "-t",
\r
55 @SuppressWarnings("unchecked")
\r
57 public Alignment getResults(String workDirectory)
\r
58 throws ResultNotAvailableException {
\r
60 return RunnerUtil.readClustalFile(workDirectory, getOutput());
\r
61 } catch (FileNotFoundException e) {
\r
62 log.error(e.getMessage(), e.getCause());
\r
63 throw new ResultNotAvailableException(e);
\r
64 } catch (IOException e) {
\r
65 log.error(e.getMessage(), e.getCause());
\r
66 throw new ResultNotAvailableException(e);
\r
67 } catch (UnknownFileFormatException e) {
\r
68 log.error(e.getMessage(), e.getCause());
\r
69 throw new ResultNotAvailableException(e);
\r
70 } catch (NullPointerException e) {
\r
71 log.error(e.getMessage(), e.getCause());
\r
72 throw new ResultNotAvailableException(e);
\r
77 public List<String> getCreatedFiles() {
\r
78 return Arrays.asList(getOutput(), ANNOTATION, getError());
\r
82 public GLprobs setInput(String inFile) {
\r
83 String input = getInput();
\r
84 super.setInput(inFile);
\r
85 // TODO replace with setLast
\r
86 cbuilder.setParam(inFile);
\r
90 @SuppressWarnings("unchecked")
\r
92 public Class<GLprobs> getType() {
\r
93 return (Class<GLprobs>) this.getClass();
\r