X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=runner%2Fcompbio%2Frunner%2Fstructure%2FRNAalifold.java;h=c0a50fe73fc1d6ae334cca147bd1f91a511a4bc5;hb=e6227b3fc0bb5abdf275bb24a87607b0555bce10;hp=ff89fcbf3e80e58bf50afd1540b60ade0053e67a;hpb=424e935319103a35bea321a15911ad51fc78ebaf;p=jabaws.git diff --git a/runner/compbio/runner/structure/RNAalifold.java b/runner/compbio/runner/structure/RNAalifold.java index ff89fcb..c0a50fe 100644 --- a/runner/compbio/runner/structure/RNAalifold.java +++ b/runner/compbio/runner/structure/RNAalifold.java @@ -1,57 +1,61 @@ -package compbio.runner.structure; - - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Arrays; -import java.util.List; - -import org.apache.log4j.Logger; - -import compbio.data.sequence.Alignment; -import compbio.data.sequence.UnknownFileFormatException; -import compbio.engine.client.PipedExecutable; -import compbio.engine.client.SkeletalExecutable; -import compbio.metadata.ResultNotAvailableException; -import compbio.runner.Util; - -public class RNAalifold extends SkeletalExecutable - implements PipedExecutable { - - - - private static Logger log = Logger.getLogger(RNAalifold.class); - - - @SuppressWarnings("unchecked") - @Override - // PlaceHolder method - public String getResults(String resultFile) - throws ResultNotAvailableException { - return "null"; - } - - - @Override - public RNAalifold setOutput(String outFile) { - log.info("Set ouput file: " + outFile.toString()); - super.setOutput(outFile); - return this; - } - - @Override - public RNAalifold setInput(String inFile) { - log.info("Set input file: " + inFile.toString()); - cbuilder.setLast(inFile); - super.setInput(inFile); - return this; - } - - @SuppressWarnings("unchecked") - @Override - public Class getType() { - return (Class) this.getClass(); - } - - -} +package compbio.runner.structure; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import org.apache.log4j.Logger; + +import compbio.data.sequence.RNAStructScoreManager; +import compbio.engine.client.PipedExecutable; +import compbio.engine.client.SkeletalExecutable; +import compbio.metadata.ResultNotAvailableException; +import compbio.runner.RunnerUtil; + +public class RNAalifold extends SkeletalExecutable + implements PipedExecutable { + + private static Logger log = Logger.getLogger(RNAalifold.class); + + // May not be necessary as defult is "" but still dont know + // How to deal with different key value separators for different params + public static final String KEY_VALUE_SEPARATOR = " "; + + public RNAalifold() { + super(KEY_VALUE_SEPARATOR); + } + + @Override + public RNAalifold setOutput(String outFile) { + super.setOutput(outFile); + return this; + } + + @Override + public RNAalifold setInput(String inFile) { + cbuilder.setLast(inFile); + super.setInput(inFile); + return this; + } + + @SuppressWarnings("unchecked") + @Override + public Class getType() { + return (Class) this.getClass(); + } + + @SuppressWarnings("unchecked") + @Override + public RNAStructScoreManager getResults(String workDirectory) + throws ResultNotAvailableException { + try { + return RunnerUtil.readRNAStruct(workDirectory, getOutput()); + } catch (FileNotFoundException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } catch (IOException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } + } + +}