-/* Copyright (c) 2009 Peter Troshin\r
+/* Copyright (c) 2011 Peter Troshin\r
* \r
- * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 1.0 \r
+ * JAva Bioinformatics Analysis Web Services (JABAWS) @version: 2.0 \r
* \r
* This library is free software; you can redistribute it and/or modify it under the terms of the\r
* Apache License version 2 as published by the Apache Software Foundation\r
import java.io.InputStream;\r
import java.util.Arrays;\r
import java.util.List;\r
-import java.util.Map;\r
\r
import org.apache.log4j.Logger;\r
\r
-import compbio.data.sequence.Score;\r
+import compbio.data.sequence.ScoreManager;\r
import compbio.data.sequence.SequenceUtil;\r
import compbio.data.sequence.UnknownFileFormatException;\r
import compbio.engine.client.CommandBuilder;\r
import compbio.engine.client.Executable;\r
import compbio.engine.client.SkeletalExecutable;\r
-import compbio.metadata.Limit;\r
-import compbio.metadata.LimitsManager;\r
import compbio.metadata.ResultNotAvailableException;\r
import compbio.runner.Util;\r
\r
\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
+/*\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
+ addParameters(Arrays.asList("-jar", getLibPath(), "-s=" + STAT_FILE, "-f=H"));\r
}\r
\r
@SuppressWarnings("unchecked")\r
@Override\r
- public Map<String, Score> getResults(String workDirectory)\r
+ public ScoreManager getResults(String workDirectory)\r
throws ResultNotAvailableException {\r
- Map<String, Score> sequences = null;\r
+ ScoreManager sequences = null;\r
try {\r
- InputStream inStream = new FileInputStream(new File(workDirectory,\r
- getOutput()));\r
- sequences = SequenceUtil.readJRonn(inStream);\r
+ InputStream inStream = new FileInputStream(new File(workDirectory, getOutput()));\r
+ sequences = ScoreManager.newInstanceSingleScore(SequenceUtil.readJRonn(inStream));\r
inStream.close();\r
} catch (FileNotFoundException e) {\r
log.error(e.getMessage(), e.getCause());\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
return this;\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
@Override\r
- public Limit<Jronn> getLimit(String presetName) {\r
- if (limits == null) {\r
- limits = getLimits();\r
- }\r
- Limit<Jronn> limit = null;\r
- if (limits != null) {\r
- // this returns default limit if preset is undefined!\r
- limit = limits.getLimitByName(presetName);\r
- }\r
- // If limit is not defined for a particular preset, then return default\r
- // limit\r
- if (limit == null) {\r
- log.debug("Limit for the preset " + presetName\r
- + " is not found. Using default");\r
- limit = limits.getDefaultLimit();\r
- }\r
- return limit;\r
- }\r
-\r
- @Override\r
- public LimitsManager<Jronn> getLimits() {\r
- // synchronise on static field\r
- synchronized (log) {\r
- if (limits == null) {\r
- limits = Util.getLimits(this.getClass());\r
- }\r
- }\r
- return limits;\r
- }\r
-\r
- @Override\r
- public Class<? extends Executable<?>> getType() {\r
- return this.getClass();\r
+ public Class<Jronn> getType() {\r
+ return (Class<Jronn>) this.getClass();\r
}\r
\r
public static String getStatFile() {\r
\r
@Override\r
public CommandBuilder<Jronn> getParameters(ExecProvider provider) {\r
- // If number of cores is provided, set it for the cluster execution\r
- // only!\r
+ // If number of cores is provided, set it for the cluster execution only!\r
if (provider == Executable.ExecProvider.Cluster) {\r
int cpunum = SkeletalExecutable.getClusterCpuNum(getType());\r
cpunum = (cpunum == 0) ? 1 : cpunum;\r