- private static Logger log = Logger.getLogger(Jronn.class);\r
-\r
- /**\r
- * Number of cores to use, defaults to 1 for local execution or the value of\r
- * "jronn.cluster.cpunum" property for cluster execution\r
- */\r
- private int ncoreNumber = 0;\r
-\r
- private final String ncorePrm = "-n=";\r
-\r
- // Cache for Limits information\r
- private static LimitsManager<Jronn> limits;\r
-\r
- public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
- public static final String STAT_FILE = "stat.txt";\r
-\r
- public Jronn() {\r
- addParameters(Arrays.asList("-jar", getLibPath(), "-s=" + STAT_FILE,\r
- "-f=H"));\r
- }\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public List<AnnotatedSequence> getResults(String workDirectory)\r
- throws ResultNotAvailableException {\r
- List<AnnotatedSequence> sequences = null;\r
- try {\r
- InputStream inStream = new FileInputStream(new File(workDirectory,\r
- getOutput()));\r
- sequences = SequenceUtil.readJRonn(inStream);\r
- inStream.close();\r
- } catch (FileNotFoundException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- } catch (IOException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- } catch (UnknownFileFormatException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
- } catch (NullPointerException e) {\r
- log.error(e.getMessage(), e.getCause());\r
- throw new ResultNotAvailableException(e);\r
+ private static Logger log = Logger.getLogger(Jronn.class);\r
+\r
+ /**\r
+ * Number of cores to use, defaults to 1 for local execution or the value of\r
+ * "jronn.cluster.cpunum" property for cluster execution\r
+ */\r
+ private int ncoreNumber = 0;\r
+\r
+ private final String ncorePrm = "-n=";\r
+\r
+ // Cache for Limits information\r
+ private static LimitsManager<Jronn> limits;\r
+\r
+ public static final String KEY_VALUE_SEPARATOR = Util.SPACE;\r
+ public static final String STAT_FILE = "stat.txt";\r
+\r
+ public Jronn() {\r
+ addParameters(Arrays.asList("-jar", getLibPath(), "-s=" + STAT_FILE,\r
+ "-f=H"));\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ @Override\r
+ public Map<String, Score> getResults(String workDirectory)\r
+ throws ResultNotAvailableException {\r
+ Map<String, Score> sequences = null;\r
+ try {\r
+ InputStream inStream = new FileInputStream(new File(workDirectory,\r
+ getOutput()));\r
+ sequences = SequenceUtil.readJRonn(inStream);\r
+ inStream.close();\r
+ } catch (FileNotFoundException e) {\r
+ log.error(e.getMessage(), e.getCause());\r
+ throw new ResultNotAvailableException(e);\r
+ } catch (IOException e) {\r
+ log.error(e.getMessage(), e.getCause());\r
+ throw new ResultNotAvailableException(e);\r
+ } catch (UnknownFileFormatException e) {\r
+ log.error(e.getMessage(), e.getCause());\r
+ throw new ResultNotAvailableException(e);\r
+ } catch (NullPointerException e) {\r
+ log.error(e.getMessage(), e.getCause());\r
+ throw new ResultNotAvailableException(e);\r
+ }\r
+ return sequences;\r
+ }\r
+\r
+ private static String getLibPath() {\r
+\r
+ String settings = ph.getProperty("jronn.jar.file");\r
+ if (compbio.util.Util.isEmpty(settings)) {\r
+ throw new NullPointerException(\r
+ "Please define jronn.jar.file property in Executable.properties file"\r
+ + "and initialize it with the location of jronn jar file");\r
+ }\r
+ if (new File(settings).isAbsolute()) {\r
+ // Jronn jar can be found so no actions necessary\r
+ // no further actions is necessary\r
+ return settings;\r
+ }\r
+ return compbio.engine.client.Util.convertToAbsolute(settings);\r
+ }\r
+\r
+ @Override\r
+ public List<String> getCreatedFiles() {\r
+ return Arrays.asList(getOutput(), getError());\r