X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=runner%2Fcompbio%2Frunner%2Fdisorder%2FJronn.java;fp=runner%2Fcompbio%2Frunner%2Fdisorder%2FJronn.java;h=1b9037e218c28e077644f6160dcea3c643eabf43;hb=88d713ca7e5f0612550fafe5a0a2e9dbb35d691b;hp=0c4245a7b40b5c62b0b184f5528a603a7765226a;hpb=481202ddde7f0abba2c78e8dfb28c464f6019962;p=jabaws.git diff --git a/runner/compbio/runner/disorder/Jronn.java b/runner/compbio/runner/disorder/Jronn.java index 0c4245a..1b9037e 100644 --- a/runner/compbio/runner/disorder/Jronn.java +++ b/runner/compbio/runner/disorder/Jronn.java @@ -48,117 +48,117 @@ import compbio.runner.Util; */ public class Jronn extends SkeletalExecutable { - private static Logger log = Logger.getLogger(Jronn.class); - - // Cache for Limits information - private static LimitsManager limits; - - public static final String KEY_VALUE_SEPARATOR = Util.SPACE; - public static final String STAT_FILE = "stat.txt"; - - public Jronn() { - addParameters(Arrays.asList("-jar", getLibPath(), "-n=1", "-s=" - + STAT_FILE, "-f=H")); - } - - @SuppressWarnings("unchecked") - @Override - public List getResults(String workDirectory) - throws ResultNotAvailableException { - List sequences = null; - try { - InputStream inStream = new FileInputStream(new File(workDirectory, - getOutput())); - sequences = SequenceUtil.readJRonn(inStream); - inStream.close(); - } 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); - } catch (UnknownFileFormatException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); - } catch (NullPointerException e) { - log.error(e.getMessage(), e.getCause()); - throw new ResultNotAvailableException(e); + private static Logger log = Logger.getLogger(Jronn.class); + + // Cache for Limits information + private static LimitsManager limits; + + public static final String KEY_VALUE_SEPARATOR = Util.SPACE; + public static final String STAT_FILE = "stat.txt"; + + public Jronn() { + addParameters(Arrays.asList("-jar", getLibPath(), "-n=1", "-s=" + + STAT_FILE, "-f=H")); } - return sequences; - } - private static String getLibPath() { + @SuppressWarnings("unchecked") + @Override + public List getResults(String workDirectory) + throws ResultNotAvailableException { + List sequences = null; + try { + InputStream inStream = new FileInputStream(new File(workDirectory, + getOutput())); + sequences = SequenceUtil.readJRonn(inStream); + inStream.close(); + } 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); + } catch (UnknownFileFormatException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } catch (NullPointerException e) { + log.error(e.getMessage(), e.getCause()); + throw new ResultNotAvailableException(e); + } + return sequences; + } - String settings = ph.getProperty("jronn.jar.file"); - if (compbio.util.Util.isEmpty(settings)) { - throw new NullPointerException( - "Please define jronn.jar.file property in Executable.properties file" - + "and initialize it with the location of jronn jar file"); + private static String getLibPath() { + + String settings = ph.getProperty("jronn.jar.file"); + if (compbio.util.Util.isEmpty(settings)) { + throw new NullPointerException( + "Please define jronn.jar.file property in Executable.properties file" + + "and initialize it with the location of jronn jar file"); + } + if (new File(settings).isAbsolute()) { + // Jronn jar can be found so no actions necessary + // no further actions is necessary + return settings; + } + return compbio.engine.client.Util.convertToAbsolute(settings); } - if (new File(settings).isAbsolute()) { - // Jronn jar can be found so no actions necessary - // no further actions is necessary - return settings; + + @Override + public List getCreatedFiles() { + return Arrays.asList(getOutput(), getError()); } - return compbio.engine.client.Util.convertToAbsolute(settings); - } - - @Override - public List getCreatedFiles() { - return Arrays.asList(getOutput(), getError()); - } - - @Override - public Jronn setInput(String inFile) { - super.setInput(inFile); - cbuilder.setParam("-i=" + inFile); - return this; - } - - @Override - public Jronn setOutput(String outFile) { - super.setOutput(outFile); - cbuilder.setParam("-o=" + outFile); - return this; - } - - @Override - public Limit getLimit(String presetName) { - if (limits == null) { - limits = getLimits(); + + @Override + public Jronn setInput(String inFile) { + super.setInput(inFile); + cbuilder.setParam("-i=" + inFile); + return this; } - Limit limit = null; - if (limits != null) { - // this returns default limit if preset is undefined! - limit = limits.getLimitByName(presetName); + + @Override + public Jronn setOutput(String outFile) { + super.setOutput(outFile); + cbuilder.setParam("-o=" + outFile); + return this; } - // If limit is not defined for a particular preset, then return default - // limit - if (limit == null) { - log.debug("Limit for the preset " + presetName - + " is not found. Using default"); - limit = limits.getDefaultLimit(); + + @Override + public Limit getLimit(String presetName) { + if (limits == null) { + limits = getLimits(); + } + Limit limit = null; + if (limits != null) { + // this returns default limit if preset is undefined! + limit = limits.getLimitByName(presetName); + } + // If limit is not defined for a particular preset, then return default + // limit + if (limit == null) { + log.debug("Limit for the preset " + presetName + + " is not found. Using default"); + limit = limits.getDefaultLimit(); + } + return limit; } - return limit; - } - - @Override - public LimitsManager getLimits() { - // synchronise on static field - synchronized (log) { - if (limits == null) { - limits = Util.getLimits(this.getClass()); - } + + @Override + public LimitsManager getLimits() { + // synchronise on static field + synchronized (log) { + if (limits == null) { + limits = Util.getLimits(this.getClass()); + } + } + return limits; } - return limits; - } - @Override - public Class> getType() { - return this.getClass(); - } + @Override + public Class> getType() { + return this.getClass(); + } - public static String getStatFile() { - return STAT_FILE; - } + public static String getStatFile() { + return STAT_FILE; + } }